From 455e9153eb13399b1b1b711075d77b699aabfbef Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 19 May 2015 14:50:06 +0200 Subject: 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 --- tools/qmlprofiler/qmlprofilerclient.cpp | 41 ++++----------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) (limited to 'tools/qmlprofiler/qmlprofilerclient.cpp') 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); } -- cgit v1.2.3