Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: src/gpu/GrResourceCache.cpp

Issue 1302663003: Sample for GPU memory dumping using new SkTraceMemoryDump. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrResourceCache.cpp
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 7efe62365bf432f112e12e5a01d9b97fa4f7ec98..cd5b3cb7fc2864aef1bce09829ee2a631053b921 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -13,6 +13,7 @@
#include "SkChecksum.h"
#include "SkGr.h"
#include "SkMessageBus.h"
+#include "SkTraceMemoryDump.h"
#include "SkTSort.h"
DECLARE_SKMESSAGEBUS_MESSAGE(GrUniqueKeyInvalidatedMessage);
@@ -560,7 +561,7 @@ uint32_t GrResourceCache::getNextTimestamp() {
int currP = 0;
int currNP = 0;
while (currP < sortedPurgeableResources.count() &&
- currNP < fNonpurgeableResources.count()) {
+ currNP < fNonpurgeableResources.count()) {
uint32_t tsP = sortedPurgeableResources[currP]->cacheAccess().timestamp();
uint32_t tsNP = fNonpurgeableResources[currNP]->cacheAccess().timestamp();
SkASSERT(tsP != tsNP);
@@ -592,10 +593,10 @@ uint32_t GrResourceCache::getNextTimestamp() {
// count should be the next timestamp we return.
SkASSERT(fTimestamp == SkToU32(count));
-
+
// The historical timestamps of flushes are now invalid.
this->resetFlushTimestamps();
- }
+ }
}
return fTimestamp++;
}
@@ -612,6 +613,15 @@ void GrResourceCache::notifyFlushOccurred() {
}
}
+void GrResourceCache::onMemoryDump(SkTraceMemoryDump *traceMemoryDump) const {
+ for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
+ fNonpurgeableResources[i]->onMemoryDump(traceMemoryDump);
+ }
+ for (int i = 0; i < fPurgeableQueue.count(); ++i) {
+ fPurgeableQueue.at(i)->onMemoryDump(traceMemoryDump);
+ }
+}
+
#ifdef SK_DEBUG
void GrResourceCache::validate() const {
// Reduce the frequency of validations for large resource counts.
« no previous file with comments | « src/gpu/GrResourceCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698