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

Unified Diff: include/gpu/GrGpuResource.h

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 | « include/gpu/GrContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrGpuResource.h
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index d726115a7289127e1fd18dcee5810a984774fb8b..8103959984b14ccf5a7fde91783b5a8120eda178 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -15,6 +15,7 @@
class GrContext;
class GrGpu;
class GrResourceCache;
+class SkTraceMemoryDump;
/**
* Base class for GrGpuResource. Handles the various types of refs we need. Separated out as a base
@@ -138,7 +139,7 @@ private:
*/
class SK_API GrGpuResource : public GrIORef<GrGpuResource> {
public:
-
+
enum LifeCycle {
/**
@@ -252,6 +253,13 @@ public:
*/
void abandon();
+ /**
+ * Dumps memory usage information for this GrGpuResource to traceMemoryDump.
+ * Typically, subclasses should not need to override this, and should only
+ * need to override setMemoryBacking.
+ **/
+ virtual void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
+
protected:
// This must be called by every GrGpuObject. It should be called once the object is fully
// initialized (i.e. not in a base class constructor).
@@ -288,6 +296,12 @@ protected:
**/
void setScratchKey(const GrScratchKey& scratchKey);
+ /**
+ * Allows subclasses to add additional backing information to the SkTraceMemoryDump. Called by
+ * onMemoryDump. The default implementation adds no backing information.
+ **/
+ virtual void setMemoryBacking(SkTraceMemoryDump*, const SkString&) const {}
+
private:
/**
* Frees the object in the underlying 3D API. Called by CacheAccess.
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698