diff options
author | Christiaan Janssen <christiaan.janssen@digia.com> | 2012-10-24 16:09:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-30 13:07:16 +0200 |
commit | 107444f7c479ed6a1a3d2c42b026ebc9c1fe4b29 (patch) | |
tree | 1b2d5de24ac315fc1e57beeb38d0fed141fafab6 /src/qml/debugger/qqmlprofilerservice_p.h | |
parent | 3b0a9b27fec09cdab4cde7bfc41578c8c17a8832 (diff) |
QmlProfiler: Pixmap Cache
Change-Id: Ibc237bb162c24030438b89d54fa8802ee66b080a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src/qml/debugger/qqmlprofilerservice_p.h')
-rw-r--r-- | src/qml/debugger/qqmlprofilerservice_p.h | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index a50fb5ea08..30eb2ebbf4 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -74,10 +74,10 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData //### QString detailData; //used by RangeData and RangeLocation - int line; //used by RangeLocation - int column; //used by RangeLocation + int line; //used by RangeLocation, also as "width" for pixmaps + int column; //used by RangeLocation, also as "height" for pixmaps int framerate; //used by animation events - int animationcount; //used by animation events + int animationcount; //used by animation events, also as "cache/reference count" for pixmaps int bindingType; QByteArray toByteArray() const; @@ -99,6 +99,7 @@ public: RangeLocation, RangeEnd, Complete, // end of transmission + PixmapCacheEvent, MaximumMessage }; @@ -132,6 +133,17 @@ public: MaximumBindingType }; + enum PixmapEventType { + PixmapSizeKnown, + PixmapReferenceCountChanged, + PixmapCacheCountChanged, + PixmapLoadingStarted, + PixmapLoadingFinished, + PixmapLoadingError, + + MaximumPixmapEventType + }; + static void initialize(); static bool startProfiling(); @@ -163,6 +175,10 @@ private: void rangeLocation(RangeType, const QUrl &, int, int); void endRange(RangeType); + // overloading depending on parameters + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url); + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height); + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count); bool profilingEnabled(); void setProfilingEnabled(bool enable); @@ -183,6 +199,7 @@ private: friend struct QQmlHandlingSignalProfiler; friend struct QQmlObjectCreatingProfiler; friend struct QQmlCompilingProfiler; + friend struct QQmlPixmapProfiler; }; // @@ -288,6 +305,49 @@ struct QQmlCompilingProfiler { bool enabled; }; +struct QQmlPixmapProfiler { + QQmlPixmapProfiler() { + QQmlProfilerService *instance = QQmlProfilerService::instance; + enabled = instance ? + instance->profilingEnabled() : false; + } + + ~QQmlPixmapProfiler() {} + + void startLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl); + } + } + void finishLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl); + } + } + void errorLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl); + } + } + void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount); + } + } + void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount); + } + } + void setSize(const QUrl &pixmapUrl, int width, int height) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, width, height); + } + } + + bool enabled; +}; + QT_END_NAMESPACE #endif // QQMLPROFILERSERVICE_P_H |