aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-28 15:33:48 +0100
committerLars Knoll <lars.knoll@qt.io>2016-12-04 08:31:49 +0000
commit8a6383775a301c8dd8c917a936655c534932a726 (patch)
tree9b68062c7e58cd6a3026b1ad33403aa09d1bdc7b /src/qml/types
parentaabeeda52c3b4d2e3327bfd00642d2d7c980719b (diff)
Start cleaning up the QmlContextWrapper
The class should get merged with the QV4::QmlContext class. Simplify the cleanup by moving both classes into a common file. Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qquickworkerscript.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 78e7776c9b..e095eabce8 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -42,7 +42,6 @@
#include "qqmllistmodelworkeragent_p.h"
#include <private/qqmlengine_p.h>
#include <private/qqmlexpression_p.h>
-#include <private/qqmlcontextwrapper_p.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qcoreapplication.h>
@@ -318,19 +317,8 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript *scri
QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);
QV4::Scope scope(v4);
-
- QV4::Scoped<QV4::QmlContextWrapper> w(scope, QV4::QmlContextWrapper::urlScope(v4, script->source));
- Q_ASSERT(!!w);
- w->setReadOnly(false);
-
- QV4::ScopedObject api(scope, v4->newObject());
- api->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("sendMessage"))), QV4::ScopedValue(scope, workerEngine->sendFunction(script->id)));
-
- w->QV4::Object::put(QV4::ScopedString(scope, v4->newString(QStringLiteral("WorkerScript"))), api);
-
- w->setReadOnly(true);
-
- script->qmlContext.set(v4, v4->rootContext()->newQmlContext(w));
+ QV4::ScopedValue v(scope, workerEngine->sendFunction(script->id));
+ script->qmlContext.set(v4, QV4::QmlContext::createWorkerContext(v4->rootContext(), script->source, v));
}
return script->qmlContext.value();