DEFINE_OBJECT_VTABLE(QmlContextWrapper);
-QmlContextWrapper::QmlContextWrapper(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext)
- : Object(QV8Engine::getV4(engine))
+QmlContextWrapper::Data::Data(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext)
+ : Object::Data(QV8Engine::getV4(engine))
+ , readOnly(true)
+ , ownsContext(ownsContext)
+ , isNullWrapper(false)
+ , context(context)
+ , scopeObject(scopeObject)
{
setVTable(staticVTable());
-
- d()->readOnly = true;
- d()->ownsContext = ownsContext;
- d()->isNullWrapper = false;
- d()->context = context;
- d()->scopeObject = scopeObject;
}
-QmlContextWrapper::~QmlContextWrapper()
+QmlContextWrapper::Data::~Data()
{
- if (d()->context && d()->ownsContext)
- d()->context->destroy();
+ if (context && ownsContext)
+ context->destroy();
}
ReturnedValue QmlContextWrapper::qmlScope(QV8Engine *v8, QQmlContextData *ctxt, QObject *scope)
ExecutionEngine *v4 = QV8Engine::getV4(v8);
Scope valueScope(v4);
- Scoped<QmlContextWrapper> w(valueScope, new (v4->memoryManager) QmlContextWrapper(v8, ctxt, scope));
+ Scoped<QmlContextWrapper> w(valueScope, new (v4) QmlContextWrapper::Data(v8, ctxt, scope));
return w.asReturnedValue();
}
context->isInternal = true;
context->isJSContext = true;
- Scoped<QmlContextWrapper> w(scope, new (v4->memoryManager) QmlContextWrapper(v8, context, 0, true));
+ Scoped<QmlContextWrapper> w(scope, new (v4) QmlContextWrapper::Data(v8, context, 0, true));
w->d()->isNullWrapper = true;
return w.asReturnedValue();
}
void QmlContextWrapper::destroy(Managed *that)
{
- static_cast<QmlContextWrapper *>(that)->~QmlContextWrapper();
+ static_cast<QmlContextWrapper *>(that)->d()->~Data();
}
void QmlContextWrapper::markObjects(Managed *m, ExecutionEngine *engine)
{
if (!d()->idObjectsWrapper) {
ExecutionEngine *v4 = engine();
- d()->idObjectsWrapper = new (v4->memoryManager) QQmlIdObjectsArray(v4, this);
+ Scope scope(v4);
+ Scoped<QQmlIdObjectsArray> a(scope, new (v4) QQmlIdObjectsArray::Data(v4, this));
+ d()->idObjectsWrapper = a.getPointer();
}
return d()->idObjectsWrapper->asReturnedValue();
}
DEFINE_OBJECT_VTABLE(QQmlIdObjectsArray);
-QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper)
- : Object(engine)
+QQmlIdObjectsArray::Data::Data(ExecutionEngine *engine, QmlContextWrapper *contextWrapper)
+ : Object::Data(engine)
+ , contextWrapper(contextWrapper)
{
setVTable(staticVTable());
-
- d()->contextWrapper = contextWrapper;
}
ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasProperty)
struct Q_QML_EXPORT QmlContextWrapper : Object
{
struct Data : Object::Data {
+ Data(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false);
+ ~Data();
bool readOnly;
bool ownsContext;
bool isNullWrapper;
} __data;
V4_OBJECT
- QmlContextWrapper(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false);
- ~QmlContextWrapper();
static ReturnedValue qmlScope(QV8Engine *e, QQmlContextData *ctxt, QObject *scope);
static ReturnedValue urlScope(QV8Engine *e, const QUrl &);
struct QQmlIdObjectsArray : public Object
{
struct Data : Object::Data {
+ Data(ExecutionEngine *engine, QmlContextWrapper *contextWrapper);
QmlContextWrapper *contextWrapper;
};
struct {
} __data;
V4_OBJECT
- QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
static void markObjects(Managed *that, ExecutionEngine *engine);
DEFINE_OBJECT_VTABLE(QmlListWrapper);
-QmlListWrapper::QmlListWrapper(QV8Engine *engine)
- : Object(QV8Engine::getV4(engine))
+QmlListWrapper::Data::Data(QV8Engine *engine)
+ : Object::Data(QV8Engine::getV4(engine))
+ , v8(engine)
{
setVTable(staticVTable());
- d()->v8 = engine;
QV4::Scope scope(QV8Engine::getV4(engine));
- QV4::ScopedObject protectThis(scope, this);
- Q_UNUSED(protectThis);
- setArrayType(ArrayData::Custom);
+ QV4::ScopedObject o(scope, this);
+ o->setArrayType(ArrayData::Custom);
}
-QmlListWrapper::~QmlListWrapper()
+QmlListWrapper::Data::~Data()
{
}
ExecutionEngine *v4 = QV8Engine::getV4(v8);
Scope scope(v4);
- Scoped<QmlListWrapper> r(scope, new (v4->memoryManager) QmlListWrapper(v8));
+ Scoped<QmlListWrapper> r(scope, new (v4) QmlListWrapper::Data(v8));
r->d()->object = object;
r->d()->propertyType = propType;
void *args[] = { &r->d()->property, 0 };
ExecutionEngine *v4 = QV8Engine::getV4(v8);
Scope scope(v4);
- Scoped<QmlListWrapper> r(scope, new (v4->memoryManager) QmlListWrapper(v8));
+ Scoped<QmlListWrapper> r(scope, new (v4) QmlListWrapper::Data(v8));
r->d()->object = prop.object;
r->d()->property = prop;
r->d()->propertyType = propType;
void QmlListWrapper::destroy(Managed *that)
{
QmlListWrapper *w = that->as<QmlListWrapper>();
- w->~QmlListWrapper();
+ w->d()->~Data();
}
void QmlListWrapper::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attrs)