diff options
29 files changed, 116 insertions, 201 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index a2d2fff72b..d5cc765ea8 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -41,6 +41,7 @@ #include <private/qv4script_p.h> #include <private/qqmlcontext_p.h> +#include <private/qv4qmlcontext_p.h> #include <private/qv4qobjectwrapper_p.h> #include <QtQml/qqmlengine.h> @@ -81,7 +82,7 @@ void JavaScriptJob::run() } } if (!engine->qmlContext()) { - engine->pushContext(ctx->newQmlContext(QQmlContextData::get(qmlRootContext), + engine->pushContext(QV4::QmlContext::create(ctx, QQmlContextData::get(qmlRootContext), &scopeObject)); ctx = engine->currentContext; } @@ -201,7 +202,7 @@ void ValueLookupJob::run() QV4::ExecutionEngine *engine = collector->engine(); if (engine->qmlEngine() && !engine->qmlContext()) { scopeObject.reset(new QObject); - engine->pushContext(engine->currentContext->newQmlContext( + engine->pushContext(QV4::QmlContext::create(engine->currentContext, QQmlContextData::get(engine->qmlEngine()->rootContext()), scopeObject.data())); } diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri index dcc04cbd54..0c55200c64 100644 --- a/src/qml/jsruntime/jsruntime.pri +++ b/src/qml/jsruntime/jsruntime.pri @@ -27,6 +27,7 @@ SOURCES += \ $$PWD/qv4numberobject.cpp \ $$PWD/qv4object.cpp \ $$PWD/qv4objectproto.cpp \ + $$PWD/qv4qmlcontext.cpp \ $$PWD/qv4regexpobject.cpp \ $$PWD/qv4stringobject.cpp \ $$PWD/qv4variantobject.cpp \ @@ -48,7 +49,6 @@ HEADERS += \ $$PWD/qv4global_p.h \ $$PWD/qv4engine_p.h \ $$PWD/qv4context_p.h \ - $$PWD/qv4context_p_p.h \ $$PWD/qv4math_p.h \ $$PWD/qv4persistent_p.h \ $$PWD/qv4debugging_p.h \ @@ -73,6 +73,7 @@ HEADERS += \ $$PWD/qv4numberobject_p.h \ $$PWD/qv4object_p.h \ $$PWD/qv4objectproto_p.h \ + $$PWD/qv4qmlcontext_p.h \ $$PWD/qv4regexpobject_p.h \ $$PWD/qv4stringobject_p.h \ $$PWD/qv4variantobject_p.h \ diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 390a5e7d7a..361d321a1a 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -39,7 +39,7 @@ #include <QString> #include "qv4debugging_p.h" -#include <qv4context_p_p.h> +#include <qv4context_p.h> #include <qv4object_p.h> #include <qv4objectproto_p.h> #include <private/qv4mm_p.h> @@ -47,6 +47,7 @@ #include "qv4function_p.h" #include "qv4errorobject_p.h" #include "qv4string_p.h" +#include "qv4qmlcontext_p.h" using namespace QV4; @@ -55,7 +56,6 @@ DEFINE_MANAGED_VTABLE(CallContext); DEFINE_MANAGED_VTABLE(WithContext); DEFINE_MANAGED_VTABLE(CatchContext); DEFINE_MANAGED_VTABLE(GlobalContext); -DEFINE_MANAGED_VTABLE(QmlContext); Heap::CallContext *ExecutionContext::newCallContext(const FunctionObject *function, CallData *callData) { @@ -102,20 +102,6 @@ Heap::CatchContext *ExecutionContext::newCatchContext(Heap::String *exceptionVar return d()->engine->memoryManager->alloc<CatchContext>(d(), exceptionVarName, e); } -Heap::QmlContext *ExecutionContext::newQmlContext(QmlContextWrapper *qml) -{ - Heap::QmlContext *c = d()->engine->memoryManager->alloc<QmlContext>(this, qml); - return c; -} - -Heap::QmlContext *ExecutionContext::newQmlContext(QQmlContextData *context, QObject *scopeObject) -{ - Scope scope(this); - Scoped<QmlContextWrapper> qml(scope, QmlContextWrapper::qmlScope(scope.engine, context, scopeObject)); - Heap::QmlContext *c = d()->engine->memoryManager->alloc<QmlContext>(this, qml); - return c; -} - void ExecutionContext::createMutableBinding(String *name, bool deletable) { Scope scope(this); @@ -182,19 +168,6 @@ void Heap::CatchContext::init(ExecutionContext *outerContext, String *exceptionV this->exceptionValue = exceptionValue; } -void Heap::QmlContext::init(QV4::ExecutionContext *outerContext, QV4::QmlContextWrapper *qml) -{ - Heap::ExecutionContext::init(outerContext->engine(), Heap::ExecutionContext::Type_QmlContext); - outer = outerContext->d(); - strictMode = false; - callData = outer->callData; - lookups = outer->lookups; - constantTable = outer->constantTable; - compilationUnit = outer->compilationUnit; - - this->qml = qml->d(); -} - Identifier * const *CallContext::formals() const { diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 3bad1f03d7..487917df7d 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -55,8 +55,8 @@ QT_BEGIN_NAMESPACE -class QQmlContextData; class QObject; +class QQmlContextData; namespace QV4 { @@ -65,11 +65,12 @@ struct CompilationUnit; struct Function; } -struct QmlContextWrapper; struct Identifier; struct CallContext; struct CatchContext; struct WithContext; +struct QmlContext; +struct QmlContextWrapper; struct CallData { @@ -91,6 +92,8 @@ struct CallData namespace Heap { +struct QmlContext; + struct ExecutionContext : Base { enum ContextType { Type_GlobalContext = 0x1, @@ -177,14 +180,6 @@ struct WithContext : ExecutionContext { }; V4_ASSERT_IS_TRIVIAL(WithContext) -struct QmlContextWrapper; - -struct QmlContext : ExecutionContext { - void init(QV4::ExecutionContext *outerContext, QV4::QmlContextWrapper *qml); - - Pointer<QmlContextWrapper> qml; -}; - } struct Q_QML_EXPORT ExecutionContext : public Managed @@ -201,8 +196,6 @@ struct Q_QML_EXPORT ExecutionContext : public Managed Heap::CallContext *newCallContext(const FunctionObject *f, CallData *callData); Heap::WithContext *newWithContext(Heap::Object *with); Heap::CatchContext *newCatchContext(Heap::String *exceptionVarName, ReturnedValue exceptionValue); - Heap::QmlContext *newQmlContext(QmlContextWrapper *qml); - Heap::QmlContext *newQmlContext(QQmlContextData *context, QObject *scopeObject); void createMutableBinding(String *name, bool deletable); @@ -268,16 +261,6 @@ struct WithContext : public ExecutionContext V4_MANAGED(WithContext, ExecutionContext) }; -struct Q_QML_EXPORT QmlContext : public ExecutionContext -{ - V4_MANAGED(QmlContext, ExecutionContext) - - QObject *qmlScope() const; - QQmlContextData *qmlContext() const; - - void takeContextOwnership(); -}; - inline CallContext *ExecutionContext::asCallContext() { return d()->type >= Heap::ExecutionContext::Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0; diff --git a/src/qml/jsruntime/qv4context_p_p.h b/src/qml/jsruntime/qv4context_p_p.h deleted file mode 100644 index ca8dc0b518..0000000000 --- a/src/qml/jsruntime/qv4context_p_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QV4CONTEXT_P_P_H -#define QV4CONTEXT_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// This header defines a couple of inlinable methods. -// These implementation cannot be put in qv4context_p.h, because they rely on the -// QQmlContextWrapper, which in turn is a QV4::Object subclass (so it includes qv4object_p.h), -// which includes qv4engine_p.h, that needs to include qv4context_p.h - -#include "qv4context_p.h" -#include "private/qqmlcontextwrapper_p.h" - -QT_BEGIN_NAMESPACE - -namespace QV4 { - -QObject *QmlContext::qmlScope() const -{ - return d()->qml->scopeObject; -} - -QQmlContextData *QmlContext::qmlContext() const -{ - return *d()->qml->context; -} - -void QmlContext::takeContextOwnership() { - d()->qml->ownsContext = true; -} - -} // QV4 namespace - -QT_END_NAMESPACE - -#endif // QV4CONTEXT_P_P_H diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 5c79c4ea97..698c73a910 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ #include <qv4engine_p.h> -#include <qv4context_p.h> +#include <qv4qmlcontext_p.h> #include <qv4value_p.h> #include <qv4object_p.h> #include <qv4objectproto_p.h> @@ -71,7 +71,6 @@ #include "qv4typedarray_p.h" #include <private/qv8engine_p.h> #include <private/qjsvalue_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qqmltypewrapper_p.h> #include <private/qqmlvaluetypewrapper_p.h> #include <private/qqmlvaluetype_p.h> @@ -714,6 +713,27 @@ Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o) return obj->d(); } +Heap::QmlContext *ExecutionEngine::qmlContext() const +{ + Heap::ExecutionContext *ctx = current; + + // get the correct context when we're within a builtin function + if (ctx->type == Heap::ExecutionContext::Type_SimpleCallContext && !ctx->outer) + ctx = parentContext(currentContext)->d(); + + if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !ctx->outer) + return 0; + + while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext) + ctx = ctx->outer; + + Q_ASSERT(ctx); + if (ctx->type != Heap::ExecutionContext::Type_QmlContext) + return 0; + + return static_cast<Heap::QmlContext *>(ctx); +} + QObject *ExecutionEngine::qmlScopeObject() const { Heap::QmlContext *ctx = qmlContext(); diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 64bf77b1f5..bf6898001f 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -548,27 +548,6 @@ inline ExecutionContext *ExecutionEngine::parentContext(ExecutionContext *contex return o ? context - o : 0; } -inline Heap::QmlContext *ExecutionEngine::qmlContext() const -{ - Heap::ExecutionContext *ctx = current; - - // get the correct context when we're within a builtin function - if (ctx->type == Heap::ExecutionContext::Type_SimpleCallContext && !ctx->outer) - ctx = parentContext(currentContext)->d(); - - if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !ctx->outer) - return 0; - - while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext) - ctx = ctx->outer; - - Q_ASSERT(ctx); - if (ctx->type != Heap::ExecutionContext::Type_QmlContext) - return 0; - - return static_cast<Heap::QmlContext *>(ctx); -} - inline void Heap::Base::mark(QV4::ExecutionEngine *engine) { diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index ee2fe6bfd7..28a9949464 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -208,7 +208,7 @@ Heap::FunctionObject *FunctionObject::createQmlFunction(QQmlContextData *qmlCont ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(qmlContext->engine); QV4::Scope valueScope(engine); ExecutionContext *global = valueScope.engine->rootContext(); - QV4::Scoped<QmlContext> wrapperContext(valueScope, global->newQmlContext(qmlContext, scopeObject)); + QV4::Scoped<QmlContext> wrapperContext(valueScope, QmlContext::create(global, qmlContext, scopeObject)); if (!signalParameters.isEmpty()) { if (error) diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp index be8057e9f5..1d393cf0aa 100644 --- a/src/qml/jsruntime/qv4include.cpp +++ b/src/qml/jsruntime/qv4include.cpp @@ -53,7 +53,6 @@ #include <private/qv4functionobject_p.h> #include <private/qv4script_p.h> #include <private/qv4context_p.h> -#include <private/qqmlcontextwrapper_p.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index 2418003519..a4ace4c3eb 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qqmlcontextwrapper_p.h" +#include "qv4qmlcontext_p.h" #include <private/qv8engine_p.h> #include <private/qqmlengine_p.h> @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE using namespace QV4; DEFINE_OBJECT_VTABLE(QmlContextWrapper); +DEFINE_MANAGED_VTABLE(QmlContext); void Heap::QmlContextWrapper::init(QQmlContextData *context, QObject *scopeObject, bool ownsContext) { @@ -320,4 +321,42 @@ void QmlContextWrapper::put(Managed *m, String *name, const Value &value) Object::put(m, name, value); } +void Heap::QmlContext::init(QV4::ExecutionContext *outerContext, QV4::QmlContextWrapper *qml) +{ + Heap::ExecutionContext::init(outerContext->engine(), Heap::ExecutionContext::Type_QmlContext); + outer = outerContext->d(); + strictMode = false; + callData = outer->callData; + lookups = outer->lookups; + constantTable = outer->constantTable; + compilationUnit = outer->compilationUnit; + + this->qml = qml->d(); +} + +Heap::QmlContext *QmlContext::createWorkerContext(ExecutionContext *parent, const QUrl &source, Value *sendFunction) +{ + Scope scope(parent); + + QV4::Scoped<QV4::QmlContextWrapper> qml(scope, QV4::QmlContextWrapper::urlScope(scope.engine, source)); + Q_ASSERT(!!qml); + + qml->setReadOnly(false); + QV4::ScopedObject api(scope, scope.engine->newObject()); + api->put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("sendMessage"))), *sendFunction); + qml->QV4::Object::put(QV4::ScopedString(scope, scope.engine->newString(QStringLiteral("WorkerScript"))), api); + qml->setReadOnly(true); + + Heap::QmlContext *c = parent->d()->engine->memoryManager->alloc<QmlContext>(parent, qml); + return c; +} + +Heap::QmlContext *QmlContext::create(ExecutionContext *parent, QQmlContextData *context, QObject *scopeObject) +{ + Scope scope(parent); + Scoped<QmlContextWrapper> qml(scope, QmlContextWrapper::qmlScope(scope.engine, context, scopeObject)); + Heap::QmlContext *c = parent->d()->engine->memoryManager->alloc<QmlContext>(parent, qml); + return c; +} + QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/jsruntime/qv4qmlcontext_p.h index 126ffecf0d..15a0aafbe8 100644 --- a/src/qml/qml/qqmlcontextwrapper_p.h +++ b/src/qml/jsruntime/qv4qmlcontext_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QQMLCONTEXTWRAPPER_P_H -#define QQMLCONTEXTWRAPPER_P_H +#ifndef QV4QMLCONTEXT_P_H +#define QV4QMLCONTEXT_P_H // // W A R N I N G @@ -55,12 +55,15 @@ #include <private/qtqmlglobal_p.h> #include <private/qv4object_p.h> +#include <private/qv4context_p.h> #include <private/qqmlcontext_p.h> QT_BEGIN_NAMESPACE namespace QV4 { +struct QmlContextWrapper; + namespace Heap { struct QmlContextWrapper : Object { @@ -74,6 +77,12 @@ struct QmlContextWrapper : Object { QQmlQPointer<QObject> scopeObject; }; +struct QmlContext : ExecutionContext { + void init(QV4::ExecutionContext *outerContext, QV4::QmlContextWrapper *qml); + + Pointer<QmlContextWrapper> qml; +}; + } struct Q_QML_EXPORT QmlContextWrapper : Object @@ -97,9 +106,28 @@ struct Q_QML_EXPORT QmlContextWrapper : Object static void put(Managed *m, String *name, const Value &value); }; +struct Q_QML_EXPORT QmlContext : public ExecutionContext +{ + V4_MANAGED(QmlContext, ExecutionContext) + + static Heap::QmlContext *createWorkerContext(QV4::ExecutionContext *parent, const QUrl &source, Value *sendFunction); + static Heap::QmlContext *create(QV4::ExecutionContext *parent, QQmlContextData *context, QObject *scopeObject); + + QObject *qmlScope() const { + return d()->qml->scopeObject; + } + QQmlContextData *qmlContext() const { + return *d()->qml->context; + } + + void takeContextOwnership() { + d()->qml->ownsContext = true; + } +}; + } QT_END_NAMESPACE -#endif // QV8CONTEXTWRAPPER_P_H +#endif diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 80607f4067..7ded931af3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -48,7 +48,6 @@ #include <private/qqmlglobal_p.h> #include <private/qqmltypewrapper_p.h> #include <private/qqmlvaluetypewrapper_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qqmllistwrapper_p.h> #include <private/qqmlbuiltinfunctions_p.h> #include <private/qv8engine_p.h> diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 61ef168447..b71bd4146a 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -53,7 +53,7 @@ #include "qv4numberobject_p.h" #include "private/qlocale_tools_p.h" #include "qv4scopedvalue_p.h" -#include <private/qqmlcontextwrapper_p.h> +#include <private/qv4qmlcontext_p.h> #include <private/qqmltypewrapper_p.h> #include <private/qqmlengine_p.h> #include <private/qqmljavascriptexpression_p.h> diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 787047806a..8c27d36f50 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -54,7 +54,6 @@ #include <private/qv4profiling_p.h> #include <qv4jsir_p.h> #include <qv4codegen_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <QtCore/QDebug> #include <QtCore/QString> diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index 2e87a7692b..686fa49c88 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -53,7 +53,7 @@ #include "qv4global_p.h" #include "qv4engine_p.h" #include "qv4functionobject_p.h" -#include "qv4context_p.h" +#include "qv4qmlcontext_p.h" #include <QQmlError> diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 8d8da3742d..412dc6cba2 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -42,7 +42,6 @@ SOURCES += \ $$PWD/qqmlabstracturlinterceptor.cpp \ $$PWD/qqmlapplicationengine.cpp \ $$PWD/qqmllistwrapper.cpp \ - $$PWD/qqmlcontextwrapper.cpp \ $$PWD/qqmlvaluetypewrapper.cpp \ $$PWD/qqmltypewrapper.cpp \ $$PWD/qqmlfileselector.cpp \ @@ -113,8 +112,6 @@ HEADERS += \ $$PWD/qqmlapplicationengine_p.h \ $$PWD/qqmlapplicationengine.h \ $$PWD/qqmllistwrapper_p.h \ - $$PWD/qqmlcontextwrapper_p.h \ - $$PWD/qqmlvaluetypewrapper_p.h \ $$PWD/qqmltypewrapper_p.h \ $$PWD/qqmlfileselector_p.h \ $$PWD/qqmlfileselector.h \ diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 203bfec838..c150b1ee29 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -46,7 +46,6 @@ #include <private/qqmlprofiler_p.h> #include <private/qqmlexpression_p.h> #include <private/qqmlscriptstring_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qqmlbuiltinfunctions_p.h> #include <private/qqmlvmemetaobject_p.h> #include <private/qqmlvaluetypewrapper_p.h> diff --git a/src/qml/qml/qqmldelayedcallqueue.cpp b/src/qml/qml/qqmldelayedcallqueue.cpp index d10a8c7718..7552e1e82b 100644 --- a/src/qml/qml/qqmldelayedcallqueue.cpp +++ b/src/qml/qml/qqmldelayedcallqueue.cpp @@ -43,7 +43,6 @@ #include <private/qqmljavascriptexpression_p.h> #include <private/qv4value_p.h> #include <private/qv4qobjectwrapper_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <QQmlError> diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 8020bdb2be..54d9222a8e 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -374,7 +374,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); - QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->rootContext()->newQmlContext(ctxt, scopeObject)); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(v4->rootContext(), ctxt, scopeObject)); QV4::Script script(v4, qmlContext, code, filename, line); QV4::ScopedValue result(scope); script.parse(); @@ -404,7 +404,7 @@ void QQmlJavaScriptExpression::createQmlBinding(QQmlContextData *ctxt, QObject * QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); - QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->rootContext()->newQmlContext(ctxt, qmlScope)); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(v4->rootContext(), ctxt, qmlScope)); QV4::Script script(v4, qmlContext, code, filename, line); QV4::ScopedValue result(scope); script.parse(); diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index d07be77697..76829c48c9 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -44,7 +44,6 @@ #include <private/qv4function_p.h> #include <private/qv4functionobject_p.h> #include <private/qv4qobjectwrapper_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qqmlbinding_p.h> #include <private/qqmlstringconverters_p.h> #include <private/qqmlboundsignal_p.h> @@ -1017,7 +1016,7 @@ void QQmlObjectCreator::registerObjectWithContextById(const QV4::CompiledData::O QV4::Heap::QmlContext *QQmlObjectCreator::currentQmlContext() { if (!_qmlContext->isObject()) - _qmlContext->setM(v4->rootContext()->newQmlContext(context, _scopeObject)); + _qmlContext->setM(QV4::QmlContext::create(v4->rootContext(), context, _scopeObject)); return _qmlContext->d(); } diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 09b9dcf452..7ad18c8efb 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -39,7 +39,6 @@ #include "qqmltypeloader_p.h" #include "qqmlabstracturlinterceptor.h" -#include "qqmlcontextwrapper_p.h" #include "qqmlexpression_p.h" #include <private/qqmlengine_p.h> @@ -2833,7 +2832,7 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parent return QV4::Encode::undefined(); } - QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->rootContext()->newQmlContext(ctxt, 0)); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(v4->rootContext(), ctxt, 0)); qmlContext->takeContextOwnership(); m_program->qmlContext.set(scope.engine, qmlContext); diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 5c3ad6b2a6..fd1e9cc2be 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qqmltypewrapper_p.h" -#include <private/qqmlcontextwrapper_p.h> #include <private/qv8engine_p.h> #include <private/qqmlengine_p.h> diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index be93baf9f6..8fb1f869ff 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -43,7 +43,6 @@ #include <private/qqmlvaluetype_p.h> #include <private/qqmlbinding_p.h> #include <private/qqmlglobal_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qqmlbuiltinfunctions_p.h> #include <private/qv4engine_p.h> diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 01c4f476d6..72d4ab7e8f 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -62,7 +62,6 @@ #include "qqmlpropertyvalueinterceptor_p.h" #include "qqmlvaluetypeproxybinding_p.h" #include "qqmlexpression_p.h" -#include "qqmlcontextwrapper_p.h" #include <QStack> #include <QPointF> diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 6b86e38f19..47751aa2c6 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -50,7 +50,6 @@ #include <private/qv4domerrors_p.h> #include <private/qv4engine_p.h> #include <private/qv4functionobject_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qv4scopedvalue_p.h> #include <QtCore/qobject.h> diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 1df468dd49..dadff819cf 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -52,7 +52,6 @@ #include <private/qqmlplatform_p.h> #include <private/qjsvalue_p.h> #include <private/qqmltypewrapper_p.h> -#include <private/qqmlcontextwrapper_p.h> #include <private/qqmlvaluetypewrapper_p.h> #include <private/qqmllistwrapper_p.h> #include <private/qv4scopedvalue_p.h> 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(); diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 723f575330..690b1cdf24 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -38,6 +38,7 @@ #include <private/qv8engine_p.h> #include <private/qqmlcontext_p.h> #include <private/qv4scopedvalue_p.h> +#include <private/qv4qmlcontext_p.h> #include <qcolor.h> #include "../../shared/util.h" #include "testhttpserver.h" diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index be04ec2bf3..c3845178a7 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -36,7 +36,7 @@ #include <QtCore/qnumeric.h> #include <private/qqmlengine_p.h> #include <private/qqmlvmemetaobject_p.h> -#include <private/qqmlcontextwrapper_p.h> +#include <private/qv4qmlcontext_p.h> #include "testtypes.h" #include "testhttpserver.h" #include "../../shared/util.h" |