From 5b091eb79b6853d0fde34b5dea89a84b7514a5ff Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 10 Nov 2015 14:08:11 +0100 Subject: Use QJSEngine instead of QQmlEngine in debug services This allows us to use the debug infrastructure in a JavaScript-only environment. Also add override declarations to make such changes easier in the future. Change-Id: I171271f0ad3868b3de71a8a2316a24602f94200a Reviewed-by: Lars Knoll --- .../qmldbg_debugger/qqmlenginedebugservice.cpp | 8 ++-- .../qmldbg_debugger/qqmlenginedebugservice.h | 8 ++-- .../qmldbg_debugger/qqmlnativedebugservice.cpp | 7 ++-- .../qmldbg_debugger/qqmlnativedebugservice.h | 10 ++--- .../qmltooling/qmldbg_debugger/qv4debugservice.cpp | 4 +- .../qmltooling/qmldbg_debugger/qv4debugservice.h | 13 +++--- .../qmldbg_inspector/qqmlinspectorservice.cpp | 8 ++-- .../qmldbg_native/qqmlnativedebugconnector.cpp | 6 +-- .../qmldbg_native/qqmlnativedebugconnector.h | 16 ++++---- .../qmldbg_profiler/qqmlenginecontrolservice.cpp | 18 ++++----- .../qmldbg_profiler/qqmlenginecontrolservice.h | 18 ++++----- .../qmldbg_profiler/qqmlprofileradapter.h | 2 +- .../qmldbg_profiler/qqmlprofilerservice.cpp | 47 ++++++++++++---------- .../qmldbg_profiler/qqmlprofilerservice.h | 33 ++++++++------- .../qmltooling/qmldbg_server/qqmldebugserver.cpp | 44 ++++++++++---------- .../shared/qqmlconfigurabledebugservice.h | 8 ++-- 16 files changed, 125 insertions(+), 125 deletions(-) (limited to 'src/plugins/qmltooling') diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index 48d940fe75..3775a2c1b4 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -453,7 +453,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) rs << queryId << m_engines.count(); for (int ii = 0; ii < m_engines.count(); ++ii) { - QQmlEngine *engine = m_engines.at(ii); + QJSEngine *engine = m_engines.at(ii); QString engineName = engine->objectName(); int engineId = QQmlDebugService::idForObject(engine); @@ -773,7 +773,7 @@ void QQmlEngineDebugServiceImpl::propertyChanged(int id, int objectId, const QMe emit messageToClient(name(), rs.data()); } -void QQmlEngineDebugServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) +void QQmlEngineDebugServiceImpl::engineAboutToBeAdded(QJSEngine *engine) { Q_ASSERT(engine); Q_ASSERT(!m_engines.contains(engine)); @@ -782,7 +782,7 @@ void QQmlEngineDebugServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) emit attachedToEngine(engine); } -void QQmlEngineDebugServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) +void QQmlEngineDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) { Q_ASSERT(engine); Q_ASSERT(m_engines.contains(engine)); @@ -791,7 +791,7 @@ void QQmlEngineDebugServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) emit detachedFromEngine(engine); } -void QQmlEngineDebugServiceImpl::objectCreated(QQmlEngine *engine, QObject *object) +void QQmlEngineDebugServiceImpl::objectCreated(QJSEngine *engine, QObject *object) { Q_ASSERT(engine); Q_ASSERT(m_engines.contains(engine)); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h index 19a4827f89..a12aa495c3 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h @@ -89,9 +89,9 @@ public: bool hasNotifySignal; }; - void engineAboutToBeAdded(QQmlEngine *); - void engineAboutToBeRemoved(QQmlEngine *); - void objectCreated(QQmlEngine *, QObject *); + void engineAboutToBeAdded(QJSEngine *) Q_DECL_OVERRIDE; + void engineAboutToBeRemoved(QJSEngine *) Q_DECL_OVERRIDE; + void objectCreated(QJSEngine *, QObject *) Q_DECL_OVERRIDE; void setStatesDelegate(QQmlDebugStatesDelegate *); @@ -120,7 +120,7 @@ private: QList objectForLocationInfo(const QString &filename, int lineNumber, int columnNumber); - QList m_engines; + QList m_engines; QQmlWatcher *m_watch; QQmlDebugStatesDelegate *m_statesDelegate; }; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp index 6d17ec2ad0..a57ef56a84 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp @@ -47,8 +47,7 @@ #include #include -#include - +#include #include #include #include @@ -724,7 +723,7 @@ QQmlNativeDebugServiceImpl::~QQmlNativeDebugServiceImpl() delete m_breakHandler; } -void QQmlNativeDebugServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) +void QQmlNativeDebugServiceImpl::engineAboutToBeAdded(QJSEngine *engine) { TRACE_PROTOCOL("Adding engine" << engine); if (engine) { @@ -741,7 +740,7 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) QQmlDebugService::engineAboutToBeAdded(engine); } -void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) +void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) { TRACE_PROTOCOL("Removing engine" << engine); if (engine) { diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h index 9d0780a203..5ebf0a7f54 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.h @@ -68,14 +68,14 @@ class QQmlNativeDebugServiceImpl : public QQmlNativeDebugService public: QQmlNativeDebugServiceImpl(QObject *parent); - ~QQmlNativeDebugServiceImpl(); + ~QQmlNativeDebugServiceImpl() Q_DECL_OVERRIDE; - void engineAboutToBeAdded(QQmlEngine *engine); - void engineAboutToBeRemoved(QQmlEngine *engine); + void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE; + void engineAboutToBeRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; - void stateAboutToBeChanged(State state); + void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; - void messageReceived(const QByteArray &message); + void messageReceived(const QByteArray &message) Q_DECL_OVERRIDE; void emitAsynchronousMessageToClient(const QJsonObject &message); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 0c8de860ed..dbfbcb25bb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -627,7 +627,7 @@ QV4DebugServiceImpl::~QV4DebugServiceImpl() qDeleteAll(handlers); } -void QV4DebugServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) +void QV4DebugServiceImpl::engineAboutToBeAdded(QJSEngine *engine) { QMutexLocker lock(&m_configMutex); if (engine) { @@ -646,7 +646,7 @@ void QV4DebugServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) QQmlConfigurableDebugService::engineAboutToBeAdded(engine); } -void QV4DebugServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) +void QV4DebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) { QMutexLocker lock(&m_configMutex); if (engine){ diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h index 37b9f6f976..5e6f466ecf 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h @@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE namespace QV4 { struct ExecutionEngine; } -class QQmlEngine; class VariableCollector; class V8CommandHandler; class UnknownV8CommandHandler; @@ -68,14 +67,14 @@ class QV4DebugServiceImpl : public QQmlConfigurableDebugService Q_OBJECT public: explicit QV4DebugServiceImpl(QObject *parent = 0); - ~QV4DebugServiceImpl(); + ~QV4DebugServiceImpl() Q_DECL_OVERRIDE; - void engineAboutToBeAdded(QQmlEngine *engine); - void engineAboutToBeRemoved(QQmlEngine *engine); + void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE; + void engineAboutToBeRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; - void stateAboutToBeChanged(State state); + void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; - void signalEmitted(const QString &signal); + void signalEmitted(const QString &signal) Q_DECL_OVERRIDE; void send(QJsonObject v8Payload); QJsonObject buildScope(int frameNr, int scopeNr, QV4Debugger *debugger); @@ -94,7 +93,7 @@ public: QV4DataCollector::Refs *refs(); protected: - void messageReceived(const QByteArray &); + void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; void sendSomethingToSomebody(const char *type, int magicNumber = 1); private: diff --git a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp index 1707091df3..6b786024f8 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp @@ -50,12 +50,12 @@ class QQmlInspectorServiceImpl : public QQmlInspectorService public: QQmlInspectorServiceImpl(QObject *parent = 0); - void addView(QObject *); - void removeView(QObject *); + void addView(QObject *) Q_DECL_OVERRIDE; + void removeView(QObject *) Q_DECL_OVERRIDE; protected: - virtual void stateChanged(State state); - virtual void messageReceived(const QByteArray &); + virtual void stateChanged(State state) Q_DECL_OVERRIDE; + virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; private Q_SLOTS: void processMessage(const QByteArray &message); diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index 7f5529636c..e4054e100d 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -35,8 +35,8 @@ #include "qqmldebugpacket.h" #include -#include +#include #include #include #include @@ -223,7 +223,7 @@ QQmlDebugService *QQmlNativeDebugConnector::service(const QString &name) const return 0; } -void QQmlNativeDebugConnector::addEngine(QQmlEngine *engine) +void QQmlNativeDebugConnector::addEngine(QJSEngine *engine) { TRACE_PROTOCOL("Add engine to connector:" << engine); foreach (QQmlDebugService *service, m_services) @@ -235,7 +235,7 @@ void QQmlNativeDebugConnector::addEngine(QQmlEngine *engine) service->engineAdded(engine); } -void QQmlNativeDebugConnector::removeEngine(QQmlEngine *engine) +void QQmlNativeDebugConnector::removeEngine(QJSEngine *engine) { TRACE_PROTOCOL("Remove engine from connector:" << engine); foreach (QQmlDebugService *service, m_services) diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h index d071d54368..a883608fd4 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h @@ -45,15 +45,15 @@ class QQmlNativeDebugConnector : public QQmlDebugConnector public: QQmlNativeDebugConnector(); - ~QQmlNativeDebugConnector(); + ~QQmlNativeDebugConnector() Q_DECL_OVERRIDE; - bool blockingMode() const; - QQmlDebugService *service(const QString &name) const; - void addEngine(QQmlEngine *engine); - void removeEngine(QQmlEngine *engine); - bool addService(const QString &name, QQmlDebugService *service); - bool removeService(const QString &name); - bool open(const QVariantHash &configuration); + bool blockingMode() const Q_DECL_OVERRIDE; + QQmlDebugService *service(const QString &name) const Q_DECL_OVERRIDE; + void addEngine(QJSEngine *engine) Q_DECL_OVERRIDE; + void removeEngine(QJSEngine *engine) Q_DECL_OVERRIDE; + bool addService(const QString &name, QQmlDebugService *service) Q_DECL_OVERRIDE; + bool removeService(const QString &name) Q_DECL_OVERRIDE; + bool open(const QVariantHash &configuration) Q_DECL_OVERRIDE; static void setDataStreamVersion(int version); private slots: diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp index 61bf61eb13..2f7a7075ef 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp @@ -33,7 +33,7 @@ #include "qqmlenginecontrolservice.h" #include "qqmldebugpacket.h" -#include +#include QT_BEGIN_NAMESPACE @@ -49,7 +49,7 @@ void QQmlEngineControlServiceImpl::messageReceived(const QByteArray &message) int command; int engineId; d >> command >> engineId; - QQmlEngine *engine = qobject_cast(objectForId(engineId)); + QJSEngine *engine = qobject_cast(objectForId(engineId)); if (command == StartWaitingEngine && startingEngines.contains(engine)) { startingEngines.removeOne(engine); emit attachedToEngine(engine); @@ -59,7 +59,7 @@ void QQmlEngineControlServiceImpl::messageReceived(const QByteArray &message) } } -void QQmlEngineControlServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) +void QQmlEngineControlServiceImpl::engineAboutToBeAdded(QJSEngine *engine) { QMutexLocker lock(&dataMutex); if (state() == Enabled) { @@ -72,7 +72,7 @@ void QQmlEngineControlServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) } } -void QQmlEngineControlServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) +void QQmlEngineControlServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) { QMutexLocker lock(&dataMutex); if (state() == Enabled) { @@ -85,7 +85,7 @@ void QQmlEngineControlServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) } } -void QQmlEngineControlServiceImpl::engineAdded(QQmlEngine *engine) +void QQmlEngineControlServiceImpl::engineAdded(QJSEngine *engine) { if (state() == Enabled) { QMutexLocker lock(&dataMutex); @@ -95,7 +95,7 @@ void QQmlEngineControlServiceImpl::engineAdded(QQmlEngine *engine) } } -void QQmlEngineControlServiceImpl::engineRemoved(QQmlEngine *engine) +void QQmlEngineControlServiceImpl::engineRemoved(QJSEngine *engine) { if (state() == Enabled) { QMutexLocker lock(&dataMutex); @@ -105,7 +105,7 @@ void QQmlEngineControlServiceImpl::engineRemoved(QQmlEngine *engine) } } -void QQmlEngineControlServiceImpl::sendMessage(QQmlEngineControlServiceImpl::MessageType type, QQmlEngine *engine) +void QQmlEngineControlServiceImpl::sendMessage(QQmlEngineControlServiceImpl::MessageType type, QJSEngine *engine) { QQmlDebugPacket d; d << type << idForObject(engine); @@ -116,10 +116,10 @@ void QQmlEngineControlServiceImpl::stateChanged(State) { // We flush everything for any kind of state change, to avoid complicated timing issues. QMutexLocker lock(&dataMutex); - foreach (QQmlEngine *engine, startingEngines) + foreach (QJSEngine *engine, startingEngines) emit attachedToEngine(engine); startingEngines.clear(); - foreach (QQmlEngine *engine, stoppingEngines) + foreach (QJSEngine *engine, stoppingEngines) emit detachedFromEngine(engine); stoppingEngines.clear(); } diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h index 8dbc922a6f..028852e964 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h @@ -71,18 +71,18 @@ protected: friend class QQmlProfilerServiceFactory; QMutex dataMutex; - QList startingEngines; - QList stoppingEngines; + QList startingEngines; + QList stoppingEngines; - void messageReceived(const QByteArray &); - void engineAboutToBeAdded(QQmlEngine *); - void engineAboutToBeRemoved(QQmlEngine *); - void engineAdded(QQmlEngine *); - void engineRemoved(QQmlEngine *); + 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 sendMessage(MessageType type, QQmlEngine *engine); + void sendMessage(MessageType type, QJSEngine *engine); - void stateChanged(State); + void stateChanged(State) Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h index eceb58ce3a..b15c2febda 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h @@ -54,7 +54,7 @@ class QQmlProfilerAdapter : public QQmlAbstractProfilerAdapter { Q_OBJECT public: QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine); - qint64 sendMessages(qint64 until, QList &messages); + qint64 sendMessages(qint64 until, QList &messages) Q_DECL_OVERRIDE; public slots: void receiveData(const QVector &new_data); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 3647a62682..e05717f8eb 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -37,7 +37,7 @@ #include "qqmlprofilerservicefactory.h" #include "qqmldebugpacket.h" -#include +#include #include #include @@ -86,8 +86,8 @@ void QQmlProfilerServiceImpl::dataReady(QQmlAbstractProfilerAdapter *profiler) } m_startTimes.insert(0, profiler); if (dataComplete) { - QList enginesToRelease; - foreach (QQmlEngine *engine, m_stoppingEngines) { + QList enginesToRelease; + foreach (QJSEngine *engine, m_stoppingEngines) { foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers.values(engine)) { if (m_startTimes.values().contains(engineProfiler)) { enginesToRelease.append(engine); @@ -96,27 +96,30 @@ void QQmlProfilerServiceImpl::dataReady(QQmlAbstractProfilerAdapter *profiler) } } sendMessages(); - foreach (QQmlEngine *engine, enginesToRelease) { + foreach (QJSEngine *engine, enginesToRelease) { m_stoppingEngines.removeOne(engine); emit detachedFromEngine(engine); } } } -void QQmlProfilerServiceImpl::engineAboutToBeAdded(QQmlEngine *engine) +void QQmlProfilerServiceImpl::engineAboutToBeAdded(QJSEngine *engine) { Q_ASSERT_X(QThread::currentThread() == engine->thread(), Q_FUNC_INFO, "QML profilers have to be added from the engine thread"); QMutexLocker lock(&m_configMutex); - QQmlProfilerAdapter *qmlAdapter = new QQmlProfilerAdapter(this, QQmlEnginePrivate::get(engine)); + if (QQmlEngine *qmlEngine = qobject_cast(engine)) { + QQmlProfilerAdapter *qmlAdapter = + new QQmlProfilerAdapter(this, QQmlEnginePrivate::get(qmlEngine)); + addEngineProfiler(qmlAdapter, engine); + } QV4ProfilerAdapter *v4Adapter = new QV4ProfilerAdapter(this, QV8Engine::getV4(engine->handle())); - addEngineProfiler(qmlAdapter, engine); addEngineProfiler(v4Adapter, engine); QQmlConfigurableDebugService::engineAboutToBeAdded(engine); } -void QQmlProfilerServiceImpl::engineAdded(QQmlEngine *engine) +void QQmlProfilerServiceImpl::engineAdded(QJSEngine *engine) { Q_ASSERT_X(QThread::currentThread() == engine->thread(), Q_FUNC_INFO, "QML profilers have to be added from the engine thread"); @@ -126,7 +129,7 @@ void QQmlProfilerServiceImpl::engineAdded(QQmlEngine *engine) profiler->stopWaiting(); } -void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) +void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QJSEngine *engine) { Q_ASSERT_X(QThread::currentThread() == engine->thread(), Q_FUNC_INFO, "QML profilers have to be removed from the engine thread"); @@ -146,7 +149,7 @@ void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QQmlEngine *engine) } } -void QQmlProfilerServiceImpl::engineRemoved(QQmlEngine *engine) +void QQmlProfilerServiceImpl::engineRemoved(QJSEngine *engine) { Q_ASSERT_X(QThread::currentThread() == engine->thread(), Q_FUNC_INFO, "QML profilers have to be removed from the engine thread"); @@ -159,7 +162,7 @@ void QQmlProfilerServiceImpl::engineRemoved(QQmlEngine *engine) m_engineProfilers.remove(engine); } -void QQmlProfilerServiceImpl::addEngineProfiler(QQmlAbstractProfilerAdapter *profiler, QQmlEngine *engine) +void QQmlProfilerServiceImpl::addEngineProfiler(QQmlAbstractProfilerAdapter *profiler, QJSEngine *engine) { profiler->moveToThread(thread()); profiler->synchronize(m_timer); @@ -208,7 +211,7 @@ void QQmlProfilerServiceImpl::removeProfilerFromStartTimes(const QQmlAbstractPro * * If any engine profiler is started like that also start all global profilers. */ -void QQmlProfilerServiceImpl::startProfiling(QQmlEngine *engine, quint64 features) +void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features) { QMutexLocker lock(&m_configMutex); @@ -226,8 +229,8 @@ void QQmlProfilerServiceImpl::startProfiling(QQmlEngine *engine, quint64 feature if (startedAny) d << idForObject(engine); } else { - QSet engines; - for (QMultiHash::iterator i(m_engineProfilers.begin()); + QSet engines; + for (QMultiHash::iterator i(m_engineProfilers.begin()); i != m_engineProfilers.end(); ++i) { if (!i.value()->isRunning()) { engines << i.key(); @@ -235,7 +238,7 @@ void QQmlProfilerServiceImpl::startProfiling(QQmlEngine *engine, quint64 feature startedAny = true; } } - foreach (QQmlEngine *profiledEngine, engines) + foreach (QJSEngine *profiledEngine, engines) d << idForObject(profiledEngine); } @@ -258,14 +261,14 @@ void QQmlProfilerServiceImpl::startProfiling(QQmlEngine *engine, quint64 feature * If afterwards no more engine profilers are running, also stop all global profilers. Otherwise * only make them report their data. */ -void QQmlProfilerServiceImpl::stopProfiling(QQmlEngine *engine) +void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine) { QMutexLocker lock(&m_configMutex); QList stopping; QList reporting; bool stillRunning = false; - for (QMultiHash::iterator i(m_engineProfilers.begin()); + for (QMultiHash::iterator i(m_engineProfilers.begin()); i != m_engineProfilers.end(); ++i) { if (i.value()->isRunning()) { if (engine == 0 || i.key() == engine) { @@ -312,9 +315,9 @@ void QQmlProfilerServiceImpl::sendMessages() if (m_waitingForStop) { traceEnd << m_timer.nsecsElapsed() << (int)Event << (int)EndTrace; - QSet seen; + QSet seen; foreach (QQmlAbstractProfilerAdapter *profiler, m_startTimes) { - for (QMultiHash::iterator i(m_engineProfilers.begin()); + for (QMultiHash::iterator i(m_engineProfilers.begin()); i != m_engineProfilers.end(); ++i) { if (i.value() == profiler && !seen.contains(i.key())) { seen << i.key(); @@ -366,7 +369,7 @@ void QQmlProfilerServiceImpl::stateAboutToBeChanged(QQmlDebugService::State newS // Stop all profiling and send the data before we get disabled. if (newState != Enabled) { - foreach (QQmlEngine *engine, m_engineProfilers.keys()) + foreach (QJSEngine *engine, m_engineProfilers.keys()) stopProfiling(engine); } } @@ -402,9 +405,9 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message) // If engineId == -1 objectForId() and then the cast will return 0. if (enabled) - startProfiling(qobject_cast(objectForId(engineId)), features); + startProfiling(qobject_cast(objectForId(engineId)), features); else - stopProfiling(qobject_cast(objectForId(engineId))); + stopProfiling(qobject_cast(objectForId(engineId))); stopWaiting(); } diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h index 9b139ffabb..299d170339 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h @@ -64,8 +64,6 @@ QT_BEGIN_NAMESPACE class QUrl; -class QQmlEngine; - class QQmlProfilerServiceImpl : public QQmlConfigurableDebugService, @@ -74,21 +72,22 @@ class QQmlProfilerServiceImpl : Q_OBJECT public: - void engineAboutToBeAdded(QQmlEngine *engine); - void engineAboutToBeRemoved(QQmlEngine *engine); - void engineAdded(QQmlEngine *engine); - void engineRemoved(QQmlEngine *engine); + 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 addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler); - void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler); + void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; + void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; - void startProfiling(QQmlEngine *engine, quint64 features = std::numeric_limits::max()); - void stopProfiling(QQmlEngine *engine); + void startProfiling(QJSEngine *engine, + quint64 features = std::numeric_limits::max()) Q_DECL_OVERRIDE; + void stopProfiling(QJSEngine *engine) Q_DECL_OVERRIDE; QQmlProfilerServiceImpl(QObject *parent = 0); - ~QQmlProfilerServiceImpl(); + ~QQmlProfilerServiceImpl() Q_DECL_OVERRIDE; - void dataReady(QQmlAbstractProfilerAdapter *profiler); + void dataReady(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; signals: void startFlushTimer(); @@ -98,14 +97,14 @@ private slots: void flush(); protected: - virtual void stateAboutToBeChanged(State state); - virtual void messageReceived(const QByteArray &); + virtual void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; + virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; private: friend class QQmlProfilerServiceFactory; void sendMessages(); - void addEngineProfiler(QQmlAbstractProfilerAdapter *profiler, QQmlEngine *engine); + void addEngineProfiler(QQmlAbstractProfilerAdapter *profiler, QJSEngine *engine); void removeProfilerFromStartTimes(const QQmlAbstractProfilerAdapter *profiler); QElapsedTimer m_timer; @@ -113,8 +112,8 @@ private: bool m_waitingForStop; QList m_globalProfilers; - QMultiHash m_engineProfilers; - QList m_stoppingEngines; + QMultiHash m_engineProfilers; + QList m_stoppingEngines; QMultiMap m_startTimes; }; diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index ba36048802..50c7ef3771 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -37,7 +37,7 @@ #include "qqmldebugpacket.h" #include -#include +#include #include #include #include @@ -126,25 +126,25 @@ class QQmlDebugServerImpl : public QQmlDebugServer public: QQmlDebugServerImpl(); - bool blockingMode() const; + bool blockingMode() const Q_DECL_OVERRIDE; - QQmlDebugService *service(const QString &name) const; + QQmlDebugService *service(const QString &name) const Q_DECL_OVERRIDE; - void addEngine(QQmlEngine *engine); - void removeEngine(QQmlEngine *engine); + void addEngine(QJSEngine *engine) Q_DECL_OVERRIDE; + void removeEngine(QJSEngine *engine) Q_DECL_OVERRIDE; - bool addService(const QString &name, QQmlDebugService *service); - bool removeService(const QString &name); + bool addService(const QString &name, QQmlDebugService *service) Q_DECL_OVERRIDE; + bool removeService(const QString &name) Q_DECL_OVERRIDE; - bool open(const QVariantHash &configuration); - void setDevice(QIODevice *socket); + bool open(const QVariantHash &configuration) Q_DECL_OVERRIDE; + void setDevice(QIODevice *socket) Q_DECL_OVERRIDE; void parseArguments(); static void cleanup(); private slots: - void wakeEngine(QQmlEngine *engine); + void wakeEngine(QJSEngine *engine); void sendMessage(const QString &name, const QByteArray &message); void sendMessages(const QString &name, const QList &messages); void changeServiceState(const QString &serviceName, QQmlDebugService::State state); @@ -179,7 +179,7 @@ private: bool m_gotHello; bool m_blockingMode; - QHash m_engineConditions; + QHash m_engineConditions; QMutex m_helloMutex; QWaitCondition m_helloCondition; @@ -559,7 +559,7 @@ QQmlDebugService *QQmlDebugServerImpl::service(const QString &name) const return m_plugins.value(name); } -void QQmlDebugServerImpl::addEngine(QQmlEngine *engine) +void QQmlDebugServerImpl::addEngine(QJSEngine *engine) { // to be executed outside of debugger thread Q_ASSERT(QThread::currentThread() != &m_thread); @@ -574,7 +574,7 @@ void QQmlDebugServerImpl::addEngine(QQmlEngine *engine) service->engineAdded(engine); } -void QQmlDebugServerImpl::removeEngine(QQmlEngine *engine) +void QQmlDebugServerImpl::removeEngine(QJSEngine *engine) { // to be executed outside of debugger thread Q_ASSERT(QThread::currentThread() != &m_thread); @@ -602,10 +602,10 @@ bool QQmlDebugServerImpl::addService(const QString &name, QQmlDebugService *serv connect(service, SIGNAL(messagesToClient(QString,QList)), this, SLOT(sendMessages(QString,QList))); - connect(service, SIGNAL(attachedToEngine(QQmlEngine*)), - this, SLOT(wakeEngine(QQmlEngine*)), Qt::QueuedConnection); - connect(service, SIGNAL(detachedFromEngine(QQmlEngine*)), - this, SLOT(wakeEngine(QQmlEngine*)), Qt::QueuedConnection); + connect(service, SIGNAL(attachedToEngine(QJSEngine*)), + this, SLOT(wakeEngine(QJSEngine*)), Qt::QueuedConnection); + connect(service, SIGNAL(detachedFromEngine(QJSEngine*)), + this, SLOT(wakeEngine(QJSEngine*)), Qt::QueuedConnection); service->setState(QQmlDebugService::Unavailable); m_plugins.insert(name, service); @@ -625,10 +625,10 @@ bool QQmlDebugServerImpl::removeService(const QString &name) m_plugins.remove(name); service->setState(QQmlDebugService::NotConnected); - disconnect(service, SIGNAL(detachedFromEngine(QQmlEngine*)), - this, SLOT(wakeEngine(QQmlEngine*))); - disconnect(service, SIGNAL(attachedToEngine(QQmlEngine*)), - this, SLOT(wakeEngine(QQmlEngine*))); + disconnect(service, SIGNAL(detachedFromEngine(QJSEngine*)), + this, SLOT(wakeEngine(QJSEngine*))); + disconnect(service, SIGNAL(attachedToEngine(QJSEngine*)), + this, SLOT(wakeEngine(QJSEngine*))); disconnect(service, SIGNAL(messagesToClient(QString,QList)), this, SLOT(sendMessages(QString,QList))); @@ -670,7 +670,7 @@ void QQmlDebugServerImpl::sendMessages(const QString &name, const QListblockingMode()); } - void stateChanged(QQmlDebugService::State newState) + void stateChanged(QQmlDebugService::State newState) Q_DECL_OVERRIDE { if (newState != QQmlDebugService::Enabled) stopWaiting(); @@ -87,7 +87,7 @@ protected: init(); } - void engineAboutToBeAdded(QQmlEngine *engine) + void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE { QMutexLocker lock(&m_configMutex); if (m_waitingForConfiguration) @@ -97,7 +97,7 @@ protected: } QMutex m_configMutex; - QList m_waitingEngines; + QList m_waitingEngines; bool m_waitingForConfiguration; }; -- cgit v1.2.3