diff options
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_profiler')
5 files changed, 48 insertions, 31 deletions
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h index 6392944519..3c5daa0f4f 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h @@ -81,15 +81,15 @@ protected: QList<QJSEngine *> stoppingEngines; bool blockingMode; - void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; - void engineAboutToBeAdded(QJSEngine *) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *) Q_DECL_OVERRIDE; - void engineAdded(QJSEngine *) Q_DECL_OVERRIDE; - void engineRemoved(QJSEngine *) Q_DECL_OVERRIDE; + void messageReceived(const QByteArray &) override; + void engineAboutToBeAdded(QJSEngine *) override; + void engineAboutToBeRemoved(QJSEngine *) override; + void engineAdded(QJSEngine *) override; + void engineRemoved(QJSEngine *) override; void sendMessage(MessageType type, QJSEngine *engine); - void stateChanged(State) Q_DECL_OVERRIDE; + void stateChanged(State) override; }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index 510c745d4e..d676731ba7 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -44,24 +44,36 @@ QT_BEGIN_NAMESPACE -QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine) : - next(0) +QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine) { - setService(service); engine->profiler = new QQmlProfiler; + init(service, engine->profiler); +} + +QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlTypeLoader *loader) +{ + QQmlProfiler *profiler = new QQmlProfiler; + loader->setProfiler(profiler); + init(service, profiler); +} + +void QQmlProfilerAdapter::init(QQmlProfilerService *service, QQmlProfiler *profiler) +{ + next = 0; + setService(service); connect(this, &QQmlProfilerAdapter::profilingEnabled, - engine->profiler, &QQmlProfiler::startProfiling); + profiler, &QQmlProfiler::startProfiling); connect(this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting, - engine->profiler, &QQmlProfiler::startProfiling, Qt::DirectConnection); + profiler, &QQmlProfiler::startProfiling, Qt::DirectConnection); connect(this, &QQmlAbstractProfilerAdapter::profilingDisabled, - engine->profiler, &QQmlProfiler::stopProfiling); + profiler, &QQmlProfiler::stopProfiling); connect(this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting, - engine->profiler, &QQmlProfiler::stopProfiling, Qt::DirectConnection); + profiler, &QQmlProfiler::stopProfiling, Qt::DirectConnection); connect(this, &QQmlAbstractProfilerAdapter::dataRequested, - engine->profiler, &QQmlProfiler::reportData); + profiler, &QQmlProfiler::reportData); connect(this, &QQmlAbstractProfilerAdapter::referenceTimeKnown, - engine->profiler, &QQmlProfiler::setTimer); - connect(engine->profiler, &QQmlProfiler::dataReady, + profiler, &QQmlProfiler::setTimer); + connect(profiler, &QQmlProfiler::dataReady, this, &QQmlProfilerAdapter::receiveData); } diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h index 1fee5c389f..b14b72d254 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h @@ -60,13 +60,15 @@ class QQmlProfilerAdapter : public QQmlAbstractProfilerAdapter { Q_OBJECT public: QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine); + QQmlProfilerAdapter(QQmlProfilerService *service, QQmlTypeLoader *loader); qint64 sendMessages(qint64 until, QList<QByteArray> &messages, - bool trackLocations) Q_DECL_OVERRIDE; + bool trackLocations) override; void receiveData(const QVector<QQmlProfilerData> &new_data, const QQmlProfiler::LocationHash &locations); private: + void init(QQmlProfilerService *service, QQmlProfiler *profiler); QVector<QQmlProfilerData> data; QQmlProfiler::LocationHash locations; int next; diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index edeb364f60..4176ede40e 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -119,9 +119,12 @@ void QQmlProfilerServiceImpl::engineAboutToBeAdded(QJSEngine *engine) QMutexLocker lock(&m_configMutex); if (QQmlEngine *qmlEngine = qobject_cast<QQmlEngine *>(engine)) { - QQmlProfilerAdapter *qmlAdapter = - new QQmlProfilerAdapter(this, QQmlEnginePrivate::get(qmlEngine)); + QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(qmlEngine); + QQmlProfilerAdapter *qmlAdapter = new QQmlProfilerAdapter(this, enginePrivate); addEngineProfiler(qmlAdapter, engine); + QQmlProfilerAdapter *compileAdapter + = new QQmlProfilerAdapter(this, &(enginePrivate->typeLoader)); + addEngineProfiler(compileAdapter, engine); } QV4ProfilerAdapter *v4Adapter = new QV4ProfilerAdapter(this, QV8Engine::getV4(engine->handle())); addEngineProfiler(v4Adapter, engine); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h index bbfc32b681..e6f89e850a 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h @@ -78,30 +78,30 @@ class QQmlProfilerServiceImpl : Q_OBJECT public: - void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineAdded(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; + void engineAboutToBeAdded(QJSEngine *engine) override; + void engineAboutToBeRemoved(QJSEngine *engine) override; + void engineAdded(QJSEngine *engine) override; + void engineRemoved(QJSEngine *engine) override; - void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; - void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; + void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) override; + void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) override; void startProfiling(QJSEngine *engine, - quint64 features = std::numeric_limits<quint64>::max()) Q_DECL_OVERRIDE; - void stopProfiling(QJSEngine *engine) Q_DECL_OVERRIDE; + quint64 features = std::numeric_limits<quint64>::max()) override; + void stopProfiling(QJSEngine *engine) override; QQmlProfilerServiceImpl(QObject *parent = 0); - ~QQmlProfilerServiceImpl() Q_DECL_OVERRIDE; + ~QQmlProfilerServiceImpl() override; - void dataReady(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; + void dataReady(QQmlAbstractProfilerAdapter *profiler) override; signals: void startFlushTimer(); void stopFlushTimer(); protected: - virtual void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; - virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; + void stateAboutToBeChanged(State state) override; + void messageReceived(const QByteArray &) override; private: friend class QQmlProfilerServiceFactory; |