diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-12 07:07:12 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-17 00:20:46 (GMT) |
commit | a88c755e511d3aea726bd0e096621054af18ce01 (patch) | |
tree | e53919480f21ed2d5efdcc09792ddd81cf84e6ba /src/declarative/qml/qdeclarativecompileddata.cpp | |
parent | dc829ac31694f382bf7b8a0702f73409762e36f0 (diff) | |
download | Qt-a88c755e511d3aea726bd0e096621054af18ce01.zip Qt-a88c755e511d3aea726bd0e096621054af18ce01.tar.gz Qt-a88c755e511d3aea726bd0e096621054af18ce01.tar.bz2 |
Optimization: Combine QDeclarativeDeclarativeData and QObject allocations
Diffstat (limited to 'src/declarative/qml/qdeclarativecompileddata.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativecompileddata.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp index bdf16a3..30f9510 100644 --- a/src/declarative/qml/qdeclarativecompileddata.cpp +++ b/src/declarative/qml/qdeclarativecompileddata.cpp @@ -203,9 +203,15 @@ void QDeclarativeCompiledData::clear() QObject *QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContext *ctxt, const QBitField &bindings) const { if (type) { - QObject *rv = type->create(); - if (rv) - QDeclarativeEngine::setContextForObject(rv, ctxt); + QObject *rv = 0; + void *memory = 0; + + type->create(&rv, &memory, sizeof(QDeclarativeDeclarativeData)); + QDeclarativeDeclarativeData *ddata = new (memory) QDeclarativeDeclarativeData; + ddata->ownMemory = false; + QObjectPrivate::get(rv)->declarativeData = ddata; + QDeclarativeEngine::setContextForObject(rv, ctxt); + return rv; } else { Q_ASSERT(component); |