aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlprofiler/qmlprofilerclient.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-15 15:14:40 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-10-15 08:23:29 +0000
commitd56286283dc41d1e97502f48ded754c059951060 (patch)
tree42285d61fb81cc73f403d41e16a9aaf3a40bfe46 /tools/qmlprofiler/qmlprofilerclient.cpp
parent2f03049d4cabfac822bcf6b5886b078d70064968 (diff)
qmlprofiler: Simplify QmlProfilerClient
We only need one class for it now. Change-Id: Iea2715993c0ce168a3ceeecbb694f1ad3585da68 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tools/qmlprofiler/qmlprofilerclient.cpp')
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.cpp54
1 files changed, 17 insertions, 37 deletions
diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp
index ff723381bc..bd7b98379f 100644
--- a/tools/qmlprofiler/qmlprofilerclient.cpp
+++ b/tools/qmlprofiler/qmlprofilerclient.cpp
@@ -39,42 +39,11 @@
#include <limits>
-ProfilerClient::ProfilerClient(const QString &clientName,
- QQmlDebugConnection *client)
- : QQmlDebugClient(clientName, client),
- m_enabled(false)
-{
-}
-
-ProfilerClient::~ProfilerClient()
-{
-}
-
-void ProfilerClient::clearData()
-{
- emit cleared();
-}
-
-bool ProfilerClient::isEnabled() const
-{
- return m_enabled;
-}
-
-void ProfilerClient::stateChanged(State status)
-{
- if ((m_enabled && status != Enabled) ||
- (!m_enabled && status == Enabled))
- emit enabledChanged();
-
- m_enabled = status == Enabled;
-
-}
-
class QmlProfilerClientPrivate
{
public:
QmlProfilerClientPrivate()
- : inProgressRanges(0) , features(std::numeric_limits<quint64>::max())
+ : inProgressRanges(0) , features(std::numeric_limits<quint64>::max()), enabled(false)
{
::memset(rangeCount, 0, QQmlProfilerDefinitions::MaximumRangeType * sizeof(int));
}
@@ -87,11 +56,11 @@ public:
int rangeCount[QQmlProfilerDefinitions::MaximumRangeType];
quint64 features;
+ bool enabled;
};
-QmlProfilerClient::QmlProfilerClient(
- QQmlDebugConnection *client)
- : ProfilerClient(QStringLiteral("CanvasFrameRate"), client),
+QmlProfilerClient::QmlProfilerClient(QQmlDebugConnection *client)
+ : QQmlDebugClient(QStringLiteral("CanvasFrameRate"), client),
d(new QmlProfilerClientPrivate)
{
}
@@ -108,9 +77,12 @@ void QmlProfilerClient::setFeatures(quint64 features)
void QmlProfilerClient::clearData()
{
- ::memset(d->rangeCount, 0, QQmlProfilerDefinitions::MaximumRangeType * sizeof(int));
+ for (int i = 0; i < QQmlProfilerDefinitions::MaximumRangeType; ++i) {
+ d->rangeCount[i] = 0;
+ d->rangeDatas[i].clear();
+ d->rangeLocations[i].clear();
+ }
d->bindingTypes.clear();
- ProfilerClient::clearData();
}
void QmlProfilerClient::sendRecordingStatus(bool record)
@@ -142,6 +114,14 @@ inline QQmlProfilerDefinitions::ProfileFeature featureFromRangeType(
}
}
+void QmlProfilerClient::stateChanged(State state)
+{
+ if ((d->enabled && state != Enabled) || (!d->enabled && state == Enabled)) {
+ d->enabled = (state == Enabled);
+ emit enabledChanged(d->enabled);
+ }
+}
+
void QmlProfilerClient::messageReceived(const QByteArray &data)
{
QByteArray rwData = data;