Fix GrThreadSafeCache's abandonContext behavior

We need to abandon all the GPU resources before dropping any
refs the thread-safe cache may be holding.

Change-Id: Id1a06adf9e0241bfaf55e3f58bf8c2db928ea141
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331536
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index a85b0c2..a7aaeb2 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -201,8 +201,6 @@
 void GrResourceCache::abandonAll() {
     AutoValidate av(this);
 
-    fThreadSafeCache->dropAllRefs();
-
     // We need to make sure to free any resources that were waiting on a free message but never
     // received one.
     fTexturesAwaitingUnref.reset();
@@ -219,6 +217,8 @@
         top->cacheAccess().abandon();
     }
 
+    fThreadSafeCache->dropAllRefs();
+
     SkASSERT(!fScratchMap.count());
     SkASSERT(!fUniqueHash.count());
     SkASSERT(!fCount);