aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-09-02 18:22:35 +0200
committerhjk <hjk@qt.io>2019-09-04 11:08:34 +0000
commit4028a41d2eb00649fb97c1f78be90a2cf42c7adf (patch)
tree2544a317c15722b849e5f4513f65160eced8b8fc /src/plugins/qmlprofiler
parent8d85a7c2bc011a06dff3a85e47b6ecfa5cdaed24 (diff)
ProjectExplorer: Use std::function for SimpleTargetRunner::start()
This spares us the typical r = runnable(); modify(r); setRunnable(r) roundtrip and the m_runnable storage that might or might not be the same as runControl->runnable. Similar for m_device. Change-Id: I8300260dd8dd7cd395e40bcd3d2ae45089085008 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp44
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerruncontrol.h5
2 files changed, 21 insertions, 28 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp
index d01bb52818..5d51540d3f 100644
--- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp
@@ -229,38 +229,36 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q
{
setId("LocalQmlProfilerSupport");
- m_profiler = new QmlProfilerRunner(runControl);
- m_profiler->setServerUrl(serverUrl);
+ auto profiler = new QmlProfilerRunner(runControl);
+ profiler->setServerUrl(serverUrl);
- addStopDependency(m_profiler);
+ addStopDependency(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(m_profiler);
-}
+ addStartDependency(profiler);
-void LocalQmlProfilerSupport::start()
-{
- Runnable debuggee = runnable();
+ setStarter([this, runControl, profiler, serverUrl] {
+ Runnable debuggee = runControl->runnable();
- QUrl serverUrl = m_profiler->serverUrl();
- QString code;
- if (serverUrl.scheme() == Utils::urlSocketScheme())
- code = QString("file:%1").arg(serverUrl.path());
- else if (serverUrl.scheme() == Utils::urlTcpScheme())
- code = QString("port:%1").arg(serverUrl.port());
- else
- QTC_CHECK(false);
+ QUrl serverUrl = profiler->serverUrl();
+ QString code;
+ if (serverUrl.scheme() == Utils::urlSocketScheme())
+ code = QString("file:%1").arg(serverUrl.path());
+ else if (serverUrl.scheme() == Utils::urlTcpScheme())
+ code = QString("port:%1").arg(serverUrl.port());
+ else
+ QTC_CHECK(false);
- QString arguments = Utils::QtcProcess::quoteArg(
- QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, code, true));
+ QString arguments = Utils::QtcProcess::quoteArg(
+ QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, code, true));
- if (!debuggee.commandLineArguments.isEmpty())
- arguments += ' ' + debuggee.commandLineArguments;
+ if (!debuggee.commandLineArguments.isEmpty())
+ arguments += ' ' + debuggee.commandLineArguments;
- debuggee.commandLineArguments = arguments;
+ debuggee.commandLineArguments = arguments;
- setRunnable(debuggee);
- SimpleTargetRunner::start();
+ doStart(debuggee, {});
+ });
}
} // namespace Internal
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h
index d58b08b098..b846306abd 100644
--- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h
@@ -71,11 +71,6 @@ public:
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl,
const QUrl &serverUrl);
-
-private:
- void start() override;
-
- QmlProfilerRunner *m_profiler;
};
} // namespace Internal