summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativecompileddata.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-12 07:07:12 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-17 00:20:46 (GMT)
commita88c755e511d3aea726bd0e096621054af18ce01 (patch)
treee53919480f21ed2d5efdcc09792ddd81cf84e6ba /src/declarative/qml/qdeclarativecompileddata.cpp
parentdc829ac31694f382bf7b8a0702f73409762e36f0 (diff)
downloadQt-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.cpp12
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);