diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-20 15:38:08 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-28 11:03:22 +0000 |
commit | c685165038e10464da877896d1accb7b75d9086e (patch) | |
tree | f1a59a5cb07e38df5d483b43a27e81f6a164e16f | |
parent | bd48f0e5edb1d5ce10529360fb9d14e7b7135022 (diff) |
Qml: Create profiler adapters in the plugins
This way QtQml doesn't need to know the ctors.
Change-Id: Ie74049092b5eb9837537591c0cf37ad1487e4066
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 1 |
6 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index ea052f0475..a4320098c0 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -48,7 +48,7 @@ QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEngin next(0) { setService(service); - engine->enableProfiler(); + engine->profiler = new QQmlProfiler; connect(this, &QQmlProfilerAdapter::profilingEnabled, engine->profiler, &QQmlProfiler::startProfiling); connect(this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting, diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp index 084ac9e489..c88cf559f7 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp @@ -46,7 +46,7 @@ QV4ProfilerAdapter::QV4ProfilerAdapter(QQmlProfilerService *service, QV4::Execut m_functionCallPos(0), m_memoryPos(0) { setService(service); - engine->enableProfiler(); + engine->setProfiler(new QV4::Profiling::Profiler(engine)); connect(this, &QQmlAbstractProfilerAdapter::profilingEnabled, this, &QV4ProfilerAdapter::forwardEnabled); connect(this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting, diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index fe2d4e6575..bff0df58cf 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -473,10 +473,10 @@ void ExecutionEngine::setDebugger(Debugging::Debugger *debugger_) debugger = debugger_; } -void ExecutionEngine::enableProfiler() +void ExecutionEngine::setProfiler(Profiling::Profiler *profiler_) { Q_ASSERT(!profiler); - profiler = new QV4::Profiling::Profiler(this); + profiler = profiler_; } void ExecutionEngine::initRootContext() diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 8743df771c..208598efd5 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -383,7 +383,7 @@ public: ~ExecutionEngine(); void setDebugger(Debugging::Debugger *debugger); - void enableProfiler(); + void setProfiler(Profiling::Profiler *profiler); ExecutionContext *pushGlobalContext(); void pushContext(Heap::ExecutionContext *context); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index c2eef840ed..6e77bc551c 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -648,11 +648,6 @@ QQmlEnginePrivate::~QQmlEnginePrivate() delete profiler; } -void QQmlEnginePrivate::enableProfiler() -{ - profiler = new QQmlProfiler(); -} - void QQmlPrivate::qdeclarativeelement_destructor(QObject *o) { QObjectPrivate *p = QObjectPrivate::get(o); diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index bd4b4e536e..4269392743 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -135,7 +135,6 @@ public: QQmlContext *rootContext; QQmlProfiler *profiler; - void enableProfiler(); bool outputWarningsToMsgLog; |