aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2017-05-29 16:04:31 +0200
committerhjk <hjk@qt.io>2017-06-12 06:24:36 +0000
commit1a82bedc8b34db2a43e59f408cade6fe22f064b4 (patch)
tree7c2e3468f458b9febfe1871e9c126c11b3546368 /src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
parent8116cb39e114bf50ffa4917dbdedbb1bb06a51bb (diff)
QmlProfiler: Merge LocalQmlProfilerRunner and QmlProfilerRunner
Also streamline code paths in the result. Change-Id: Id7d96343a8f778ba8f415b1a850cc78576afa475 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/localqmlprofilerrunner.cpp')
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.cpp167
1 files changed, 0 insertions, 167 deletions
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
deleted file mode 100644
index bd3fe0aa95..0000000000
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "localqmlprofilerrunner.h"
-#include "qmlprofilerplugin.h"
-#include "qmlprofilerruncontrol.h"
-
-#include <projectexplorer/runconfiguration.h>
-#include <projectexplorer/environmentaspect.h>
-#include <projectexplorer/devicesupport/idevice.h>
-#include <projectexplorer/kitinformation.h>
-#include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/target.h>
-
-#include <qmldebug/qmldebugcommandlinearguments.h>
-
-#include <utils/temporaryfile.h>
-
-#include <QTcpServer>
-#include <QTemporaryFile>
-
-using namespace ProjectExplorer;
-
-namespace QmlProfiler {
-
-QString LocalQmlProfilerRunner::findFreeSocket()
-{
- Utils::TemporaryFile file("qmlprofiler-freesocket");
- if (file.open()) {
- return file.fileName();
- } else {
- qWarning() << "Could not open a temporary file to find a debug socket.";
- return QString();
- }
-}
-
-Utils::Port LocalQmlProfilerRunner::findFreePort(QString &host)
-{
- QTcpServer server;
- if (!server.listen(QHostAddress::LocalHost)
- && !server.listen(QHostAddress::LocalHostIPv6)) {
- qWarning() << "Cannot open port on host for QML profiling.";
- return Utils::Port();
- }
- host = server.serverAddress().toString();
- return Utils::Port(server.serverPort());
-}
-
-LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
- QmlProfilerRunner *runner) :
- QObject(runner->runControl()),
- m_runControl(runner->runControl()),
- m_configuration(configuration)
-{
- auto runControl = runner->runControl();
- connect(&m_launcher, &ApplicationLauncher::appendMessage,
- this, &LocalQmlProfilerRunner::appendMessage);
- connect(this, &LocalQmlProfilerRunner::stopped,
- runner, &QmlProfilerRunner::notifyRemoteFinished);
- connect(this, &LocalQmlProfilerRunner::appendMessage,
- runControl, &RunControl::appendMessage);
- connect(runControl, &RunControl::starting,
- this, &LocalQmlProfilerRunner::start);
- connect(runControl, &RunControl::finished,
- this, &LocalQmlProfilerRunner::stop);
-
- m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput());
-
- connect(runControl, &RunControl::appendMessageRequested,
- this, [this](RunControl *runControl, const QString &msg, Utils::OutputFormat format) {
- Q_UNUSED(runControl);
- Q_UNUSED(format);
- m_outputParser.processOutput(msg);
- });
-
- connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
- runControl, [this, runControl, runner](Utils::Port port) {
- runControl->notifyRemoteSetupDone(port);
- runner->notifyRemoteSetupDone(port);
- });
-
- connect(&m_outputParser, &QmlDebug::QmlOutputParser::noOutputMessage,
- runControl, [this, runControl, runner]() {
- runControl->notifyRemoteSetupDone(Utils::Port());
- runner->notifyRemoteSetupDone(Utils::Port());
- });
-
- connect(&m_outputParser, &QmlDebug::QmlOutputParser::connectingToSocketMessage,
- runControl, [this, runControl, runner]() {
- runControl->notifyRemoteSetupDone(Utils::Port());
- runner->notifyRemoteSetupDone(Utils::Port());
- });
-
- connect(&m_outputParser, &QmlDebug::QmlOutputParser::errorMessage,
- runControl, [this, runControl, runner](const QString &message) {
- runControl->notifyRemoteSetupFailed(message);
- runner->notifyRemoteSetupFailed(message);
- });
-}
-
-void LocalQmlProfilerRunner::start()
-{
- QTC_ASSERT(!m_configuration.socket.isEmpty() || m_configuration.port.isValid(), return);
-
- StandardRunnable runnable = m_configuration.debuggee;
- QString arguments = m_configuration.socket.isEmpty() ?
- QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices,
- m_configuration.port) :
- QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlProfilerServices,
- m_configuration.socket);
-
-
- if (!m_configuration.debuggee.commandLineArguments.isEmpty())
- arguments += QLatin1Char(' ') + m_configuration.debuggee.commandLineArguments;
-
- runnable.commandLineArguments = arguments;
- runnable.runMode = ApplicationLauncher::Gui;
-
- // queue this, as the process can already die in the call to start().
- // We want the started() signal to be emitted before the stopped() signal.
- connect(&m_launcher, &ApplicationLauncher::processExited,
- this, &LocalQmlProfilerRunner::spontaneousStop,
- Qt::QueuedConnection);
- m_launcher.start(runnable);
-
- emit started();
-}
-
-void LocalQmlProfilerRunner::spontaneousStop(int exitCode, QProcess::ExitStatus status)
-{
- Q_UNUSED(exitCode);
- Q_UNUSED(status);
- disconnect(&m_launcher, &ApplicationLauncher::processExited,
- this, &LocalQmlProfilerRunner::spontaneousStop);
-
- emit stopped();
-}
-
-void LocalQmlProfilerRunner::stop()
-{
- if (m_launcher.isRunning())
- m_launcher.stop();
-}
-
-} // namespace QmlProfiler