diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:26:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:48:46 +0200 |
commit | 1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch) | |
tree | b2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /src/quick/util/qquickpixmapcache.cpp | |
parent | 8217ec1b888f3ff93f004801b018c5f85362c484 (diff) | |
parent | e1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/imports/qtquick2/plugins.qmltypes
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qml.pri
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4irbuilder.cpp
src/qml/qml/v4/qv4jsonobject_p.h
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8listwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/qv8sequencewrapper_p_p.h
src/qml/qml/v8/qv8typewrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcanvasitem.cpp
src/quick/items/context2d/qquickcontext2d.cpp
sync.profile
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/benchmarks/qml/animation/animation.pro
tools/qmlprofiler/qmlprofiler.pro
Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'src/quick/util/qquickpixmapcache.cpp')
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index c5968c2bc1..9cf8c5812d 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -71,6 +71,8 @@ #include <QQmlFile> #include <QMetaMethod> +#include <private/qqmlprofilerservice_p.h> + #define IMAGEREQUEST_MAX_REQUEST_COUNT 8 #define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16 #define CACHE_EXPIRE_TIME 30 @@ -890,11 +892,15 @@ bool QQuickPixmapReply::event(QEvent *event) if (data) { Event *de = static_cast<Event *>(event); data->pixmapStatus = (de->error == NoError) ? QQuickPixmap::Ready : QQuickPixmap::Error; - + QQmlPixmapProfiler pixmapProfiler; if (data->pixmapStatus == QQuickPixmap::Ready) { + pixmapProfiler.finishLoading(data->url); data->textureFactory = de->textureFactory; data->implicitSize = de->implicitSize; + if (data->implicitSize.width() > 0) + pixmapProfiler.setSize(url, data->implicitSize.width(), data->implicitSize.height()); } else { + pixmapProfiler.errorLoading(data->url); data->errorString = de->errorString; data->removeFromCache(); // We don't continue to cache error'd pixmaps } @@ -920,6 +926,7 @@ int QQuickPixmapData::cost() const void QQuickPixmapData::addref() { ++refCount; + QQmlPixmapProfiler().referenceCountChanged(url, refCount); if (prevUnreferencedPtr) pixmapStore()->referencePixmap(this); } @@ -928,6 +935,7 @@ void QQuickPixmapData::release() { Q_ASSERT(refCount > 0); --refCount; + QQmlPixmapProfiler().referenceCountChanged(url, refCount); if (refCount == 0) { if (reply) { QQuickPixmapReply *cancelReply = reply; @@ -958,6 +966,10 @@ void QQuickPixmapData::addToCache() QQuickPixmapKey key = { &url, &requestSize }; pixmapStore()->m_cache.insert(key, this); inCache = true; + QQmlPixmapProfiler pixmapProfiler; + pixmapProfiler.cacheCountChanged(url, pixmapStore()->m_cache.count()); + if (implicitSize.width() > 0) + pixmapProfiler.setSize(url, implicitSize.width(), implicitSize.height()); } } @@ -965,6 +977,7 @@ void QQuickPixmapData::removeFromCache() { if (inCache) { QQuickPixmapKey key = { &url, &requestSize }; + QQmlPixmapProfiler().cacheCountChanged(url, pixmapStore()->m_cache.count()); pixmapStore()->m_cache.remove(key); inCache = false; } @@ -1238,14 +1251,21 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques if (!(options & QQuickPixmap::Asynchronous)) { bool ok = false; + QQmlPixmapProfiler pixmapProfiler; + pixmapProfiler.startLoading(url); d = createPixmapDataSync(this, engine, url, requestSize, &ok); if (ok) { + pixmapProfiler.finishLoading(url); + if (d->implicitSize.width() > 0) + QQmlPixmapProfiler().setSize(url, d->implicitSize.width(), d->implicitSize.height()); if (options & QQuickPixmap::Cache) d->addToCache(); return; } - if (d) // loadable, but encountered error while loading + if (d) { // loadable, but encountered error while loading + pixmapProfiler.errorLoading(url); return; + } } if (!engine) |