aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-06-06 11:46:01 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-06-17 09:06:01 +0000
commit8a33d37006e8ad9010fe076105ada9f1ca5d9871 (patch)
tree37e95149dce4f164c495157b9fb1b78ff756dab4 /src/qml/qml/qqmltypeloader.cpp
parent0dfd0a1c09e36bb80c575c097ea6a5809df5e640 (diff)
Added basic support for saving compilation units to disk
Hidden behind a QML_DISK_CACHE=1 environment variable we will now attempt to save a binary representation of the type compilation for Foo.qml next to it called Foo.qmlc. Change-Id: I27e800b50cdb186669256fd277578ea1f1e70513 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 01201e66e7..fef317cbbd 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -97,6 +97,7 @@
#endif
DEFINE_BOOL_CONFIG_OPTION(dumpErrors, QML_DUMP_ERRORS);
+DEFINE_BOOL_CONFIG_OPTION(diskCache, QML_DISK_CACHE);
QT_BEGIN_NAMESPACE
@@ -2315,6 +2316,12 @@ void QQmlTypeData::compile()
setError(compiler.compilationErrors());
return;
}
+ if (diskCache()) {
+ QString errorString;
+ if (!m_compiledData->saveToDisk(&errorString)) {
+ qDebug() << "Error saving cached version of" << m_compiledData->url().toString() << "to disk:" << errorString;
+ }
+ }
}
void QQmlTypeData::resolveTypes()