Allow custom resources in the GrContext's cache

Adds methods to GrContext for client code to store custom resources in
the cache.

BUG=skia:
R=bsalomon@google.com

Author: cdalton@nvidia.com

Review URL: https://codereview.chromium.org/261593009

git-svn-id: http://skia.googlecode.com/svn/trunk/include@14577 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/GrContext.h b/gpu/GrContext.h
index 4d0a94e..195ab72 100644
--- a/gpu/GrContext.h
+++ b/gpu/GrContext.h
@@ -899,6 +899,17 @@
                     GrPathRendererChain::DrawType drawType = GrPathRendererChain::kColor_DrawType,
                     GrPathRendererChain::StencilSupport* stencilSupport = NULL);
 
+    /**
+     * Stores a custom resource in the cache, based on the specified key.
+     */
+    void addResourceToCache(const GrResourceKey&, GrCacheable*);
+
+    /**
+     * Finds a resource in the cache, based on the specified key. This is intended for use in
+     * conjunction with addResourceToCache(). The return value will be NULL if not found. The
+     * caller must balance with a call to unref().
+     */
+    GrCacheable* findAndRefCachedResource(const GrResourceKey&);
 
 #if GR_CACHE_STATS
     void printCacheStats() const;