Refcount SkStrikeCache Nodes

Change-Id: I3566345b8518b15603d6089626a7c3b493f8af17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270438
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkStrikeCache.cpp b/src/core/SkStrikeCache.cpp
index ecc95f5..986e7a1 100644
--- a/src/core/SkStrikeCache.cpp
+++ b/src/core/SkStrikeCache.cpp
@@ -10,6 +10,7 @@
 #include <cctype>
 
 #include "include/core/SkGraphics.h"
+#include "include/core/SkRefCnt.h"
 #include "include/core/SkTraceMemoryDump.h"
 #include "include/core/SkTypeface.h"
 #include "include/private/SkMutex.h"
@@ -17,7 +18,7 @@
 #include "src/core/SkGlyphRunPainter.h"
 #include "src/core/SkStrike.h"
 
-class SkStrikeCache::Node final : public SkStrikeForGPU {
+class SkStrikeCache::Node final : public SkRefCnt, public SkStrikeForGPU {
 public:
     Node(SkStrikeCache* strikeCache,
          const SkDescriptor& desc,
@@ -135,7 +136,7 @@
     Node* node = fHead;
     while (node) {
         Node* next = node->fNext;
-        delete node;
+        node->unref();
         node = next;
     }
 }
@@ -398,7 +399,7 @@
             bytesFreed += node->fStrike.getMemoryUsed();
             countFreed += 1;
             this->internalDetachCache(node);
-            delete node;
+            node->unref();
         }
         node = prev;
     }