forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -91,23 +91,18 @@ public:
|
||||
EmrunRunWorker(RunControl *runControl)
|
||||
: SimpleTargetRunner(runControl)
|
||||
{
|
||||
m_portsGatherer = new PortsGatherer(runControl);
|
||||
addStartDependency(m_portsGatherer);
|
||||
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, {});
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
PortsGatherer *m_portsGatherer;
|
||||
};
|
||||
|
||||
RunWorkerFactory::WorkerCreator makeEmrunWorker()
|
||||
|
||||
Reference in New Issue
Block a user