aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-11-10 21:27:52 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-12 12:13:47 +0100
commit345a5ee67bf80f7c18869fe080bf7dd7cf4a0d90 (patch)
tree3d4a64aca5d5215a4e3574e3c92f875fe52f90dd /src/qml/qml
parent60f3c23f524eaed795dd4ce58722cdf923ba6a51 (diff)
Use heap objects in the remaining managed objects
Change-Id: Id6dc6e34113a287a40e0122dfbdf977f0fc1f3b3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp8
-rw-r--r--src/qml/qml/qqmlcontextwrapper_p.h2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp39
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp7
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h2
5 files changed, 31 insertions, 27 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 115d65ab67..a7b5d58583 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -434,15 +434,17 @@ DEFINE_OBJECT_VTABLE(QQmlIdObjectsArray);
Heap::QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QV4::QmlContextWrapper *contextWrapper)
: Heap::Object(engine)
- , contextWrapper(contextWrapper)
+ , contextWrapper(contextWrapper->d())
{
setVTable(QV4::QQmlIdObjectsArray::staticVTable());
}
ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasProperty)
{
- QQmlIdObjectsArray *This = static_cast<QV4::QQmlIdObjectsArray*>(m);
- QQmlContextData *context = This->d()->contextWrapper->getContext();
+ Scope scope(m->engine());
+ Scoped<QQmlIdObjectsArray> This(scope, static_cast<QV4::QQmlIdObjectsArray*>(m));
+ Scoped<QmlContextWrapper> contextWrapper(scope, This->d()->contextWrapper);
+ QQmlContextData *context = contextWrapper->getContext();
if (!context) {
if (hasProperty)
*hasProperty = false;
diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h
index a8234e9cb7..317cf4ced2 100644
--- a/src/qml/qml/qqmlcontextwrapper_p.h
+++ b/src/qml/qml/qqmlcontextwrapper_p.h
@@ -80,7 +80,7 @@ struct QmlContextWrapper : Object {
struct QQmlIdObjectsArray : Object {
QQmlIdObjectsArray(QV4::ExecutionEngine *engine, QV4::QmlContextWrapper *contextWrapper);
- QV4::QmlContextWrapper *contextWrapper;
+ QmlContextWrapper *contextWrapper;
};
}
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 74f4af1d07..1566971827 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1623,7 +1623,7 @@ struct QQmlXMLHttpRequestWrapper : Object {
struct QQmlXMLHttpRequestCtor : FunctionObject {
QQmlXMLHttpRequestCtor(ExecutionEngine *engine);
- QV4::Object *proto;
+ Object *proto;
};
}
@@ -1663,7 +1663,8 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
QV8Engine *engine = that->engine()->v8Engine;
QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(engine, engine->networkAccessManager());
Scoped<QQmlXMLHttpRequestWrapper> w(scope, that->engine()->memoryManager->alloc<QQmlXMLHttpRequestWrapper>(that->engine(), r));
- w->setPrototype(ctor->d()->proto);
+ Scoped<Object> proto(scope, ctor->d()->proto);
+ w->setPrototype(proto);
return w.asReturnedValue();
}
@@ -1716,29 +1717,29 @@ void QQmlXMLHttpRequestCtor::setupProto()
ExecutionEngine *v4 = engine();
Scope scope(v4);
Scoped<Object> p(scope, v4->newObject());
- d()->proto = p.getPointer();
+ d()->proto = p.getPointer()->d();
// Methods
- d()->proto->defineDefaultProperty(QStringLiteral("open"), method_open);
- d()->proto->defineDefaultProperty(QStringLiteral("setRequestHeader"), method_setRequestHeader);
- d()->proto->defineDefaultProperty(QStringLiteral("send"), method_send);
- d()->proto->defineDefaultProperty(QStringLiteral("abort"), method_abort);
- d()->proto->defineDefaultProperty(QStringLiteral("getResponseHeader"), method_getResponseHeader);
- d()->proto->defineDefaultProperty(QStringLiteral("getAllResponseHeaders"), method_getAllResponseHeaders);
+ p->defineDefaultProperty(QStringLiteral("open"), method_open);
+ p->defineDefaultProperty(QStringLiteral("setRequestHeader"), method_setRequestHeader);
+ p->defineDefaultProperty(QStringLiteral("send"), method_send);
+ p->defineDefaultProperty(QStringLiteral("abort"), method_abort);
+ p->defineDefaultProperty(QStringLiteral("getResponseHeader"), method_getResponseHeader);
+ p->defineDefaultProperty(QStringLiteral("getAllResponseHeaders"), method_getAllResponseHeaders);
// Read-only properties
- d()->proto->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("status"),method_get_status, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0);
+ p->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, 0);
+ p->defineAccessorProperty(QStringLiteral("status"),method_get_status, 0);
+ p->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, 0);
+ p->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, 0);
+ p->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0);
// State values
- d()->proto->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0));
- d()->proto->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1));
- d()->proto->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2));
- d()->proto->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3));
- d()->proto->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4));
+ p->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0));
+ p->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1));
+ p->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2));
+ p->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3));
+ p->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4));
}
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index c4bf9e44a2..cdc76e5c97 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1168,7 +1168,7 @@ ReturnedValue QtObject::method_locale(CallContext *ctx)
Heap::QQmlBindingFunction::QQmlBindingFunction(QV4::FunctionObject *originalFunction)
: QV4::Heap::FunctionObject(originalFunction->scope(), originalFunction->name())
- , originalFunction(originalFunction)
+ , originalFunction(originalFunction->d())
{
setVTable(QV4::QQmlBindingFunction::staticVTable());
bindingKeyFlag = true;
@@ -1183,8 +1183,9 @@ void QQmlBindingFunction::initBindingLocation()
ReturnedValue QQmlBindingFunction::call(Managed *that, CallData *callData)
{
- QQmlBindingFunction *This = static_cast<QQmlBindingFunction*>(that);
- return This->d()->originalFunction->call(callData);
+ Scope scope(that->engine());
+ Scoped<FunctionObject> function(scope, static_cast<QQmlBindingFunction*>(that)->d()->originalFunction);
+ return function->call(callData);
}
void QQmlBindingFunction::markObjects(Heap::Base *that, ExecutionEngine *e)
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index 8379cbc3a0..4a50111e60 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -69,7 +69,7 @@ struct ConsoleObject : Object {
struct QQmlBindingFunction : FunctionObject {
QQmlBindingFunction(QV4::FunctionObject *originalFunction);
- QV4::FunctionObject *originalFunction;
+ FunctionObject *originalFunction;
// Set when the binding is created later
QQmlSourceLocation bindingLocation;
};