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

Unified Diff: src/gpu/GrGpuResource.cpp

Issue 1313743002: Add onMemoryDump to GrContext (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Small build fix Created 5 years, 3 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/GrContext.cpp ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpuResource.cpp
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index df8301c506bad4544b159a85efb2c7447969917a..f8cb529314daa6b963d080755047bf82a2911576 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -11,6 +11,7 @@
#include "GrResourceCache.h"
#include "GrGpu.h"
#include "GrGpuResourcePriv.h"
+#include "SkTraceMemoryDump.h"
static inline GrResourceCache* get_resource_cache(GrGpu* gpu) {
SkASSERT(gpu);
@@ -52,6 +53,23 @@ void GrGpuResource::abandon() {
fGpuMemorySize = 0;
}
+void GrGpuResource::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
+ // Dump resource as "skia/gpu_resources/resource_#".
+ SkString dumpName("skia/gpu_resources/resource_");
+ dumpName.appendS32(this->getUniqueID());
+
+ traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", this->gpuMemorySize());
+
+ if (this->isPurgeable()) {
+ traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "bytes",
+ this->gpuMemorySize());
+ }
+
+ // Call setMemoryBacking to allow sub-classes with implementation specific backings (such as GL
+ // objects) to provide additional information.
+ this->setMemoryBacking(traceMemoryDump, dumpName);
+}
+
const SkData* GrGpuResource::setCustomData(const SkData* data) {
SkSafeRef(data);
fData.reset(data);
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698