History

* Update per CR feedback / code standards * Cull log spam * Add tryLock to deferred processor to preempt unnecessary loadEntityContent round-trips

humbletim committed 9 years ago

Commit 417587d1 parent b1595625 files · +32 −27Browse files

Showing the changes to libraries/script-engine/src/BaseScriptEngine.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/BaseScriptEngine.cpp+8−10
@@ -118,14 +118,14 @@ QScriptValue BaseScriptEngine::cloneUncaughtException(const QString& extraDetail · 117 unmodified lines
118 }118 }
119 if (fileName.isEmpty()) {119 if (fileName.isEmpty()) {
120 // climb the stack frames looking for something useful to display120 // climb the stack frames looking for something useful to display
121 for(auto ctx = currentContext(); ctx && fileName.isEmpty(); ctx = ctx->parentContext()) {121 for (auto c = currentContext(); c && fileName.isEmpty(); c = c->parentContext()) {
122 QScriptContextInfo info { ctx };122 QScriptContextInfo info { c };
123 if (!info.fileName().isEmpty()) {123 if (!info.fileName().isEmpty()) {
124 // take fileName:lineNumber as a pair124 // take fileName:lineNumber as a pair
125 fileName = info.fileName();125 fileName = info.fileName();
126 lineNumber = info.lineNumber();126 lineNumber = info.lineNumber();
127 if (backtrace.isEmpty()) {127 if (backtrace.isEmpty()) {
128 backtrace = ctx->backtrace();128 backtrace = c->backtrace();
129 }129 }
130 break;130 break;
131 }131 }
@@ -181,8 +181,6 @@ QScriptValue BaseScriptEngine::evaluateInClosure(const QScriptValue& closure, co · 49 unmodified lines
181 return QScriptValue();181 return QScriptValue();
182 }182 }
183 183
184 //_debugDump("evaluateInClosure.closure", closure);
185
186 const auto fileName = program.fileName();184 const auto fileName = program.fileName();
187 const auto shortName = QUrl(fileName).fileName();185 const auto shortName = QUrl(fileName).fileName();
188 186
@@ -197,17 +195,17 @@ QScriptValue BaseScriptEngine::evaluateInClosure(const QScriptValue& closure, co · 8 unmodified lines
197 setGlobalObject(global);195 setGlobalObject(global);
198 }196 }
199 197
200 auto ctx = pushContext();198 auto context = pushContext();
201 199
202 auto thiz = closure.property("this");200 auto thiz = closure.property("this");
203 if (thiz.isObject()) {201 if (thiz.isObject()) {
204#ifdef DEBUG_JS202#ifdef DEBUG_JS
205 qCDebug(scriptengine) << " setting this = closure.this" << shortName;203 qCDebug(scriptengine) << " setting this = closure.this" << shortName;
206#endif204#endif
207 ctx->setThisObject(thiz);205 context->setThisObject(thiz);
208 }206 }
209 207
210 ctx->pushScope(closure);208 context->pushScope(closure);
211#ifdef DEBUG_JS209#ifdef DEBUG_JS
212 qCDebug(scriptengine) << QString("[%1] evaluateInClosure %2").arg(isEvaluating()).arg(shortName);210 qCDebug(scriptengine) << QString("[%1] evaluateInClosure %2").arg(isEvaluating()).arg(shortName);
213#endif211#endif
@@ -244,8 +242,8 @@ QScriptValue BaseScriptEngine::newLambdaFunction(std::function<QScriptValue(QScr · 30 unmodified lines
244 auto lambda = new Lambda(this, operation, data);242 auto lambda = new Lambda(this, operation, data);
245 auto object = newQObject(lambda, ownership);243 auto object = newQObject(lambda, ownership);
246 auto call = object.property("call");244 auto call = object.property("call");
247 call.setPrototype(object); // ctx->callee().prototype() === Lambda QObject245 call.setPrototype(object); // context->callee().prototype() === Lambda QObject
248 call.setData(data); // ctx->callee().data() will === data param246 call.setData(data); // context->callee().data() will === data param
249 return call;247 return call;
250}248}
251QString Lambda::toString() const {249QString Lambda::toString() const {