aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index b392ba4807..e80c15f785 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -106,7 +106,8 @@ using namespace QV4;
// odd while the statics are being initialized, and stays even afterwards.
// Any further engines created while the statics are being initialized busy-wait until engineSerial
// is even.
-static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1);
+Q_CONSTINIT static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1);
+Q_CONSTINIT static QBasicAtomicInt hasPreview = Q_BASIC_ATOMIC_INITIALIZER(0);
int ExecutionEngine::s_maxCallDepth = -1;
int ExecutionEngine::s_jitCallCountThreshold = 3;
int ExecutionEngine::s_maxJSStackSize = 4 * 1024 * 1024;
@@ -896,6 +897,12 @@ void ExecutionEngine::setProfiler(Profiling::Profiler *profiler)
Q_ASSERT(!m_profiler);
m_profiler.reset(profiler);
}
+
+void ExecutionEngine::setPreviewing(bool enabled)
+{
+ hasPreview.storeRelease(enabled);
+}
+
#endif // QT_CONFIG(qml_debug)
void ExecutionEngine::initRootContext()
@@ -2204,7 +2211,9 @@ ExecutionEngine::DiskCacheOptions ExecutionEngine::diskCacheOptions() const
return DiskCache::Disabled;
static const DiskCacheOptions options = qmlGetConfigOption<
DiskCacheOptions, transFormDiskCache>("QML_DISK_CACHE");
- return options;
+ return hasPreview.loadAcquire()
+ ? (options & ~DiskCacheOptions(DiskCache::Aot)) // Disable AOT if preview enabled
+ : options;
}
void ExecutionEngine::callInContext(QV4::Function *function, QObject *self,