Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 170 files). Show all
Unified · Split
| @@ -20,36 +20,36 @@ ScriptEnginePointer newScriptEngine(ScriptManager* manager) { · 19 unmodified lines | ||
| 20 | 20 | return QSharedPointer<ScriptEngineQtScript>(new ScriptEngineQtScript(manager)); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | −ScriptValuePointer makeScopedHandlerObject(ScriptValuePointer scopeOrCallback, ScriptValuePointer methodOrName) { | |
| 24 | − auto engine = scopeOrCallback->engine(); | |
| 23 | +ScriptValue makeScopedHandlerObject(const ScriptValue& scopeOrCallback, const ScriptValue& methodOrName) { | |
| 24 | + auto engine = scopeOrCallback.engine(); | |
| 25 | 25 | if (!engine) { |
| 26 | 26 | return scopeOrCallback; |
| 27 | 27 | } |
| 28 | − ScriptValuePointer scope; | |
| 29 | − ScriptValuePointer callback = scopeOrCallback; | |
| 30 | − if (scopeOrCallback->isObject()) { | |
| 31 | − if (methodOrName->isString()) { | |
| 28 | + ScriptValue scope; | |
| 29 | + ScriptValue callback = scopeOrCallback; | |
| 30 | + if (scopeOrCallback.isObject()) { | |
| 31 | + if (methodOrName.isString()) { | |
| 32 | 32 | scope = scopeOrCallback; |
| 33 | − callback = scope->property(methodOrName->toString()); | |
| 34 | − } else if (methodOrName->isFunction()) { | |
| 33 | + callback = scope.property(methodOrName.toString()); | |
| 34 | + } else if (methodOrName.isFunction()) { | |
| 35 | 35 | scope = scopeOrCallback; |
| 36 | 36 | callback = methodOrName; |
| 37 | − } else if (!methodOrName->isValid()) { | |
| 37 | + } else if (!methodOrName.isValid()) { | |
| 38 | 38 | // instantiate from an existing scoped handler object |
| 39 | − if (scopeOrCallback->property("callback")->isFunction()) { | |
| 40 | − scope = scopeOrCallback->property("scope"); | |
| 41 | − callback = scopeOrCallback->property("callback"); | |
| 39 | + if (scopeOrCallback.property("callback").isFunction()) { | |
| 40 | + scope = scopeOrCallback.property("scope"); | |
| 41 | + callback = scopeOrCallback.property("callback"); | |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | auto handler = engine->newObject(); |
| 46 | − handler->setProperty("scope", scope); | |
| 47 | − handler->setProperty("callback", callback); | |
| 46 | + handler.setProperty("scope", scope); | |
| 47 | + handler.setProperty("callback", callback); | |
| 48 | 48 | return handler; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | −ScriptValuePointer callScopedHandlerObject(ScriptValuePointer handler, ScriptValuePointer err, ScriptValuePointer result) { | |
| 52 | − return handler->property("callback")->call(handler->property("scope"), ScriptValueList({ err, result })); | |
| 51 | +ScriptValue callScopedHandlerObject(const ScriptValue& handler, const ScriptValue& err, const ScriptValue& result) { | |
| 52 | + return handler.property("callback").call(handler.property("scope"), ScriptValueList({ err, result })); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | bool ScriptEngine::IS_THREADSAFE_INVOCATION(const QString& method) { |