forked from qt-creator/qt-creator
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:
@@ -88,7 +88,6 @@ QmlProfilerRunner::~QmlProfilerRunner()
|
||||
|
||||
void QmlProfilerRunner::start()
|
||||
{
|
||||
emit starting(this);
|
||||
if (!d->m_profilerState)
|
||||
QmlProfilerTool::instance()->finalizeRunControl(this);
|
||||
QTC_ASSERT(d->m_profilerState, return);
|
||||
@@ -230,18 +229,20 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q
|
||||
{
|
||||
setId("LocalQmlProfilerSupport");
|
||||
|
||||
auto profiler = new QmlProfilerRunner(runControl);
|
||||
profiler->setServerUrl(serverUrl);
|
||||
connect(profiler, &QmlProfilerRunner::starting,
|
||||
QmlProfilerTool::instance(), &QmlProfilerTool::finalizeRunControl);
|
||||
m_profiler = new QmlProfilerRunner(runControl);
|
||||
m_profiler->setServerUrl(serverUrl);
|
||||
|
||||
addStopDependency(profiler);
|
||||
addStopDependency(m_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(profiler);
|
||||
addStartDependency(m_profiler);
|
||||
}
|
||||
|
||||
void LocalQmlProfilerSupport::start()
|
||||
{
|
||||
Runnable debuggee = runnable();
|
||||
|
||||
QUrl serverUrl = m_profiler->serverUrl();
|
||||
QString code;
|
||||
if (serverUrl.scheme() == Utils::urlSocketScheme())
|
||||
code = QString("file:%1").arg(serverUrl.path());
|
||||
@@ -259,6 +260,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q
|
||||
debuggee.commandLineArguments = arguments;
|
||||
|
||||
setRunnable(debuggee);
|
||||
SimpleTargetRunner::start();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
class QmlProfilerTool;
|
||||
class QmlProfilerRunner : public ProjectExplorer::RunWorker
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -54,9 +53,6 @@ public:
|
||||
void cancelProcess();
|
||||
void notifyRemoteFinished();
|
||||
|
||||
signals:
|
||||
void starting(QmlProfilerRunner *self);
|
||||
|
||||
private:
|
||||
void start() override;
|
||||
void stop() override;
|
||||
@@ -75,6 +71,11 @@ public:
|
||||
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
|
||||
LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl,
|
||||
const QUrl &serverUrl);
|
||||
|
||||
private:
|
||||
void start() override;
|
||||
|
||||
QmlProfilerRunner *m_profiler;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -561,7 +561,6 @@ ProjectExplorer::RunControl *QmlProfilerTool::attachToWaitingApplication()
|
||||
runControl->setRunConfiguration(RunConfiguration::startupRunConfiguration());
|
||||
auto profiler = new QmlProfilerRunner(runControl);
|
||||
profiler->setServerUrl(serverUrl);
|
||||
connect(profiler, &QmlProfilerRunner::starting, this, &QmlProfilerTool::finalizeRunControl);
|
||||
|
||||
connect(d->m_profilerConnections, &QmlProfilerClientManager::connectionClosed,
|
||||
runControl, &RunControl::initiateStop);
|
||||
|
||||
Reference in New Issue
Block a user