aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-08-03 15:46:38 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-08-05 07:15:19 +0000
commitfe663bf863ffd6085c3022db7e9a923688befeb6 (patch)
tree02f11fc41a914b275fea72601fe5348a1e5493fe /src/qml/qml/qqmltypeloader.cpp
parent234e762265f0b538e65d610751b8488cb596824d (diff)
Disable disk caching when debugging JavaScript
The debugging changes the code generation and is currently not suitable for caching. Change-Id: I40db58a5f24457cf3383d08a1de3a4168874056f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index a6cac8d8b5..38715f6cd3 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1515,6 +1515,11 @@ void QQmlTypeLoader::Blob::dependencyComplete(QQmlDataBlob *blob)
}
}
+bool QQmlTypeLoader::Blob::isDebugging() const
+{
+ return QV8Engine::getV4(typeLoader()->engine())->debugger() != 0;
+}
+
bool QQmlTypeLoader::Blob::qmldirDataAvailable(QQmlQmldirData *data, QList<QQmlError> *errors)
{
bool resolve = true;
@@ -2071,6 +2076,9 @@ bool QQmlTypeData::tryLoadFromDiskCache()
if (forceDiskCacheRefresh())
return false;
+ if (isDebugging())
+ return false;
+
QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(typeLoader()->engine());
if (!v4)
return false;
@@ -2376,8 +2384,7 @@ void QQmlTypeData::dataReceived(const Data &data)
void QQmlTypeData::initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit)
{
- QQmlEngine *qmlEngine = typeLoader()->engine();
- m_document.reset(new QmlIR::Document(QV8Engine::getV4(qmlEngine)->debugger() != 0));
+ m_document.reset(new QmlIR::Document(isDebugging()));
unit->loadIR(m_document.data(), unit);
continueLoadFromIR();
}
@@ -2385,9 +2392,9 @@ void QQmlTypeData::initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *un
bool QQmlTypeData::loadFromSource()
{
QString code = QString::fromUtf8(m_backupSourceCode);
- QQmlEngine *qmlEngine = typeLoader()->engine();
- m_document.reset(new QmlIR::Document(QV8Engine::getV4(qmlEngine)->debugger() != 0));
+ m_document.reset(new QmlIR::Document(isDebugging()));
m_document->jsModule.sourceTimeStamp = m_sourceTimeStamp;
+ QQmlEngine *qmlEngine = typeLoader()->engine();
QmlIR::IRBuilder compiler(QV8Engine::get(qmlEngine)->illegalNames());
if (!compiler.generateFromQml(code, finalUrlString(), m_document.data())) {
QList<QQmlError> errors;
@@ -2509,7 +2516,9 @@ void QQmlTypeData::compile(const QQmlRefPointer<QQmlTypeNameCache> &importCache,
setError(compiler.compilationErrors());
return;
}
- if (diskCache() || forceDiskCacheRefresh()) {
+
+ const bool trySaveToDisk = (diskCache() || forceDiskCacheRefresh()) && !m_document->jsModule.debugMode;
+ if (trySaveToDisk) {
QString errorString;
if (m_compiledData->saveToDisk(url(), &errorString)) {
QString error;
@@ -2914,7 +2923,7 @@ void QQmlScriptBlob::dataReceived(const Data &data)
}
- QmlIR::Document irUnit(v4->debugger() != 0);
+ QmlIR::Document irUnit(isDebugging());
QString error;
QString source = QString::fromUtf8(data.readAll(&error, &irUnit.jsModule.sourceTimeStamp));