aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontextwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-15 11:36:57 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-23 08:07:32 +0100
commit002a5d4303b3b182ae4abc4a752c49787c1c2821 (patch)
tree69c7666ed1061c7acacee1d76597c06405459c80 /src/qml/qml/qqmlcontextwrapper.cpp
parentfddc75e862032163af36d2282051758647b62d15 (diff)
Get rid of most uses of ValueRef
Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 29f5152f77..946ea01565 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -99,23 +99,23 @@ QQmlContextData *QmlContextWrapper::callingContext(ExecutionEngine *v4)
return !!c ? c->getContext() : 0;
}
-QQmlContextData *QmlContextWrapper::getContext(const ValueRef value)
+QQmlContextData *QmlContextWrapper::getContext(const Value &value)
{
- if (!value->isObject())
+ if (!value.isObject())
return 0;
- QV4::ExecutionEngine *v4 = value->asObject()->engine();
+ QV4::ExecutionEngine *v4 = value.asObject()->engine();
Scope scope(v4);
QV4::Scoped<QmlContextWrapper> c(scope, value);
return c ? c->getContext() : 0;
}
-void QmlContextWrapper::takeContextOwnership(const ValueRef qmlglobal)
+void QmlContextWrapper::takeContextOwnership(const Value &qmlglobal)
{
- Q_ASSERT(qmlglobal->isObject());
+ Q_ASSERT(qmlglobal.isObject());
- QV4::ExecutionEngine *v4 = qmlglobal->asObject()->engine();
+ QV4::ExecutionEngine *v4 = qmlglobal.asObject()->engine();
Scope scope(v4);
QV4::Scoped<QmlContextWrapper> c(scope, qmlglobal);
Q_ASSERT(c);
@@ -182,7 +182,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
if (hasProperty)
*hasProperty = true;
if (r.scriptIndex != -1) {
- QV4::ScopedObject scripts(scope, context->importedScripts);
+ QV4::ScopedObject scripts(scope, context->importedScripts.valueRef());
return scripts->getIndexed(r.scriptIndex);
} else if (r.type) {
return QmlTypeWrapper::create(v4, scopeObject, r.type);
@@ -265,7 +265,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
return Primitive::undefinedValue().asReturnedValue();
}
-void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
+void QmlContextWrapper::put(Managed *m, String *name, const Value &value)
{
Q_ASSERT(m->as<QmlContextWrapper>());
QmlContextWrapper *resource = static_cast<QmlContextWrapper *>(m);