aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v8/qv8contextwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-05-08 07:30:20 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-05-08 11:24:03 +0200
commite3655ab7a7c121c05a53bc9c5861297e9159128f (patch)
tree75337c222620195139dd32f468e837b39370300f /src/qml/qml/v8/qv8contextwrapper.cpp
parent873225297e8046e5e33eec0aecda053af9aac6ba (diff)
Convert context wrapper to QV4::PersistentValue
Change-Id: Ied2ac64aacf92ebaa606e478f51505d97953e6c0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/v8/qv8contextwrapper.cpp')
-rw-r--r--src/qml/qml/v8/qv8contextwrapper.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/qml/qml/v8/qv8contextwrapper.cpp b/src/qml/qml/v8/qv8contextwrapper.cpp
index cc0e010b44..4bb89b86f8 100644
--- a/src/qml/qml/v8/qv8contextwrapper.cpp
+++ b/src/qml/qml/v8/qv8contextwrapper.cpp
@@ -47,6 +47,7 @@
#include <private/qv4engine_p.h>
#include <private/qv4value_p.h>
+#include <private/qv4functionobject_p.h>
QT_BEGIN_NAMESPACE
@@ -143,9 +144,6 @@ QV8ContextWrapper::~QV8ContextWrapper()
void QV8ContextWrapper::destroy()
{
- qPersistentDispose(m_sharedContext);
- qPersistentDispose(m_urlConstructor);
- qPersistentDispose(m_constructor);
}
void QV8ContextWrapper::init(QV8Engine *engine)
@@ -155,27 +153,27 @@ void QV8ContextWrapper::init(QV8Engine *engine)
v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New();
ft->InstanceTemplate()->SetHasExternalResource(true);
ft->InstanceTemplate()->SetFallbackPropertyHandler(Getter, Setter);
- m_constructor = qPersistentNew<v8::Function>(ft->GetFunction());
+ m_constructor = ft->GetFunction()->v4Value();
}
{
v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New();
ft->InstanceTemplate()->SetHasExternalResource(true);
ft->InstanceTemplate()->SetFallbackPropertyHandler(NullGetter, NullSetter);
- m_urlConstructor = qPersistentNew<v8::Function>(ft->GetFunction());
+ m_urlConstructor = ft->GetFunction()->v4Value();
}
{
- v8::Handle<v8::Object> sharedContext = m_constructor->NewInstance();
+ v8::Handle<v8::Object> sharedContext = m_constructor.value().asFunctionObject()->newInstance();
QV8ContextResource *r = new QV8ContextResource(engine, 0, 0);
r->isSharedContext = true;
sharedContext->SetExternalResource(r);
- m_sharedContext = qPersistentNew<v8::Object>(sharedContext);
+ m_sharedContext = sharedContext->v4Value();
}
}
v8::Handle<v8::Object> QV8ContextWrapper::qmlScope(QQmlContextData *ctxt, QObject *scope)
{
// XXX NewInstance() should be optimized
- v8::Handle<v8::Object> rv = m_constructor->NewInstance();
+ v8::Handle<v8::Object> rv = m_constructor.value().asFunctionObject()->newInstance();
QV8ContextResource *r = new QV8ContextResource(m_engine, ctxt, scope);
rv->SetExternalResource(r);
return rv;
@@ -189,7 +187,7 @@ v8::Handle<v8::Object> QV8ContextWrapper::urlScope(const QUrl &url)
context->isJSContext = true;
// XXX NewInstance() should be optimized
- v8::Handle<v8::Object> rv = m_urlConstructor->NewInstance();
+ v8::Handle<v8::Object> rv = m_urlConstructor.value().asFunctionObject()->newInstance();
QV8ContextResource *r = new QV8ContextResource(m_engine, context, 0, true);
rv->SetExternalResource(r);
return rv;