diff options
author | hjk <hjk@qt.io> | 2019-09-02 18:22:35 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-09-04 11:08:34 +0000 |
commit | 4028a41d2eb00649fb97c1f78be90a2cf42c7adf (patch) | |
tree | 2544a317c15722b849e5f4513f65160eced8b8fc /src/plugins/webassembly | |
parent | 8d85a7c2bc011a06dff3a85e47b6ecfa5cdaed24 (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/webassembly')
-rw-r--r-- | src/plugins/webassembly/webassemblyrunconfiguration.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp index c6ead8ae21..b8f3610ccc 100644 --- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp +++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp @@ -91,23 +91,18 @@ public: EmrunRunWorker(RunControl *runControl) : SimpleTargetRunner(runControl) { - m_portsGatherer = new PortsGatherer(runControl); - addStartDependency(m_portsGatherer); - } - - void start() final - { - CommandLine cmd = emrunCommand(runControl()->target(), - runControl()->aspect<WebBrowserSelectionAspect>()->currentBrowser(), - QString::number(m_portsGatherer->findEndPoint().port())); - Runnable r; - r.setCommandLine(cmd); - setRunnable(r); - - SimpleTargetRunner::start(); + auto portsGatherer = new PortsGatherer(runControl); + addStartDependency(portsGatherer); + + setStarter([this, runControl, portsGatherer] { + CommandLine cmd = emrunCommand(runControl->target(), + runControl->aspect<WebBrowserSelectionAspect>()->currentBrowser(), + QString::number(portsGatherer->findEndPoint().port())); + Runnable r; + r.setCommandLine(cmd); + SimpleTargetRunner::doStart(r, {}); + }); } - - PortsGatherer *m_portsGatherer; }; RunWorkerFactory::WorkerCreator makeEmrunWorker() |