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/qnx | |
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/qnx')
-rw-r--r-- | src/plugins/qnx/qnxanalyzesupport.cpp | 38 | ||||
-rw-r--r-- | src/plugins/qnx/qnxanalyzesupport.h | 11 | ||||
-rw-r--r-- | src/plugins/qnx/qnxdebugsupport.cpp | 66 |
3 files changed, 42 insertions, 73 deletions
diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 8b5fc0c336..bba9401fe9 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -25,21 +25,14 @@ #include "qnxanalyzesupport.h" -#include "qnxdevice.h" -#include "qnxrunconfiguration.h" #include "slog2inforunner.h" #include <projectexplorer/devicesupport/deviceusedportsgatherer.h> -#include <projectexplorer/kitinformation.h> -#include <projectexplorer/target.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> #include <qmldebug/qmldebugcommandlinearguments.h> -#include <qmldebug/qmloutputparser.h> - -#include <ssh/sshconnection.h> using namespace ProjectExplorer; using namespace Utils; @@ -53,30 +46,27 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl) setId("QnxQmlProfilerSupport"); appendMessage(tr("Preparing remote side..."), Utils::LogMessageFormat); - m_portsGatherer = new PortsGatherer(runControl); - addStartDependency(m_portsGatherer); + auto portsGatherer = new PortsGatherer(runControl); + addStartDependency(portsGatherer); auto slog2InfoRunner = new Slog2InfoRunner(runControl); addStartDependency(slog2InfoRunner); - m_profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER); - m_profiler->addStartDependency(this); - addStopDependency(m_profiler); -} - -void QnxQmlProfilerSupport::start() -{ - const QUrl serverUrl = m_portsGatherer->findEndPoint(); - m_profiler->recordData("QmlServerUrl", serverUrl); + auto profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER); + profiler->addStartDependency(this); + addStopDependency(profiler); - Runnable r = runnable(); - QtcProcess::addArg(&r.commandLineArguments, - QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl), - device()->osType()); + setStarter([this, runControl, portsGatherer, profiler] { + const QUrl serverUrl = portsGatherer->findEndPoint(); + profiler->recordData("QmlServerUrl", serverUrl); - setRunnable(r); + Runnable r = runControl->runnable(); + QtcProcess::addArg(&r.commandLineArguments, + QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl), + Utils::OsTypeOtherUnix); - SimpleTargetRunner::start(); + doStart(r, runControl->device()); + }); } } // namespace Internal diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h index 415459e3c1..bcf92ae0a0 100644 --- a/src/plugins/qnx/qnxanalyzesupport.h +++ b/src/plugins/qnx/qnxanalyzesupport.h @@ -25,24 +25,15 @@ #pragma once -#include <projectexplorer/devicesupport/deviceusedportsgatherer.h> -#include <projectexplorer/runconfiguration.h> +#include <projectexplorer/runcontrol.h> namespace Qnx { namespace Internal { class QnxQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner { - Q_OBJECT - public: explicit QnxQmlProfilerSupport(ProjectExplorer::RunControl *runControl); - -private: - void start() override; - - ProjectExplorer::PortsGatherer *m_portsGatherer; - ProjectExplorer::RunWorker *m_profiler; }; } // namespace Internal diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index 8b5cde356a..54a0c5c223 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -97,34 +97,28 @@ class QnxDebuggeeRunner : public ProjectExplorer::SimpleTargetRunner { public: QnxDebuggeeRunner(RunControl *runControl, GdbServerPortsGatherer *portsGatherer) - : SimpleTargetRunner(runControl), m_portsGatherer(portsGatherer) + : SimpleTargetRunner(runControl) { setId("QnxDebuggeeRunner"); - } -private: - void start() final - { - Runnable r = runnable(); - QStringList arguments; - if (m_portsGatherer->useGdbServer()) { - int pdebugPort = m_portsGatherer->gdbServer().port(); - r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE); - arguments.append(QString::number(pdebugPort)); - } - if (m_portsGatherer->useQmlServer()) { - arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, - m_portsGatherer->qmlServer())); - } - arguments.append(QtcProcess::splitArgs(r.commandLineArguments)); - r.commandLineArguments = QtcProcess::joinArgs(arguments); - - setRunnable(r); - - SimpleTargetRunner::start(); + setStarter([this, runControl, portsGatherer] { + Runnable r = runControl->runnable(); + QStringList arguments; + if (portsGatherer->useGdbServer()) { + int pdebugPort = portsGatherer->gdbServer().port(); + r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE); + arguments.append(QString::number(pdebugPort)); + } + if (portsGatherer->useQmlServer()) { + arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, + portsGatherer->qmlServer())); + } + arguments.append(QtcProcess::splitArgs(r.commandLineArguments)); + r.commandLineArguments = QtcProcess::joinArgs(arguments); + + doStart(r, runControl->device()); + }); } - - GdbServerPortsGatherer *m_portsGatherer; }; @@ -197,26 +191,20 @@ class PDebugRunner : public ProjectExplorer::SimpleTargetRunner { public: PDebugRunner(RunControl *runControl, GdbServerPortsGatherer *portsGatherer) - : SimpleTargetRunner(runControl), m_portsGatherer(portsGatherer) + : SimpleTargetRunner(runControl) { setId("PDebugRunner"); - addStartDependency(m_portsGatherer); - } + addStartDependency(portsGatherer); -private: - void start() final - { - const int pdebugPort = m_portsGatherer->gdbServer().port(); - - Runnable r; - r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE); - r.commandLineArguments = QString::number(pdebugPort); - setRunnable(r); + setStarter([this, runControl, portsGatherer] { + const int pdebugPort = portsGatherer->gdbServer().port(); - SimpleTargetRunner::start(); + Runnable r; + r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE); + r.commandLineArguments = QString::number(pdebugPort); + doStart(r, runControl->device()); + }); } - - GdbServerPortsGatherer *m_portsGatherer; }; QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl) |