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 <ulf.hermann@qt.io>
This commit is contained in:
hjk
2019-09-02 16:05:02 +02:00
parent d9d18ee393
commit 524a1f431c
3 changed files with 14 additions and 12 deletions

View File

@@ -88,7 +88,6 @@ QmlProfilerRunner::~QmlProfilerRunner()
void QmlProfilerRunner::start() void QmlProfilerRunner::start()
{ {
emit starting(this);
if (!d->m_profilerState) if (!d->m_profilerState)
QmlProfilerTool::instance()->finalizeRunControl(this); QmlProfilerTool::instance()->finalizeRunControl(this);
QTC_ASSERT(d->m_profilerState, return); QTC_ASSERT(d->m_profilerState, return);
@@ -230,18 +229,20 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q
{ {
setId("LocalQmlProfilerSupport"); setId("LocalQmlProfilerSupport");
auto profiler = new QmlProfilerRunner(runControl); m_profiler = new QmlProfilerRunner(runControl);
profiler->setServerUrl(serverUrl); m_profiler->setServerUrl(serverUrl);
connect(profiler, &QmlProfilerRunner::starting,
QmlProfilerTool::instance(), &QmlProfilerTool::finalizeRunControl);
addStopDependency(profiler); addStopDependency(m_profiler);
// We need to open the local server before the application tries to connect. // 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. // 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(); Runnable debuggee = runnable();
QUrl serverUrl = m_profiler->serverUrl();
QString code; QString code;
if (serverUrl.scheme() == Utils::urlSocketScheme()) if (serverUrl.scheme() == Utils::urlSocketScheme())
code = QString("file:%1").arg(serverUrl.path()); code = QString("file:%1").arg(serverUrl.path());
@@ -259,6 +260,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q
debuggee.commandLineArguments = arguments; debuggee.commandLineArguments = arguments;
setRunnable(debuggee); setRunnable(debuggee);
SimpleTargetRunner::start();
} }
} // namespace Internal } // namespace Internal

View File

@@ -37,7 +37,6 @@
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
class QmlProfilerTool;
class QmlProfilerRunner : public ProjectExplorer::RunWorker class QmlProfilerRunner : public ProjectExplorer::RunWorker
{ {
Q_OBJECT Q_OBJECT
@@ -54,9 +53,6 @@ public:
void cancelProcess(); void cancelProcess();
void notifyRemoteFinished(); void notifyRemoteFinished();
signals:
void starting(QmlProfilerRunner *self);
private: private:
void start() override; void start() override;
void stop() override; void stop() override;
@@ -75,6 +71,11 @@ public:
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl); LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl, LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl,
const QUrl &serverUrl); const QUrl &serverUrl);
private:
void start() override;
QmlProfilerRunner *m_profiler;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -561,7 +561,6 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication()
runControl->setRunConfiguration(RunConfiguration::startupRunConfiguration()); runControl->setRunConfiguration(RunConfiguration::startupRunConfiguration());
auto profiler = new QmlProfilerRunner(runControl); auto profiler = new QmlProfilerRunner(runControl);
profiler->setServerUrl(serverUrl); profiler->setServerUrl(serverUrl);
connect(profiler, &QmlProfilerRunner::starting, this, &QmlProfilerTool::finalizeRunControl);
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionClosed, connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionClosed,
runControl, &RunControl::initiateStop); runControl, &RunControl::initiateStop);