aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-10 15:17:36 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-16 17:14:20 +0000
commit61f218b4e772c1d97e32ef8031de0043473ebbef (patch)
tree3e3cb0fb11c338bef3595de027a31eb95a73f545 /src/qml/qml/qqmlobjectcreator.cpp
parent496ddbfd1fe27bdddf5c15cd0ea70df452a3ec04 (diff)
Speed up object creation
Avoid copying url and file name twice into the context every time we instantiate an object. Change-Id: I1c76b80b9c44f95512af5899d760151f6dcd7bb5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 6b815677a3..e7a08773f4 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -175,8 +175,6 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
context = new QQmlContextData;
context->isInternal = true;
- context->url = compiledData->url();
- context->urlString = compiledData->fileName();
context->imports = compiledData->importCache;
context->imports->addref();
context->typeCompilationUnit = compiledData->compilationUnit;
@@ -1050,7 +1048,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
isComponent = true;
QQmlComponent *component = new QQmlComponent(engine, compiledData, index, parent);
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(QStringLiteral("<component>"),
- context->url, obj->location.line, obj->location.column));
+ context->url(), obj->location.line, obj->location.column));
QQmlComponentPrivate::get(component)->creationContext = context;
instance = component;
ddata = QQmlData::get(instance, /*create*/true);
@@ -1061,7 +1059,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
QQmlType *type = typeRef->type;
if (type) {
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(type->qmlTypeName(),
- context->url, obj->location.line, obj->location.column));
+ context->url(), obj->location.line, obj->location.column));
instance = type->create();
if (!instance) {
recordError(obj->location, tr("Unable to create object of type %1").arg(stringAt(obj->inheritedTypeNameIndex)));
@@ -1084,7 +1082,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
} else {
Q_ASSERT(typeRef->component);
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(typeRef->component->fileName(),
- context->url, obj->location.line, obj->location.column));
+ context->url(), obj->location.line, obj->location.column));
if (typeRef->component->compilationUnit->data->isSingleton())
{
recordError(obj->location, tr("Composite Singleton Type %1 is not creatable").arg(stringAt(obj->inheritedTypeNameIndex)));