aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp20
-rw-r--r--src/qml/qml/qqmltypeloader_p.h17
2 files changed, 32 insertions, 5 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 6480420212..074f760a36 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -647,8 +647,7 @@ void QQmlDataBlob::notifyComplete(QQmlDataBlob *blob)
{
Q_ASSERT(m_waitingFor.contains(blob));
Q_ASSERT(blob->status() == Error || blob->status() == Complete);
- QQmlCompilingProfiler prof(QQmlEnginePrivate::get(typeLoader()->engine())->profiler,
- blob->url());
+ QQmlCompilingProfiler prof(typeLoader()->profiler(), blob->url());
m_inCallback = true;
@@ -901,6 +900,12 @@ void QQmlTypeLoader::invalidate()
m_networkReplies.clear();
}
+void QQmlTypeLoader::enableProfiler()
+{
+ Q_ASSERT(!m_profiler);
+ m_profiler = new QQmlProfiler;
+}
+
void QQmlTypeLoader::lock()
{
m_thread->lock();
@@ -1216,7 +1221,7 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, QQmlFile *file)
void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
{
QML_MEMORY_SCOPE_URL(blob->url());
- QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob->url());
+ QQmlCompilingProfiler prof(profiler(), blob->url());
blob->m_inCallback = true;
@@ -1236,7 +1241,7 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
void QQmlTypeLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
{
QML_MEMORY_SCOPE_URL(blob->url());
- QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob->url());
+ QQmlCompilingProfiler prof(profiler(), blob->url());
blob->m_inCallback = true;
@@ -1594,6 +1599,9 @@ Constructs a new type loader that uses the given \a engine.
*/
QQmlTypeLoader::QQmlTypeLoader(QQmlEngine *engine)
: m_engine(engine), m_thread(new QQmlTypeLoaderThread(this)),
+#ifndef QT_NO_QML_DEBUGGER
+ m_profiler(0),
+#endif
m_typeCacheTrimThreshold(TYPELOADER_MINIMUM_TRIM_THRESHOLD)
{
}
@@ -1610,6 +1618,10 @@ QQmlTypeLoader::~QQmlTypeLoader()
clearCache();
invalidate();
+
+#ifndef QT_NO_QML_DEBUGGER
+ delete m_profiler;
+#endif
}
QQmlImportDatabase *QQmlTypeLoader::importDatabase()
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index f565bcd31f..5095aa6bcf 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -74,6 +74,7 @@ class QQmlComponentPrivate;
class QQmlTypeData;
class QQmlTypeLoader;
class QQmlExtensionInterface;
+class QQmlProfiler;
namespace QmlIR {
struct Document;
@@ -211,7 +212,7 @@ private:
class QQmlTypeLoaderThread;
-class Q_AUTOTEST_EXPORT QQmlTypeLoader
+class Q_QML_PRIVATE_EXPORT QQmlTypeLoader
{
Q_DECLARE_TR_FUNCTIONS(QQmlTypeLoader)
public:
@@ -311,6 +312,15 @@ public:
void initializeEngine(QQmlExtensionInterface *, const char *);
void invalidate();
+#ifdef QT_NO_QML_DEBUGGER
+ QQmlProfiler *profiler() const { return 0; }
+ void enableProfiler() {}
+#else
+ QQmlProfiler *profiler() const { return m_profiler; }
+ void enableProfiler();
+#endif // QT_NO_QML_DEBUGGER
+
+
private:
friend class QQmlDataBlob;
friend class QQmlTypeLoaderThread;
@@ -356,6 +366,11 @@ private:
QQmlEngine *m_engine;
QQmlTypeLoaderThread *m_thread;
+
+#ifndef QT_NO_QML_DEBUGGER
+ QQmlProfiler *m_profiler;
+#endif
+
NetworkReplies m_networkReplies;
TypeCache m_typeCache;
int m_typeCacheTrimThreshold;