diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-07 02:06:42 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-10 17:15:22 +0100 |
commit | fcf0203aafe6db09751835ce54fc32f51fc77d5a (patch) | |
tree | f5354c56af10c320b40fff9da4bba500ea8a1653 /src/qml/qml | |
parent | 4838cc89f000a2f1db4da6401fc79a75a7b86ad7 (diff) |
Move data of more Qml related objects into Heap namespace.
Change-Id: Ifb3a7093351474d6feb2f64498b531c36fdf669b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmllistwrapper.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmllistwrapper_p.h | 23 | ||||
-rw-r--r-- | src/qml/qml/qqmllocale.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmllocale_p.h | 29 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 14 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper_p.h | 42 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 2 |
7 files changed, 74 insertions, 44 deletions
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index cde406d8e0..0076933783 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -45,18 +45,18 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(QmlListWrapper); -QmlListWrapper::Data::Data(QV8Engine *engine) +Heap::QmlListWrapper::QmlListWrapper(QV8Engine *engine) : Heap::Object(QV8Engine::getV4(engine)) , v8(engine) { - setVTable(staticVTable()); + setVTable(QV4::QmlListWrapper::staticVTable()); QV4::Scope scope(QV8Engine::getV4(engine)); QV4::ScopedObject o(scope, this); o->setArrayType(Heap::ArrayData::Custom); } -QmlListWrapper::Data::~Data() +Heap::QmlListWrapper::~QmlListWrapper() { } diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h index f10ca21b08..e73f03f99b 100644 --- a/src/qml/qml/qqmllistwrapper_p.h +++ b/src/qml/qml/qqmllistwrapper_p.h @@ -59,17 +59,22 @@ class QV8Engine; namespace QV4 { +namespace Heap { + +struct QmlListWrapper : Object { + QmlListWrapper(QV8Engine *engine); + ~QmlListWrapper(); + QV8Engine *v8; + QPointer<QObject> object; + QQmlListProperty<QObject> property; + int propertyType; +}; + +} + struct Q_QML_EXPORT QmlListWrapper : Object { - struct Data : Heap::Object { - Data(QV8Engine *engine); - ~Data(); - QV8Engine *v8; - QPointer<QObject> object; - QQmlListProperty<QObject> property; - int propertyType; - }; - V4_OBJECT(Object) + V4_OBJECT2(QmlListWrapper, Object) static ReturnedValue create(QV8Engine *v8, QObject *object, int propId, int propType); static ReturnedValue create(QV8Engine *v8, const QQmlListProperty<QObject> &prop, int propType); diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 6df0bd0e1d..59671d6f6d 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -46,6 +46,8 @@ QT_BEGIN_NAMESPACE +using namespace QV4; + DEFINE_OBJECT_VTABLE(QQmlLocaleData); #define GET_LOCALE_DATA_RESOURCE(OBJECT) \ diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h index 96c0712378..34224b44ff 100644 --- a/src/qml/qml/qqmllocale_p.h +++ b/src/qml/qml/qqmllocale_p.h @@ -121,17 +121,20 @@ private: static QV4::ReturnedValue method_localeCompare(QV4::CallContext *ctx); }; +namespace QV4 { + +namespace Heap { + +struct QQmlLocaleData : Object { + inline QQmlLocaleData(ExecutionEngine *engine); + QLocale locale; +}; + +} + struct QQmlLocaleData : public QV4::Object { - struct Data : QV4::Heap::Object { - Data(QV4::ExecutionEngine *engine) - : QV4::Heap::Object(engine) - { - setVTable(staticVTable()); - } - QLocale locale; - }; - V4_OBJECT(Object) + V4_OBJECT2(QQmlLocaleData, Object) static QLocale *getThisLocale(QV4::CallContext *ctx) { QV4::Object *o = ctx->d()->callData->thisObject.asObject(); @@ -178,6 +181,14 @@ private: } }; +Heap::QQmlLocaleData::QQmlLocaleData(ExecutionEngine *engine) + : Heap::Object(engine) +{ + setVTable(QV4::QQmlLocaleData::staticVTable()); +} + +} + QT_END_NAMESPACE #endif diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 1022d8f2f8..b8a9452d02 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -48,15 +48,15 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(QmlTypeWrapper); -QmlTypeWrapper::Data::Data(QV8Engine *engine) +Heap::QmlTypeWrapper::QmlTypeWrapper(QV8Engine *engine) : Heap::Object(QV8Engine::getV4(engine)) , v8(engine) , mode(IncludeEnums) { - setVTable(staticVTable()); + setVTable(QV4::QmlTypeWrapper::staticVTable()); } -QmlTypeWrapper::Data::~Data() +Heap::QmlTypeWrapper::~QmlTypeWrapper() { if (typeNamespace) typeNamespace->release(); @@ -96,7 +96,8 @@ QVariant QmlTypeWrapper::toVariant() const // Returns a type wrapper for type t on o. This allows access of enums, and attached properties. -ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlType *t, TypeNameMode mode) +ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlType *t, + Heap::QmlTypeWrapper::TypeNameMode mode) { Q_ASSERT(t); ExecutionEngine *v4 = QV8Engine::getV4(v8); @@ -109,7 +110,8 @@ ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlType *t, Typ // Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a // namespace. -ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCache *t, const void *importNamespace, TypeNameMode mode) +ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCache *t, const void *importNamespace, + Heap::QmlTypeWrapper::TypeNameMode mode) { Q_ASSERT(t); Q_ASSERT(importNamespace); @@ -153,7 +155,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty) if (qobjectSingleton) { // check for enum value if (name->startsWithUpper()) { - if (w->d()->mode == IncludeEnums) { + if (w->d()->mode == Heap::QmlTypeWrapper::IncludeEnums) { // ### Optimize QByteArray enumName = name->toQString().toUtf8(); const QMetaObject *metaObject = qobjectSingleton->metaObject(); diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index 5ba92cd89c..a0a119630d 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -58,22 +58,30 @@ class QQmlTypeNameCache; namespace QV4 { +namespace Heap { + +struct QmlTypeWrapper : Object { + enum TypeNameMode { + IncludeEnums, + ExcludeEnums + }; + + QmlTypeWrapper(QV8Engine *engine); + ~QmlTypeWrapper(); + QV8Engine *v8; + TypeNameMode mode; + QPointer<QObject> object; + + QQmlType *type; + QQmlTypeNameCache *typeNamespace; + const void *importNamespace; +}; + +} + struct Q_QML_EXPORT QmlTypeWrapper : Object { - enum TypeNameMode { IncludeEnums, ExcludeEnums }; - - struct Data : Heap::Object { - Data(QV8Engine *engine); - ~Data(); - QV8Engine *v8; - TypeNameMode mode; - QPointer<QObject> object; - - QQmlType *type; - QQmlTypeNameCache *typeNamespace; - const void *importNamespace; - }; - V4_OBJECT(Object) + V4_OBJECT2(QmlTypeWrapper, Object) private: public: @@ -83,8 +91,10 @@ public: QVariant toVariant() const; - static ReturnedValue create(QV8Engine *, QObject *, QQmlType *, TypeNameMode = IncludeEnums); - static ReturnedValue create(QV8Engine *, QObject *, QQmlTypeNameCache *, const void *, TypeNameMode = IncludeEnums); + static ReturnedValue create(QV8Engine *, QObject *, QQmlType *, + Heap::QmlTypeWrapper::TypeNameMode = Heap::QmlTypeWrapper::IncludeEnums); + static ReturnedValue create(QV8Engine *, QObject *, QQmlTypeNameCache *, const void *, + Heap::QmlTypeWrapper::TypeNameMode = Heap::QmlTypeWrapper::IncludeEnums); static ReturnedValue get(Managed *m, String *name, bool *hasProperty); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index d472120b4e..e3ff358f3a 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -233,7 +233,7 @@ QVariant QV8Engine::toVariant(const QV4::ValueRef value, int typeHint, bool crea return value->asDouble(); if (value->isString()) return value->stringValue()->toQString(); - if (QQmlLocaleData *ld = value->as<QQmlLocaleData>()) + if (QV4::QQmlLocaleData *ld = value->as<QV4::QQmlLocaleData>()) return ld->d()->locale; if (QV4::DateObject *d = value->asDateObject()) return d->toQDateTime(); |