aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-09-04 18:21:41 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-09-05 13:08:08 +0000
commit4578a92744d447222f5e22851433d5dbecc51855 (patch)
tree4bb8ffe40faa77177261cfa211cd039c89f9d2b5 /src/qml/qml/qqmltypeloader_p.h
parent560557c5d7d6b48dada2c9966577c718eab7d19d (diff)
QmlProfiler: Avoid race conditions in QQmlTypeLoader
We have to make sure all profiler calls to one adapter are done from the same thread. It turns out that all the calls from QQmlTypeLoader are done from the type loader thread. By using a separate adapter for that, we avoid any extra locking. Task-number: QTBUG-62987 Change-Id: I5cffcc30b84dd4154daa0c56312a1141ce2033e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader_p.h')
-rw-r--r--src/qml/qml/qqmltypeloader_p.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index 05923f77e8..722791ea5a 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -84,6 +84,7 @@ class QQmlComponentPrivate;
class QQmlTypeData;
class QQmlTypeLoader;
class QQmlExtensionInterface;
+class QQmlProfiler;
struct QQmlCompileError;
namespace QmlIR {
@@ -320,6 +321,15 @@ public:
void initializeEngine(QQmlExtensionInterface *, const char *);
void invalidate();
+#ifdef QT_NO_QML_DEBUGGER
+ QQmlProfiler *profiler() const { return nullptr; }
+ void setProfiler(QQmlProfiler *) {}
+#else
+ QQmlProfiler *profiler() const { return m_profiler; }
+ void setProfiler(QQmlProfiler *profiler) { Q_ASSERT(!m_profiler); m_profiler = profiler; }
+#endif // QT_NO_QML_DEBUGGER
+
+
private:
friend class QQmlDataBlob;
friend class QQmlTypeLoaderThread;
@@ -368,6 +378,11 @@ private:
QQmlEngine *m_engine;
QQmlTypeLoaderThread *m_thread;
+
+#ifndef QT_NO_QML_DEBUGGER
+ QQmlProfiler *m_profiler;
+#endif
+
#if QT_CONFIG(qml_network)
NetworkReplies m_networkReplies;
#endif