diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-01-16 13:18:05 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-22 18:10:19 +0100 |
commit | 2ce7959eb9e69cd68013fc6a0f77a9556a84365b (patch) | |
tree | 64f52ddce97d858c04b69390f504c778bb5ad0c7 /src/quick/util/qquickpixmapcache.cpp | |
parent | b287ed4c4dee9d705073badc79cdb0c3e183d19b (diff) |
Further pack messages for QQmlProfilerService
Allow multiple detailTypes in each packet and extend the profiling code
to make use of that. Note that this changes the usual order of
pixmapSizeKnown and PixmapLoadingFinished events. As far as I can see
this doesn't affect the QML profiler frontend and the order of these
events isn't specified anywhere.
Change-Id: Id39ad98594ccf35add4415e08daf9e92ab561237
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 0260bd1683..af66ef26a4 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -519,7 +519,7 @@ void QQuickPixmapReader::processJobs() runningJob->loading = true; QUrl url = runningJob->url; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingStarted, url)); + Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingStarted>(url)); QSize requestSize = runningJob->requestSize; locker.unlock(); @@ -897,11 +897,10 @@ bool QQuickPixmapReply::event(QEvent *event) if (data->pixmapStatus == QQuickPixmap::Ready) { data->textureFactory = de->textureFactory; data->implicitSize = de->implicitSize; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingFinished, data->url)); - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapSizeKnown, url, + Q_QML_PROFILE(pixmapLoadingFinished(data->url, data->requestSize.width() > 0 ? data->requestSize : data->implicitSize)); } else { - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingError, data->url)); + Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingError>(data->url)); data->errorString = de->errorString; data->removeFromCache(); // We don't continue to cache error'd pixmaps } @@ -927,7 +926,7 @@ int QQuickPixmapData::cost() const void QQuickPixmapData::addref() { ++refCount; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapReferenceCountChanged, url, refCount)); + Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapReferenceCountChanged>(url, refCount)); if (prevUnreferencedPtr) pixmapStore()->referencePixmap(this); } @@ -936,7 +935,7 @@ void QQuickPixmapData::release() { Q_ASSERT(refCount > 0); --refCount; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapReferenceCountChanged, url, refCount)); + Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapReferenceCountChanged>(url, refCount)); if (refCount == 0) { if (reply) { QQuickPixmapReply *cancelReply = reply; @@ -967,7 +966,7 @@ void QQuickPixmapData::addToCache() QQuickPixmapKey key = { &url, &requestSize }; pixmapStore()->m_cache.insert(key, this); inCache = true; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapCacheCountChanged, + Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapCacheCountChanged>( url, pixmapStore()->m_cache.count())); } } @@ -976,7 +975,7 @@ void QQuickPixmapData::removeFromCache() { if (inCache) { QQuickPixmapKey key = { &url, &requestSize }; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapCacheCountChanged, + Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapCacheCountChanged>( url, pixmapStore()->m_cache.count())); pixmapStore()->m_cache.remove(key); inCache = false; @@ -1240,18 +1239,17 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques if (!(options & QQuickPixmap::Asynchronous)) { bool ok = false; - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingStarted, url)); + Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingStarted>(url)); d = createPixmapDataSync(this, engine, url, requestSize, &ok); if (ok) { - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingFinished, url)); - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapSizeKnown, url, + Q_QML_PROFILE(pixmapLoadingFinished(url, d->requestSize.width() > 0 ? d->requestSize : d->implicitSize)); if (options & QQuickPixmap::Cache) d->addToCache(); return; } if (d) { // loadable, but encountered error while loading - Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingError, url)); + Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingError>(url)); return; } } |