Add GrResourceCache2.

Currently it just replaces GrGpu as the owner of the linked list of resources.

Committed: https://skia.googlesource.com/skia/+/94ce9ac8624dbb45656b8f5c992fad9c9ff3ee5f

R=mtklein@google.com, robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/481443002
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 8c2dc45..7a19c25 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -8,19 +8,27 @@
 
 
 #include "GrGpuResource.h"
+#include "GrResourceCache2.h"
 #include "GrGpu.h"
 
+static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
+    SkASSERT(NULL != gpu);
+    SkASSERT(NULL != gpu->getContext());
+    SkASSERT(NULL != gpu->getContext()->getResourceCache2());
+    return gpu->getContext()->getResourceCache2();
+}
+
 GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
-    : fRefCnt(1)
+    : fGpu(gpu)
+    , fRefCnt(1)
     , fCacheEntry(NULL)
     , fUniqueID(CreateUniqueID()) {
-    fGpu              = gpu;
     if (isWrapped) {
         fFlags = kWrapped_FlagBit;
     } else {
         fFlags = 0;
     }
-    fGpu->insertObject(this);
+    get_resource_cache2(fGpu)->insertResource(this);
 }
 
 GrGpuResource::~GrGpuResource() {
@@ -32,7 +40,7 @@
 void GrGpuResource::release() {
     if (NULL != fGpu) {
         this->onRelease();
-        fGpu->removeObject(this);
+        get_resource_cache2(fGpu)->removeResource(this);
         fGpu = NULL;
     }
 }
@@ -40,7 +48,7 @@
 void GrGpuResource::abandon() {
     if (NULL != fGpu) {
         this->onAbandon();
-        fGpu->removeObject(this);
+        get_resource_cache2(fGpu)->removeResource(this);
         fGpu = NULL;
     }
 }