Add getContext to GrResouce
http://codereview.appspot.com/5373106/
git-svn-id: http://skia.googlecode.com/svn/trunk@2688 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index 0d15fe9..e003353 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -13,6 +13,7 @@
#include "GrRefCnt.h"
class GrGpu;
+class GrContext;
class GrResource : public GrRefCnt {
public:
@@ -55,6 +56,15 @@
*/
virtual size_t sizeInBytes() const = 0;
+ /**
+ * Retrieves the context that owns the resource. Note that it is possible
+ * for this to return NULL. When resources have been release()ed or
+ * abandon()ed they no longer have an unknowning context. Destroying a
+ * GrContext automatically releases all its resources.
+ */
+ const GrContext* getContext() const;
+ GrContext* getContext();
+
protected:
virtual void onRelease() = 0;