diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-22 14:30:57 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-22 15:50:11 +0200 |
commit | a12cc118ddce1615425ddf12296584d34acf57cc (patch) | |
tree | 342e2a8a5cad4594bc177a2d93b9c06873bff45a /src/qml/types | |
parent | 54d8facf66d668d8cea1184f7f24928e97497ae1 (diff) |
Replace usage of v8::Script and qmlModeCompile with QV4::Script
Change-Id: I114a0b7faed39be313cde5617a0ce4a06dece7e2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qquickworkerscript.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 9f31b711d0..1dce932dad 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -63,6 +63,7 @@ #include <private/qv4value_p.h> #include <private/qv4functionobject_p.h> +#include <private/qv4script_p.h> QT_BEGIN_NAMESPACE @@ -224,21 +225,14 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init() "}); "\ "})" - { - v8::Handle<v8::Script> onmessagescript = v8::Script::New(v8::String::New(CALL_ONMESSAGE_SCRIPT)); - onmessage = onmessagescript->Run()->v4Value(); - } - { - v8::Handle<v8::Script> createsendscript = v8::Script::New(v8::String::New(SEND_MESSAGE_CREATE_SCRIPT)); - v8::Handle<v8::Function> createsendconstructor = v8::Handle<v8::Function>::Cast(createsendscript->Run()); + onmessage = QV4::Script(m_v4Engine->rootContext, CALL_ONMESSAGE_SCRIPT).run(); + QV4::Script createsendscript(m_v4Engine->rootContext, SEND_MESSAGE_CREATE_SCRIPT); + QV4::FunctionObject *createsendconstructor = createsendscript.run().asFunctionObject(); - v8::Handle<v8::Value> args[] = { - V8FUNCTION(QQuickWorkerScriptEnginePrivate::sendMessage, this) + QV4::Value args[] = { + V8FUNCTION(QQuickWorkerScriptEnginePrivate::sendMessage, this)->v4Value() }; - v8::Handle<v8::Value> createsendvalue = createsendconstructor->Call(global(), 1, args); - - createsend = createsendvalue->v4Value(); - } + createsend = createsendconstructor->call(global(), args, 1); } // Requires handle and context scope @@ -384,11 +378,14 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) // XXX ??? // workerEngine->baseUrl = url; - v8::Handle<v8::Script> program = workerEngine->qmlModeCompile(sourceCode, url.toString()); + QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine); + + QV4::Script program(v4, activation.asObject(), sourceCode, url.toString()); - QV4::ExecutionContext *ctx = QV8Engine::getV4(workerEngine)->current; + QV4::ExecutionContext *ctx = v4->current; try { - program->Run(activation); + program.parse(); + program.run(); } catch (QV4::Exception &e) { e.accept(ctx); QQmlError error; |