aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qmlcontext.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-28 16:04:01 +0100
committerLars Knoll <lars.knoll@qt.io>2016-12-04 08:31:56 +0000
commitf2a9579375bf5ae6f70747b9209082e504a16397 (patch)
tree6af379caf869ae28619ee437fe257f5cd314d3c7 /src/qml/jsruntime/qv4qmlcontext.cpp
parent8a6383775a301c8dd8c917a936655c534932a726 (diff)
Inline the qmlScope and urlScope methods
They are only a couple of lines and used only in one place. Change-Id: Iee9139e78d5d7fd385cae39d6dd5fad7e5d461b5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qmlcontext.cpp')
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index a4ace4c3eb..889f4ea288 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -81,29 +81,6 @@ void Heap::QmlContextWrapper::destroy()
Object::destroy();
}
-ReturnedValue QmlContextWrapper::qmlScope(ExecutionEngine *v4, QQmlContextData *ctxt, QObject *scope)
-{
- Scope valueScope(v4);
-
- Scoped<QmlContextWrapper> w(valueScope, v4->memoryManager->allocObject<QmlContextWrapper>(ctxt, scope));
- return w.asReturnedValue();
-}
-
-ReturnedValue QmlContextWrapper::urlScope(ExecutionEngine *v4, const QUrl &url)
-{
- Scope scope(v4);
-
- QQmlContextData *context = new QQmlContextData;
- context->baseUrl = url;
- context->baseUrlString = url.toString();
- context->isInternal = true;
- context->isJSContext = true;
-
- Scoped<QmlContextWrapper> w(scope, v4->memoryManager->allocObject<QmlContextWrapper>(context, (QObject*)0, true));
- w->d()->isNullWrapper = true;
- return w.asReturnedValue();
-}
-
ReturnedValue QmlContextWrapper::get(const Managed *m, String *name, bool *hasProperty)
{
Q_ASSERT(m->as<QmlContextWrapper>());
@@ -338,8 +315,14 @@ Heap::QmlContext *QmlContext::createWorkerContext(ExecutionContext *parent, cons
{
Scope scope(parent);
- QV4::Scoped<QV4::QmlContextWrapper> qml(scope, QV4::QmlContextWrapper::urlScope(scope.engine, source));
- Q_ASSERT(!!qml);
+ QQmlContextData *context = new QQmlContextData;
+ context->baseUrl = source;
+ context->baseUrlString = source.toString();
+ context->isInternal = true;
+ context->isJSContext = true;
+
+ Scoped<QmlContextWrapper> qml(scope, scope.engine->memoryManager->allocObject<QmlContextWrapper>(context, (QObject*)0, true));
+ qml->d()->isNullWrapper = true;
qml->setReadOnly(false);
QV4::ScopedObject api(scope, scope.engine->newObject());
@@ -354,7 +337,8 @@ Heap::QmlContext *QmlContext::createWorkerContext(ExecutionContext *parent, cons
Heap::QmlContext *QmlContext::create(ExecutionContext *parent, QQmlContextData *context, QObject *scopeObject)
{
Scope scope(parent);
- Scoped<QmlContextWrapper> qml(scope, QmlContextWrapper::qmlScope(scope.engine, context, scopeObject));
+
+ Scoped<QmlContextWrapper> qml(scope, scope.engine->memoryManager->allocObject<QmlContextWrapper>(context, scopeObject));
Heap::QmlContext *c = parent->d()->engine->memoryManager->alloc<QmlContext>(parent, qml);
return c;
}