diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2012-02-29 14:59:49 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-02 16:19:16 +0100 |
commit | 181545935323c74c2ec9c5a89ff51606008e30c0 (patch) | |
tree | b3af37be114290596ffebd49f33dfff65a64a606 /src/declarative/debugger/qdeclarativeprofilerservice.cpp | |
parent | d290cb3a499a0c3a71ab1f63cbd2fc45b0f5835f (diff) |
Profiler: Use RAII helper structs for ranges
Exclusively use RAII helper structs for ranges.
Change-Id: Ief9ab25a9e49e1b2c3c091e5d9de6479e36eaa50
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'src/declarative/debugger/qdeclarativeprofilerservice.cpp')
-rw-r--r-- | src/declarative/debugger/qdeclarativeprofilerservice.cpp | 57 |
1 files changed, 10 insertions, 47 deletions
diff --git a/src/declarative/debugger/qdeclarativeprofilerservice.cpp b/src/declarative/debugger/qdeclarativeprofilerservice.cpp index 074355fe97..3ad87495bb 100644 --- a/src/declarative/debugger/qdeclarativeprofilerservice.cpp +++ b/src/declarative/debugger/qdeclarativeprofilerservice.cpp @@ -52,23 +52,10 @@ QT_BEGIN_NAMESPACE +// instance will be set, unset in constructor. Allows static methods to be inlined. +QDeclarativeProfilerService *QDeclarativeProfilerService::instance = 0; Q_GLOBAL_STATIC(QDeclarativeProfilerService, profilerInstance) -QDeclarativeBindingProfiler::QDeclarativeBindingProfiler(const QString &url, int line, int column) -{ - QDeclarativeProfilerService::startRange(QDeclarativeProfilerService::Binding); - QDeclarativeProfilerService::rangeLocation(QDeclarativeProfilerService::Binding, url, line, column); -} - -QDeclarativeBindingProfiler::~QDeclarativeBindingProfiler() -{ - QDeclarativeProfilerService::endRange(QDeclarativeProfilerService::Binding); -} - -void QDeclarativeBindingProfiler::addDetail(const QString &details) -{ - QDeclarativeProfilerService::rangeData(QDeclarativeProfilerService::Binding, details); -} // convert to a QByteArray that can be sent to the debug client // use of QDataStream can skew results @@ -106,12 +93,13 @@ QDeclarativeProfilerService::QDeclarativeProfilerService() QDeclarativeProfilerService::~QDeclarativeProfilerService() { + instance = 0; } void QDeclarativeProfilerService::initialize() { // just make sure that the service is properly registered - profilerInstance(); + instance = profilerInstance(); } bool QDeclarativeProfilerService::startProfiling() @@ -134,31 +122,6 @@ void QDeclarativeProfilerService::addEvent(EventType t) profilerInstance()->addEventImpl(t); } -void QDeclarativeProfilerService::startRange(RangeType t) -{ - profilerInstance()->startRangeImpl(t); -} - -void QDeclarativeProfilerService::rangeData(RangeType t, const QString &data) -{ - profilerInstance()->rangeDataImpl(t, data); -} - -void QDeclarativeProfilerService::rangeLocation(RangeType t, const QString &fileName, int line, int column) -{ - profilerInstance()->rangeLocationImpl(t, fileName, line, column); -} - -void QDeclarativeProfilerService::rangeLocation(RangeType t, const QUrl &fileName, int line, int column) -{ - profilerInstance()->rangeLocationImpl(t, fileName, line, column); -} - -void QDeclarativeProfilerService::endRange(RangeType t) -{ - profilerInstance()->endRangeImpl(t); -} - void QDeclarativeProfilerService::animationFrame(qint64 delta) { profilerInstance()->animationFrameImpl(delta); @@ -209,7 +172,7 @@ void QDeclarativeProfilerService::addEventImpl(EventType event) processMessage(ed); } -void QDeclarativeProfilerService::startRangeImpl(RangeType range) +void QDeclarativeProfilerService::startRange(RangeType range) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -218,7 +181,7 @@ void QDeclarativeProfilerService::startRangeImpl(RangeType range) processMessage(rd); } -void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QString &rData) +void QDeclarativeProfilerService::rangeData(RangeType range, const QString &rData) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -227,7 +190,7 @@ void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QString & processMessage(rd); } -void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QUrl &rData) +void QDeclarativeProfilerService::rangeData(RangeType range, const QUrl &rData) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -236,7 +199,7 @@ void QDeclarativeProfilerService::rangeDataImpl(RangeType range, const QUrl &rDa processMessage(rd); } -void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QString &fileName, int line, int column) +void QDeclarativeProfilerService::rangeLocation(RangeType range, const QString &fileName, int line, int column) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -245,7 +208,7 @@ void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QStri processMessage(rd); } -void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QUrl &fileName, int line, int column) +void QDeclarativeProfilerService::rangeLocation(RangeType range, const QUrl &fileName, int line, int column) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; @@ -254,7 +217,7 @@ void QDeclarativeProfilerService::rangeLocationImpl(RangeType range, const QUrl processMessage(rd); } -void QDeclarativeProfilerService::endRangeImpl(RangeType range) +void QDeclarativeProfilerService::endRange(RangeType range) { if (!QDeclarativeDebugService::isDebuggingEnabled() || !m_enabled) return; |