diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-05-19 14:50:06 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-05-21 12:54:42 +0000 |
commit | 455e9153eb13399b1b1b711075d77b699aabfbef (patch) | |
tree | beedf6ec92f7bc63dd5a23897d8a4f8b8807a543 /tools/qmlprofiler/qmlprofilerclient.cpp | |
parent | bb085ff9272acd1ee8cb52d0c7b1e2d2a9116878 (diff) |
qmlprofiler: Clean up recording state mess
The recording state is a global property of the profiler client, it has
to match the application's recording status as well as possible, and
the user can set an initial target value with a command line parameter.
This way we don't get strange error messages when the application quits
by itself and properly sends all the data before.
Task-number: QTBUG-43066
Change-Id: Id93aa7fb940f870c8f16cea8427c38aab450f864
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tools/qmlprofiler/qmlprofilerclient.cpp')
-rw-r--r-- | tools/qmlprofiler/qmlprofilerclient.cpp | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp index 711ddbd862..b752a75941 100644 --- a/tools/qmlprofiler/qmlprofilerclient.cpp +++ b/tools/qmlprofiler/qmlprofilerclient.cpp @@ -39,17 +39,12 @@ ProfilerClient::ProfilerClient(const QString &clientName, QQmlDebugConnection *client) : QQmlDebugClient(clientName, client), - m_recording(false), m_enabled(false) { } ProfilerClient::~ProfilerClient() { - //Disable profiling if started by client - //Profiling data will be lost!! - if (isRecording()) - setRecording(false); } void ProfilerClient::clearData() @@ -62,29 +57,6 @@ bool ProfilerClient::isEnabled() const return m_enabled; } -void ProfilerClient::sendRecordingStatus() -{ -} - -bool ProfilerClient::isRecording() const -{ - return m_recording; -} - -void ProfilerClient::setRecording(bool v) -{ - if (v == m_recording) - return; - - m_recording = v; - - if (state() == Enabled) { - sendRecordingStatus(); - } - - emit recordingChanged(v); -} - void ProfilerClient::stateChanged(State status) { if ((m_enabled && status != Enabled) || @@ -135,11 +107,11 @@ void QmlProfilerClient::clearData() ProfilerClient::clearData(); } -void QmlProfilerClient::sendRecordingStatus() +void QmlProfilerClient::sendRecordingStatus(bool record) { QByteArray ba; QDataStream stream(&ba, QIODevice::WriteOnly); - stream << isRecording(); + stream << record; sendMessage(ba); } @@ -296,19 +268,14 @@ V8ProfilerClient::~V8ProfilerClient() { } -void V8ProfilerClient::sendRecordingStatus() +void V8ProfilerClient::sendRecordingStatus(bool record) { QByteArray ba; QDataStream stream(&ba, QIODevice::WriteOnly); QByteArray cmd("V8PROFILER"); - QByteArray option(""); + QByteArray option(record ? "start" : "stop"); QByteArray title(""); - if (m_recording) { - option = "start"; - } else { - option = "stop"; - } stream << cmd << option << title; sendMessage(ba); } |