Use presence of a content key as non-scratch indicator

BUG=skia:2889

Committed: https://skia.googlesource.com/skia/+/9eefe0851eeaa8ded05b4774ebcb38ed201d5dbf

Review URL: https://codereview.chromium.org/639873002
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index c683b5b..f50ed7d 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -6,13 +6,10 @@
  * found in the LICENSE file.
  */
 
-
-
 #include "GrResourceCache.h"
 #include "GrGpuResource.h"
 #include "GrTexturePriv.h"
 
-
 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage);
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -181,7 +178,7 @@
     // scratch texture reuse is turned off.
     SkASSERT(resource->getCacheEntry());
     if (resource->getCacheEntry()->key().getResourceType() == GrTexturePriv::ResourceType() &&
-        resource->fIsScratch &&
+        resource->getCacheEntry()->key().isScratch() &&
         !fCaps->reuseScratchTextures() &&
         !(static_cast<const GrTexture*>(resource)->desc().fFlags &
           kRenderTarget_GrTextureFlagBit)) {
@@ -190,12 +187,12 @@
 }
 
 GrGpuResource* GrResourceCache::find(const GrResourceKey& key) {
+    // GrResourceCache2 is responsible for scratch resources.
+    SkASSERT(!key.isScratch());
+
     GrAutoResourceCacheValidate atcv(this);
 
-    GrResourceCacheEntry* entry = NULL;
-
-    entry = fCache.find(key);
-
+    GrResourceCacheEntry* entry = fCache.find(key);
     if (NULL == entry) {
         return NULL;
     }
@@ -204,8 +201,6 @@
     this->internalDetach(entry);
     this->attachToHead(entry);
 
-    // GrResourceCache2 is responsible for scratch resources.
-    SkASSERT(GrGpuResource::kNo_IsScratch == entry->resource()->fIsScratch);
     return entry->fResource;
 }