diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-11-21 13:18:23 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-12-11 08:40:48 +0100 |
commit | 4322c8d7686c7cbbdf348146d32d705007b21d56 (patch) | |
tree | c60d6568f3b47786b24c0d74eb6e61b7cac18add /src/qml/qml | |
parent | ddfe9defa803fdbfab10ab58b77df242cdb4cedd (diff) |
Better encapsulate access to the global object
Change-Id: I8a76112d821cb3fc172ba0d16ee8410d39b4422a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qv4domerrors.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qv4sqlerrors.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 14 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index b4461e32fa..395d33f3c1 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1245,7 +1245,7 @@ void QQmlComponent::createObject(QQmlV4Function *args) QV4::ScopedValue f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlglobal)); Q_ASSERT(f->asFunctionObject()); QV4::ScopedCallData callData(scope, 2); - callData->thisObject = v4->globalObject; + callData->thisObject = v4->globalObject(); callData->args[0] = object; callData->args[1] = valuemap; f->asFunctionObject()->call(callData); @@ -1399,7 +1399,7 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(QV8Engine::getV4(v8engine), QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobalObj)); QV4::ScopedCallData callData(scope, 2); - callData->thisObject = v4engine->globalObject; + callData->thisObject = v4engine->globalObject(); callData->args[0] = object; callData->args[1] = valuemap; f->call(callData); @@ -1500,7 +1500,7 @@ void QV4::QmlIncubatorObject::setInitialState(QObject *o) QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal.asObject())); QV4::ScopedCallData callData(scope, 2); - callData->thisObject = v4->globalObject; + callData->thisObject = v4->globalObject(); callData->args[0] = QV4::QObjectWrapper::wrap(v4, o); callData->args[1] = d()->valuemap; f->call(callData); diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 51e72223d0..0ce141cde8 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -136,7 +136,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty // In V8 the JS global object would come _before_ the QML global object, // so simulate that here. bool hasProp; - QV4::ScopedValue result(scope, v4->globalObject->get(name, &hasProp)); + QV4::ScopedValue result(scope, v4->globalObject()->get(name, &hasProp)); if (hasProp) { if (hasProperty) *hasProperty = hasProp; diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 6a3e0d4a73..dad90b77f2 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -147,7 +147,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue()); - callData->thisObject = v4->globalObject; + callData->thisObject = v4->globalObject(); if (scopeObject()) { QV4::ScopedValue value(scope, QV4::QObjectWrapper::wrap(v4, scopeObject())); if (value->isObject()) diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index e8cc7e65b7..4b26778008 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -2001,7 +2001,7 @@ void *qt_add_qmlxmlhttprequest(QV8Engine *engine) Scoped<QQmlXMLHttpRequestCtor> ctor(scope, v4->memoryManager->alloc<QQmlXMLHttpRequestCtor>(v4)); ScopedString s(scope, v4->newString(QStringLiteral("XMLHttpRequest"))); - v4->globalObject->defineReadonlyProperty(s.getPointer(), ctor); + v4->globalObject()->defineReadonlyProperty(s.getPointer(), ctor); QQmlXMLHttpRequestData *data = new QQmlXMLHttpRequestData; return data; diff --git a/src/qml/qml/v8/qv4domerrors.cpp b/src/qml/qml/v8/qv4domerrors.cpp index cc7a6546f9..c0ea03f83f 100644 --- a/src/qml/qml/v8/qv4domerrors.cpp +++ b/src/qml/qml/v8/qv4domerrors.cpp @@ -59,7 +59,7 @@ void qt_add_domexceptions(ExecutionEngine *e) domexception->defineReadonlyProperty(QStringLiteral("INVALID_ACCESS_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_ACCESS_ERR)); domexception->defineReadonlyProperty(QStringLiteral("VALIDATION_ERR"), Primitive::fromInt32(DOMEXCEPTION_VALIDATION_ERR)); domexception->defineReadonlyProperty(QStringLiteral("TYPE_MISMATCH_ERR"), Primitive::fromInt32(DOMEXCEPTION_TYPE_MISMATCH_ERR)); - e->globalObject->defineDefaultProperty(QStringLiteral("DOMException"), domexception); + e->globalObject()->defineDefaultProperty(QStringLiteral("DOMException"), domexception); } QT_END_NAMESPACE diff --git a/src/qml/qml/v8/qv4sqlerrors.cpp b/src/qml/qml/v8/qv4sqlerrors.cpp index e8e0462b6e..77e2257b3e 100644 --- a/src/qml/qml/v8/qv4sqlerrors.cpp +++ b/src/qml/qml/v8/qv4sqlerrors.cpp @@ -51,7 +51,7 @@ void qt_add_sqlexceptions(QV4::ExecutionEngine *engine) sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Primitive::fromInt32(SQLEXCEPTION_SYNTAX_ERR)); sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), Primitive::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR)); sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), Primitive::fromInt32(SQLEXCEPTION_TIMEOUT_ERR)); - engine->globalObject->defineDefaultProperty(QStringLiteral("SQLException"), sqlexception); + engine->globalObject()->defineDefaultProperty(QStringLiteral("SQLException"), sqlexception); } QT_END_NAMESPACE diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index e08f2c494f..80ef41acca 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -482,7 +482,7 @@ QQmlContextData *QV8Engine::callingContext() void QV8Engine::initializeGlobal() { QV4::Scope scope(m_v4Engine); - QV4::GlobalExtensions::init(m_engine, m_v4Engine->globalObject); + QV4::GlobalExtensions::init(m_engine, m_v4Engine->globalObject()); QQmlLocale::registerStringLocaleCompare(m_v4Engine); QQmlDateExtension::registerExtension(m_v4Engine); @@ -494,9 +494,9 @@ void QV8Engine::initializeGlobal() qt_add_sqlexceptions(m_v4Engine); { - for (uint i = 0; i < m_v4Engine->globalObject->internalClass()->size; ++i) { - if (m_v4Engine->globalObject->internalClass()->nameMap.at(i)) - m_illegalNames.insert(m_v4Engine->globalObject->internalClass()->nameMap.at(i)->string); + for (uint i = 0; i < m_v4Engine->globalObject()->internalClass()->size; ++i) { + if (m_v4Engine->globalObject()->internalClass()->nameMap.at(i)) + m_illegalNames.insert(m_v4Engine->globalObject()->internalClass()->nameMap.at(i)->string); } } @@ -532,7 +532,7 @@ void QV8Engine::freezeObject(const QV4::ValueRef value) QV4::ScopedFunctionObject f(scope, m_freezeObject.value()); QV4::ScopedCallData callData(scope, 1); callData->args[0] = value; - callData->thisObject = m_v4Engine->globalObject; + callData->thisObject = m_v4Engine->globalObject(); f->call(callData); } @@ -570,7 +570,7 @@ void QV8Engine::initQmlGlobalObject() { initializeGlobal(); QV4::Scope scope(m_v4Engine); - QV4::ScopedValue v(scope, m_v4Engine->globalObject); + QV4::ScopedValue v(scope, m_v4Engine->globalObject()); freezeObject(v); } @@ -582,7 +582,7 @@ void QV8Engine::setEngine(QQmlEngine *engine) QV4::ReturnedValue QV8Engine::global() { - return m_v4Engine->globalObject->asReturnedValue(); + return m_v4Engine->globalObject()->asReturnedValue(); } // Converts a QVariantList to JS. |