From 524a1f431c3e247a19d39d7734011d10f9873017 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 2 Sep 2019 16:05:02 +0200 Subject: [PATCH] QmlProfiler: Use standard setup for runner setup Code-wise no immediate advantage, but removes the need for the unusual 'started' signal. Change-Id: Ie1d99127e8fe1561c35e035894ee5dd4639d3f12 Reviewed-by: Ulf Hermann --- .../qmlprofiler/qmlprofilerruncontrol.cpp | 16 +++++++++------- src/plugins/qmlprofiler/qmlprofilerruncontrol.h | 9 +++++---- src/plugins/qmlprofiler/qmlprofilertool.cpp | 1 - 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 460766ec0f6..d01bb52818b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -88,7 +88,6 @@ QmlProfilerRunner::~QmlProfilerRunner() void QmlProfilerRunner::start() { - emit starting(this); if (!d->m_profilerState) QmlProfilerTool::instance()->finalizeRunControl(this); QTC_ASSERT(d->m_profilerState, return); @@ -230,18 +229,20 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q { setId("LocalQmlProfilerSupport"); - auto profiler = new QmlProfilerRunner(runControl); - profiler->setServerUrl(serverUrl); - connect(profiler, &QmlProfilerRunner::starting, - QmlProfilerTool::instance(), &QmlProfilerTool::finalizeRunControl); + m_profiler = new QmlProfilerRunner(runControl); + m_profiler->setServerUrl(serverUrl); - addStopDependency(profiler); + addStopDependency(m_profiler); // We need to open the local server before the application tries to connect. // In the TCP case, it doesn't hurt either to start the profiler before. - addStartDependency(profiler); + addStartDependency(m_profiler); +} +void LocalQmlProfilerSupport::start() +{ Runnable debuggee = runnable(); + QUrl serverUrl = m_profiler->serverUrl(); QString code; if (serverUrl.scheme() == Utils::urlSocketScheme()) code = QString("file:%1").arg(serverUrl.path()); @@ -259,6 +260,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q debuggee.commandLineArguments = arguments; setRunnable(debuggee); + SimpleTargetRunner::start(); } } // namespace Internal diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index ac40e16301a..d58b08b0986 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -37,7 +37,6 @@ namespace QmlProfiler { namespace Internal { -class QmlProfilerTool; class QmlProfilerRunner : public ProjectExplorer::RunWorker { Q_OBJECT @@ -54,9 +53,6 @@ public: void cancelProcess(); void notifyRemoteFinished(); -signals: - void starting(QmlProfilerRunner *self); - private: void start() override; void stop() override; @@ -75,6 +71,11 @@ public: LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl); LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl, const QUrl &serverUrl); + +private: + void start() override; + + QmlProfilerRunner *m_profiler; }; } // namespace Internal diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 49643165090..8348acb6de9 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -561,7 +561,6 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication() runControl->setRunConfiguration(RunConfiguration::startupRunConfiguration()); auto profiler = new QmlProfilerRunner(runControl); profiler->setServerUrl(serverUrl); - connect(profiler, &QmlProfilerRunner::starting, this, &QmlProfilerTool::finalizeRunControl); connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionClosed, runControl, &RunControl::initiateStop);