diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-12-09 12:04:52 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-12-10 12:22:30 +0100 |
commit | c0b59369ab45a78e4407633365a52c1a9255512c (patch) | |
tree | f3c94857667de0d58f83d5827789bc35f7756a3e /src/qml/qml/qqmltypeloader.cpp | |
parent | c1c4a874e31ba108a3600fbbb0aee7fc0bf34601 (diff) |
Respect QML_DISABLE_DISK_CACHE also for caches built into the binary
Previously it would only disable loading of separate cache files.
Change-Id: Iae92fc03d2e5566ef7dc44a6730b788b7512fd3d
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 1b14467266..6c5e7eccb9 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -68,8 +68,6 @@ #define ASSERT_LOADTHREAD() #endif -DEFINE_BOOL_CONFIG_OPTION(disableDiskCache, QML_DISABLE_DISK_CACHE); -DEFINE_BOOL_CONFIG_OPTION(forceDiskCache, QML_FORCE_DISK_CACHE); QT_BEGIN_NAMESPACE @@ -772,7 +770,7 @@ bool QQmlTypeLoader::Blob::isDebugging() const bool QQmlTypeLoader::Blob::diskCacheEnabled() const { - return (!disableDiskCache() && !isDebugging()) || forceDiskCache(); + return typeLoader()->engine()->handle()->diskCacheEnabled(); } bool QQmlTypeLoader::Blob::qmldirDataAvailable(const QQmlRefPointer<QQmlQmldirData> &data, QList<QQmlError> *errors) @@ -863,7 +861,10 @@ QQmlRefPointer<QQmlTypeData> QQmlTypeLoader::getType(const QUrl &unNormalizedUrl // TODO: if (compiledData == 0), is it safe to omit this insertion? m_typeCache.insert(url, typeData); QQmlMetaType::CachedUnitLookupError error = QQmlMetaType::CachedUnitLookupError::NoError; - if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(typeData->url(), &error)) { + + if (const QQmlPrivate::CachedQmlUnit *cachedUnit = typeData->diskCacheEnabled() + ? QQmlMetaType::findCachedCompilationUnit(typeData->url(), &error) + : nullptr) { QQmlTypeLoader::loadWithCachedUnit(typeData, cachedUnit, mode); } else { typeData->setCachedUnitStatus(error); @@ -922,7 +923,9 @@ QQmlRefPointer<QQmlScriptBlob> QQmlTypeLoader::getScript(const QUrl &unNormalize m_scriptCache.insert(url, scriptBlob); QQmlMetaType::CachedUnitLookupError error; - if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(scriptBlob->url(), &error)) { + if (const QQmlPrivate::CachedQmlUnit *cachedUnit = scriptBlob->diskCacheEnabled() + ? QQmlMetaType::findCachedCompilationUnit(scriptBlob->url(), &error) + : nullptr) { QQmlTypeLoader::loadWithCachedUnit(scriptBlob, cachedUnit); } else { scriptBlob->setCachedUnitStatus(error); |