ccpr: Cache paths with >=50% visibility

Adds a hit count to cache entries. Paths now don't get stashed until
their second hit (and cached on their third). Mostly-visible, cachable
paths render their entire mask on the second hit, in hopes that we
will be able to cache them alongside the fully visible ones.

Bug: skia:
Change-Id: Idd18f5dc3090f13531f630d229f4808198695fea
Reviewed-on: https://skia-review.googlesource.com/136541
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCCPathCache.h b/src/gpu/ccpr/GrCCPathCache.h
index 0e6f4f0..6315f7c 100644
--- a/src/gpu/ccpr/GrCCPathCache.h
+++ b/src/gpu/ccpr/GrCCPathCache.h
@@ -93,13 +93,21 @@
 };
 
 /**
- * This class stores all the data necessary to draw a specific path from its corresponding cached
- * atlas.
+ * This class stores all the data necessary to draw a specific path + matrix combination from their
+ * corresponding cached atlas.
  */
 class GrCCPathCacheEntry : public SkPathRef::GenIDChangeListener {
 public:
     SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrCCPathCacheEntry);
 
+    // The number of times this specific entry (path + matrix combination) has been pulled from
+    // the path cache. As long as the caller does exactly one lookup per draw, this translates to
+    // the number of times the path has been drawn with a compatible matrix.
+    //
+    // If the entry did not previously exist and was created during
+    // GrCCPathCache::find(.., CreateIfAbsent::kYes), its hit count will be 1.
+    int hitCount() const { return fHitCount; }
+
     // Does this entry reference a permanent, 8-bit atlas that resides in the resource cache?
     // (i.e. not a temporarily-stashed, fp16 coverage count atlas.)
     bool hasCachedAtlas() const { return SkToBool(fCachedAtlasInfo); }
@@ -150,6 +158,7 @@
 
     GrCCPathCache* fCacheWeakPtr;  // Gets manually reset to null by the path cache upon eviction.
     const MaskTransform fMaskTransform;
+    int fHitCount = 1;
 
     GrUniqueKey fAtlasKey;
     SkIVector fAtlasOffset;