diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-06-13 14:30:03 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:19 +0200 |
commit | b393c405b7568e80628bc99501a9c53bbd0e678d (patch) | |
tree | 51280658b1ec97947a66c6afc503b23ae48f0d8d /src/qml/types | |
parent | 00a46fa07bf87c6ffa0d60b4a98b51685fdc1ef5 (diff) |
Change the object allocation scheme
Instead of allocating the data directly, centralize the object and its ::Data
allocation in one place in the memory manager. This is in preparation for
additional pointer indirection later.
Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index c86da03276..7fd880681f 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -80,9 +80,9 @@ struct DelegateModelGroupFunction: QV4::FunctionObject V4_OBJECT - static Data *create(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg)) + static DelegateModelGroupFunction *create(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg)) { - return new (scope->engine()) Data(scope, flag, code); + return scope->engine()->memoryManager->alloc<DelegateModelGroupFunction>(scope, flag, code); } static QV4::ReturnedValue construct(QV4::Managed *m, QV4::CallData *) @@ -2472,7 +2472,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index) QV8Engine *v8 = model->m_cacheMetaType->v8Engine; QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8); QV4::Scope scope(v4); - QV4::ScopedObject o(scope, new (v4) QQmlDelegateModelItemObject::Data(v4, cacheItem)); + QV4::ScopedObject o(scope, v4->memoryManager->alloc<QQmlDelegateModelItemObject>(v4, cacheItem)); QV4::ScopedObject p(scope, model->m_cacheMetaType->modelItemProto.value()); o->setPrototype(p.getPointer()); ++cacheItem->scriptRef; @@ -3228,8 +3228,8 @@ struct QQmlDelegateModelGroupChange : QV4::Object V4_OBJECT - static Data *create(QV4::ExecutionEngine *e) { - return new (e) Data(e); + static QQmlDelegateModelGroupChange *create(QV4::ExecutionEngine *e) { + return e->memoryManager->alloc<QQmlDelegateModelGroupChange>(e); } static QV4::ReturnedValue method_get_index(QV4::CallContext *ctx) { @@ -3278,9 +3278,9 @@ struct QQmlDelegateModelGroupChangeArray : public QV4::Object } __data; V4_OBJECT public: - static Data *create(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes) + static QQmlDelegateModelGroupChangeArray *create(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes) { - return new (engine) Data(engine, changes); + return engine->memoryManager->alloc<QQmlDelegateModelGroupChangeArray>(engine, changes); } quint32 count() const { return d()->changes.count(); } |