move GrTextBlobCache to GrContextThreadSafeProxy

ninja -C out/Release -j 800 skpbench && ./out/Release/skpbench \
--config gl --ddl --src skps/desk_nytimes.skp \
--ddlTilingWidthHeight 3 --gpuThreads 0 \
--pr ~small ~nvpr --cachePathMasks false --comparableDDL
Reports:
with out cl:
1.949     1.842     3.979     1.802      29%       99         50  cpu    ms      gl        desk_nytimes.skp

this cl:
1.476     1.388     3.342     1.365    34.2%       99         50  cpu    ms      gl        desk_nytimes.skp

Non-ddl perf:
./out/Release/skpbench --config gl --ddl --src skps/desk_nytimes.skp \
--ddlTilingWidthHeight 3 --gpuThreads 0 --pr ~small ~nvpr \
--cachePathMasks false --comparableSKP

 1.368      1.31     2.276     1.273    15.3%       99         50  cpu    ms      gl        desk_nytimes.skp

Change-Id: I879f779e34b5c717ab5602f23374aedaff56f96b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299197
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/GrContextThreadSafeProxy.cpp b/src/gpu/GrContextThreadSafeProxy.cpp
index 6fd86bd..4fa6fb7 100644
--- a/src/gpu/GrContextThreadSafeProxy.cpp
+++ b/src/gpu/GrContextThreadSafeProxy.cpp
@@ -37,6 +37,7 @@
 
 void GrContextThreadSafeProxy::init(sk_sp<const GrCaps> caps) {
     fCaps = std::move(caps);
+    fTextBlobCache.reset(new GrTextBlobCache(fContextID));
 }
 
 SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
@@ -127,11 +128,13 @@
 }
 
 void GrContextThreadSafeProxy::abandonContext() {
-    fAbandoned.store(true, std::memory_order_relaxed);
+    if (!fAbandoned.exchange(true)) {
+        fTextBlobCache->freeAll();
+    }
 }
 
 bool GrContextThreadSafeProxy::abandoned() const {
-    return fAbandoned.load(std::memory_order_relaxed);
+    return fAbandoned;
 }
 
 ////////////////////////////////////////////////////////////////////////////////