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

Unified Diff: src/gpu/gl/GrGLTextureRenderTarget.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/gl/GrGLTextureRenderTarget.h ('k') | src/gpu/gl/GrGLVertexBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLTextureRenderTarget.cpp
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.cpp b/src/gpu/gl/GrGLTextureRenderTarget.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b6068a4e56efc5b250872df3ed7931251357d034
--- /dev/null
+++ b/src/gpu/gl/GrGLTextureRenderTarget.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrGLTextureRenderTarget.h"
+
+#include "SkTraceMemoryDump.h"
+
+// GrGLTextureRenderTarget must dump both of its superclasses.
+void GrGLTextureRenderTarget::dumpMemoryStatistics(
+ SkTraceMemoryDump* traceMemoryDump) const {
+ GrGLRenderTarget::dumpMemoryStatistics(traceMemoryDump);
+
+ // Also dump the GrGLTexture's memory. Due to this resource having both a
+ // texture and a
+ // renderbuffer component, dump as skia/gpu_resources/resource_#/texture
+ SkString dumpName("skia/gpu_resources/resource_");
+ dumpName.appendS32(this->getUniqueID());
+ dumpName.append("/texture");
+
+ // Use the texture's gpuMemorySize, not our own, which includes the
+ // renderbuffer as well.
+ size_t size = GrGLTexture::gpuMemorySize();
+
+ traceMemoryDump->dumpNumericValue(dumpName.c_str(), "size", "bytes", size);
+
+ if (this->isPurgeable()) {
+ traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size",
+ "bytes", size);
+ }
+
+ SkString texture_id;
+ texture_id.appendU32(this->textureID());
+ traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture",
+ texture_id.c_str());
+}
« no previous file with comments | « src/gpu/gl/GrGLTextureRenderTarget.h ('k') | src/gpu/gl/GrGLVertexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698