diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-12-30 21:36:00 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-01-08 12:34:36 +0100 |
commit | bede2a3ac794120be65fa50bfbc8ed04082c10e0 (patch) | |
tree | aff8f266fdbacfc7a4acb78169522944c5dd64bb /src | |
parent | 3e054a80dd4ac2c67c94d6f584d244f461d98269 (diff) |
Remove qv8engine usage in the contextwrapper
Change-Id: Iaf807add5d971e96cac57e38e13385e901f9c930
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 26 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper_p.h | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 3 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 2 | ||||
-rw-r--r-- | src/qml/types/qquickworkerscript.cpp | 2 |
9 files changed, 25 insertions, 28 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index f6f552119a..7338b8abbe 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1417,7 +1417,7 @@ QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowEngine *engine, int name Scope scope(engine); ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]); Scoped<QmlContextWrapper> wrapper(scope, engine->qmlContextObject()); - return wrapper->qmlSingletonWrapper(engine->v8Engine, name); + return wrapper->qmlSingletonWrapper(engine, name); } void Runtime::convertThisToObject(ExecutionEngine *engine) diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index e696dc838c..9191b53cfc 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -169,7 +169,7 @@ Heap::FunctionObject *QmlBindingWrapper::createQmlCallableForFunction(QQmlContex { ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(qmlContext->engine); QV4::Scope valueScope(engine); - QV4::ScopedObject qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine->v8Engine, qmlContext, scopeObject)); + QV4::ScopedObject qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine, qmlContext, scopeObject)); ScopedContext global(valueScope, valueScope.engine->rootContext()); QV4::Scoped<QV4::QmlBindingWrapper> wrapper(valueScope, engine->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScopeObject)); QV4::Scoped<CallContext> wrapperContext(valueScope, wrapper->context()); diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 712cba74ec..f73548100d 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -53,8 +53,8 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(QmlContextWrapper); -Heap::QmlContextWrapper::QmlContextWrapper(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext) - : Heap::Object(QV8Engine::getV4(engine)) +Heap::QmlContextWrapper::QmlContextWrapper(QV4::ExecutionEngine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext) + : Heap::Object(engine) , readOnly(true) , ownsContext(ownsContext) , isNullWrapper(false) @@ -70,18 +70,16 @@ Heap::QmlContextWrapper::~QmlContextWrapper() context->destroy(); } -ReturnedValue QmlContextWrapper::qmlScope(QV8Engine *v8, QQmlContextData *ctxt, QObject *scope) +ReturnedValue QmlContextWrapper::qmlScope(ExecutionEngine *v4, QQmlContextData *ctxt, QObject *scope) { - ExecutionEngine *v4 = QV8Engine::getV4(v8); Scope valueScope(v4); - Scoped<QmlContextWrapper> w(valueScope, v4->memoryManager->alloc<QmlContextWrapper>(v8, ctxt, scope)); + Scoped<QmlContextWrapper> w(valueScope, v4->memoryManager->alloc<QmlContextWrapper>(v4, ctxt, scope)); return w.asReturnedValue(); } -ReturnedValue QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url) +ReturnedValue QmlContextWrapper::urlScope(ExecutionEngine *v4, const QUrl &url) { - ExecutionEngine *v4 = QV8Engine::getV4(v8); Scope scope(v4); QQmlContextData *context = new QQmlContextData; @@ -89,7 +87,7 @@ ReturnedValue QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url) context->isInternal = true; context->isJSContext = true; - Scoped<QmlContextWrapper> w(scope, v4->memoryManager->alloc<QmlContextWrapper>(v8, context, (QObject*)0, true)); + Scoped<QmlContextWrapper> w(scope, v4->memoryManager->alloc<QmlContextWrapper>(v4, context, (QObject*)0, true)); w->d()->isNullWrapper = true; return w.asReturnedValue(); } @@ -198,7 +196,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty // Fall through } - QQmlEnginePrivate *ep = QQmlEnginePrivate::get(v4->v8Engine->engine()); + QQmlEnginePrivate *ep = QQmlEnginePrivate::get(v4->qmlEngine()); while (context) { // Search context properties @@ -353,7 +351,7 @@ void QmlContextWrapper::registerQmlDependencies(ExecutionEngine *engine, const C // Let the caller check and avoid the function call :) Q_ASSERT(compiledFunction->hasQmlDependencies()); - QQmlEnginePrivate *ep = engine->v8Engine->engine() ? QQmlEnginePrivate::get(engine->v8Engine->engine()) : 0; + QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0; if (!ep) return; QQmlEnginePrivate::PropertyCapture *capture = ep->propertyCapture; @@ -400,7 +398,7 @@ ReturnedValue QmlContextWrapper::idObjectsArray() return d()->idObjectsWrapper->asReturnedValue(); } -ReturnedValue QmlContextWrapper::qmlSingletonWrapper(QV8Engine *v8, String *name) +ReturnedValue QmlContextWrapper::qmlSingletonWrapper(ExecutionEngine *v4, String *name) { if (!d()->context->imports) return Encode::undefined(); @@ -410,9 +408,9 @@ ReturnedValue QmlContextWrapper::qmlSingletonWrapper(QV8Engine *v8, String *name Q_ASSERT(r.isValid()); Q_ASSERT(r.type); Q_ASSERT(r.type->isSingleton()); - Q_ASSERT(v8); + Q_ASSERT(v4); - QQmlEngine *e = v8->engine(); + QQmlEngine *e = v4->qmlEngine(); QQmlType::SingletonInstanceInfo *siinfo = r.type->singletonInstanceInfo(); siinfo->init(e); @@ -451,7 +449,7 @@ ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasPr *hasProperty = true; ExecutionEngine *v4 = m->engine(); - QQmlEnginePrivate *ep = v4->v8Engine->engine() ? QQmlEnginePrivate::get(v4->v8Engine->engine()) : 0; + QQmlEnginePrivate *ep = v4->qmlEngine() ? QQmlEnginePrivate::get(v4->qmlEngine()) : 0; if (ep) ep->captureProperty(&context->idValues[index].bindings); diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h index 9dee1ef878..96c7bc9af4 100644 --- a/src/qml/qml/qqmlcontextwrapper_p.h +++ b/src/qml/qml/qqmlcontextwrapper_p.h @@ -68,7 +68,7 @@ namespace Heap { struct QQmlIdObjectsArray; struct QmlContextWrapper : Object { - QmlContextWrapper(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false); + QmlContextWrapper(ExecutionEngine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false); ~QmlContextWrapper(); bool readOnly; bool ownsContext; @@ -91,8 +91,8 @@ struct Q_QML_EXPORT QmlContextWrapper : Object V4_OBJECT2(QmlContextWrapper, Object) V4_NEEDS_DESTROY - static ReturnedValue qmlScope(QV8Engine *e, QQmlContextData *ctxt, QObject *scope); - static ReturnedValue urlScope(QV8Engine *e, const QUrl &); + static ReturnedValue qmlScope(ExecutionEngine *e, QQmlContextData *ctxt, QObject *scope); + static ReturnedValue urlScope(ExecutionEngine *v4, const QUrl &); static QQmlContextData *callingContext(ExecutionEngine *v4); static void takeContextOwnership(const ValueRef qmlglobal); @@ -110,7 +110,7 @@ struct Q_QML_EXPORT QmlContextWrapper : Object static void registerQmlDependencies(ExecutionEngine *context, const CompiledData::Function *compiledFunction); ReturnedValue idObjectsArray(); - ReturnedValue qmlSingletonWrapper(QV8Engine *e, String *name); + ReturnedValue qmlSingletonWrapper(ExecutionEngine *e, String *name); }; diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 42b10ddc1a..1745a338f3 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -289,7 +289,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); - QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, scopeObject)); + QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, scopeObject)); QV4::Script script(v4, qmlScopeObject, code, filename, line); QV4::ScopedValue result(scope); script.parse(); @@ -322,7 +322,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); - QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, qmlScope)); + QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, qmlScope)); QV4::Script script(v4, qmlScopeObject, code, filename, line); QV4::ScopedValue result(scope); script.parse(); diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index c58a5494f2..883d9f7fda 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -264,7 +264,7 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance) Q_ASSERT(!sharedState->allJavaScriptObjects); sharedState->allJavaScriptObjects = valueScope.alloc(compiledData->totalObjectCount); - QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(QV8Engine::get(engine), context, _scopeObject)); + QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(v4, context, _scopeObject)); QV4::ScopedContext global(valueScope, valueScope.engine->rootContext()); QV4::Scoped<QV4::QmlBindingWrapper> qmlBindingWrapper(valueScope, v4->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScope)); // ### GC @@ -1176,7 +1176,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo ref = QV4::QObjectWrapper::wrap(v4, instance); QV4::Scope valueScope(v4); - QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(QV8Engine::get(engine), context, _scopeObject)); + QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(v4, context, _scopeObject)); QV4::ScopedContext global(valueScope, valueScope.engine->rootContext()); QV4::Scoped<QV4::QmlBindingWrapper> qmlBindingWrapper(valueScope, v4->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScope)); // ### GC diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 99247fc6b7..927577a9e1 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2462,7 +2462,6 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare Q_ASSERT(parentCtxt && parentCtxt->engine); QQmlEnginePrivate *ep = QQmlEnginePrivate::get(parentCtxt->engine); - QV8Engine *v8engine = ep->v8engine(); QV4::ExecutionEngine *v4 = QV8Engine::getV4(parentCtxt->engine); QV4::Scope scope(v4); @@ -2521,7 +2520,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare return QV4::PersistentValue(); } - QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v8engine, ctxt, 0)); + QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, 0)); QV4::QmlContextWrapper::takeContextOwnership(qmlglobal); m_program->qml = qmlglobal; diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 6fc25e58f8..6e685bcedc 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -99,7 +99,7 @@ static ReturnedValue constructMeObject(const ValueRef thisObj, QV8Engine *e) Scope scope(v4); ScopedObject meObj(scope, v4->newObject()); meObj->put(ScopedString(scope, v4->newString(QStringLiteral("ThisObject"))), thisObj); - ScopedValue v(scope, QmlContextWrapper::qmlScope(e, e->callingContext(), 0)); + ScopedValue v(scope, QmlContextWrapper::qmlScope(v4, e->callingContext(), 0)); meObj->put(ScopedString(scope, v4->newString(QStringLiteral("ActivationObject"))), v); return meObj.asReturnedValue(); } diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index c1a7adf630..b822c155b6 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -300,7 +300,7 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript *scri QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine); QV4::Scope scope(v4); - script->object = QV4::QmlContextWrapper::urlScope(workerEngine, script->source); + script->object = QV4::QmlContextWrapper::urlScope(v4, script->source); QV4::Scoped<QV4::QmlContextWrapper> w(scope, script->object.value()); Q_ASSERT(!!w); |