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

Unified Diff: include/gpu/GrGpuResource.h

Issue 796163002: Adding a custom data field to GrGpuResource (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ref Created 6 years 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 | « no previous file | src/gpu/GrGpuResource.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 4670d911a66543fcbdbedefdb681e6dd4ae18cbd..338e161ac3864c96018baf3b6208018fb9eb490b 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -10,6 +10,7 @@
#include "GrResourceKey.h"
#include "GrTypesPriv.h"
+#include "SkData.h"
#include "SkInstCnt.h"
#include "SkTInternalLList.h"
@@ -168,6 +169,20 @@ public:
uint32_t getUniqueID() const { return fUniqueID; }
/**
+ * Attach a custom data object to this resource. The data will remain attached
+ * for the lifetime of this resource (until it is abandoned or released).
+ * Takes a ref on data. Previously attached data, if any, is unrefed.
+ * Returns the data argument, for convenience.
+ */
+ const SkData* setCustomData(const SkData* data);
+
+ /**
+ * Returns the custom data object that was attached to this resource by
+ * calling setCustomData.
+ */
+ const SkData* getCustomData() const { return fData.get(); }
+
+ /**
* Internal-only helper class used for cache manipulations of the reosurce.
*/
class CacheAccess;
@@ -272,6 +287,8 @@ private:
uint32_t fFlags;
const uint32_t fUniqueID;
+ SkAutoTUnref<const SkData> fData;
+
typedef GrIORef<GrGpuResource> INHERITED;
friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
};
« no previous file with comments | « no previous file | src/gpu/GrGpuResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698