From 47fbcb47771a36ab9fd0a4d5ede7b7504ab1410d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 11 Jan 2015 16:30:29 +0100 Subject: Get rid of all uses of Managed::engine() Change-Id: I596f14554d81f5e9af9996294d96047f2e810bef Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlcontextwrapper.cpp | 14 +++++++------- src/qml/qml/qqmllistwrapper.cpp | 4 ++-- src/qml/qml/qqmltypewrapper.cpp | 6 +++--- src/qml/qml/qqmlvaluetypewrapper.cpp | 4 ++-- src/qml/qml/qqmlxmlhttprequest.cpp | 14 +++++++------- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index dda5187b4f..0c16ae18db 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -126,9 +126,9 @@ void QmlContextWrapper::takeContextOwnership(const ValueRef qmlglobal) ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty) { Q_ASSERT(m->as()); - QV4::ExecutionEngine *v4 = m->engine(); - QV4::Scope scope(v4); QmlContextWrapper *resource = static_cast(m); + QV4::ExecutionEngine *v4 = resource->engine(); + QV4::Scope scope(v4); // In V8 the JS global object would come _before_ the QML global object, // so simulate that here. @@ -268,11 +268,12 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value) { Q_ASSERT(m->as()); - ExecutionEngine *v4 = m->engine(); + QmlContextWrapper *resource = static_cast(m); + ExecutionEngine *v4 = resource->engine(); QV4::Scope scope(v4); if (scope.hasException()) return; - QV4::Scoped wrapper(scope, static_cast(m)); + QV4::Scoped wrapper(scope, resource); PropertyAttributes attrs; Property *pd = wrapper->__getOwnProperty__(name, &attrs); @@ -428,7 +429,7 @@ Heap::QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QV4::QmlCo ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasProperty) { - Scope scope(m->engine()); + Scope scope(static_cast(m)->engine()); Scoped This(scope, static_cast(m)); Scoped contextWrapper(scope, This->d()->contextWrapper); QQmlContextData *context = contextWrapper->getContext(); @@ -446,8 +447,7 @@ ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasPr if (hasProperty) *hasProperty = true; - ExecutionEngine *v4 = m->engine(); - QQmlEnginePrivate *ep = v4->qmlEngine() ? QQmlEnginePrivate::get(v4->qmlEngine()) : 0; + QQmlEnginePrivate *ep = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : 0; if (ep) ep->captureProperty(&context->idValues[index].bindings); diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index 022a60faf4..af955ff15c 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -95,8 +95,8 @@ QVariant QmlListWrapper::toVariant() const ReturnedValue QmlListWrapper::get(Managed *m, String *name, bool *hasProperty) { Q_ASSERT(m->as()); - QV4::ExecutionEngine *v4 = m->engine(); QmlListWrapper *w = static_cast(m); + QV4::ExecutionEngine *v4 = w->engine(); if (name->equals(v4->id_length) && !w->d()->object.isNull()) { quint32 count = w->d()->property.count ? w->d()->property.count(&w->d()->property) : 0; @@ -115,8 +115,8 @@ ReturnedValue QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProper Q_UNUSED(hasProperty); Q_ASSERT(m->as()); - QV4::ExecutionEngine *v4 = m->engine(); QmlListWrapper *w = static_cast(m); + QV4::ExecutionEngine *v4 = w->engine(); quint32 count = w->d()->property.count ? w->d()->property.count(&w->d()->property) : 0; if (index < count && w->d()->property.at) { diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index a72950e7d8..77d472e0c7 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -125,10 +125,10 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty) { Q_ASSERT(m->as()); - QV4::ExecutionEngine *v4 = m->engine(); + QV4::ExecutionEngine *v4 = static_cast(m)->engine(); QV4::Scope scope(v4); - Scoped w(scope, static_cast(m)); + Scoped w(scope, static_cast(m)); if (hasProperty) *hasProperty = true; @@ -232,7 +232,7 @@ void QmlTypeWrapper::put(Managed *m, String *name, const ValueRef value) { Q_ASSERT(m->as()); QmlTypeWrapper *w = static_cast(m); - QV4::ExecutionEngine *v4 = m->engine(); + QV4::ExecutionEngine *v4 = w->engine(); if (v4->hasException) return; diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index d36549fcf5..1e138be341 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -287,7 +287,7 @@ ReturnedValue QQmlValueTypeWrapper::get(Managed *m, String *name, bool *hasPrope { Q_ASSERT(m->as()); QQmlValueTypeWrapper *r = static_cast(m); - QV4::ExecutionEngine *v4 = m->engine(); + QV4::ExecutionEngine *v4 = r->engine(); // Note: readReferenceValue() can change the reference->type. if (QQmlValueTypeReference *reference = r->as()) { @@ -340,7 +340,7 @@ ReturnedValue QQmlValueTypeWrapper::get(Managed *m, String *name, bool *hasPrope void QQmlValueTypeWrapper::put(Managed *m, String *name, const ValueRef value) { Q_ASSERT(m->as()); - ExecutionEngine *v4 = m->engine(); + ExecutionEngine *v4 = static_cast(m)->engine(); Scope scope(v4); if (scope.hasException()) return; diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 6d730970b3..7c4413a500 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -872,8 +872,8 @@ bool Node::isNull() const ReturnedValue NamedNodeMap::getIndexed(Managed *m, uint index, bool *hasProperty) { - QV4::ExecutionEngine *v4 = m->engine(); NamedNodeMap *r = m->as(); + QV4::ExecutionEngine *v4 = r->engine(); if (!r) { if (hasProperty) *hasProperty = false; @@ -894,7 +894,7 @@ ReturnedValue NamedNodeMap::get(Managed *m, String *name, bool *hasProperty) { Q_ASSERT(m->as()); NamedNodeMap *r = static_cast(m); - QV4::ExecutionEngine *v4 = m->engine(); + QV4::ExecutionEngine *v4 = r->engine(); name->makeIdentifier(v4); if (name->equals(v4->id_length)) @@ -922,8 +922,8 @@ ReturnedValue NamedNodeMap::create(ExecutionEngine *v4, NodeImpl *data, const QL ReturnedValue NodeList::getIndexed(Managed *m, uint index, bool *hasProperty) { Q_ASSERT(m->as()); - QV4::ExecutionEngine *v4 = m->engine(); NodeList *r = static_cast(m); + QV4::ExecutionEngine *v4 = r->engine(); if ((int)index < r->d()->d->children.count()) { if (hasProperty) @@ -938,8 +938,8 @@ ReturnedValue NodeList::getIndexed(Managed *m, uint index, bool *hasProperty) ReturnedValue NodeList::get(Managed *m, String *name, bool *hasProperty) { Q_ASSERT(m->as()); - QV4::ExecutionEngine *v4 = m->engine(); NodeList *r = static_cast(m); + QV4::ExecutionEngine *v4 = r->engine(); name->makeIdentifier(v4); @@ -1614,13 +1614,13 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject } static ReturnedValue construct(Managed *that, QV4::CallData *) { - Scope scope(that->engine()); + Scope scope(static_cast(that)->engine()); Scoped ctor(scope, that->as()); if (!ctor) - return that->engine()->throwTypeError(); + return scope.engine->throwTypeError(); QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(scope.engine, scope.engine->v8Engine->networkAccessManager()); - Scoped w(scope, that->engine()->memoryManager->alloc(that->engine(), r)); + Scoped w(scope, scope.engine->memoryManager->alloc(scope.engine, r)); ScopedObject proto(scope, ctor->d()->proto); w->setPrototype(proto); return w.asReturnedValue(); diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 360c560d0b..0878063f2e 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1158,7 +1158,7 @@ void QQmlBindingFunction::initBindingLocation() ReturnedValue QQmlBindingFunction::call(Managed *that, CallData *callData) { - Scope scope(that->engine()); + Scope scope(static_cast(that)->engine()); ScopedFunctionObject function(scope, static_cast(that)->d()->originalFunction); return function->call(callData); } -- cgit v1.2.3