make adding a text blob to GrTextBlobCache thread safe

Change-Id: I18d3b05e4913114e44905a6020baca90bf437320
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375056
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 3803946..51ee7eb 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -426,7 +426,9 @@
         blob = GrTextBlob::Make(glyphRunList, drawMatrix);
         if (canCache) {
             blob->addKey(key);
-            textBlobCache->add(glyphRunList, blob);
+            // The blob may already have been created on a different thread. Use the first one
+            // that was there.
+            blob = textBlobCache->addOrReturnExisting(glyphRunList, blob);
         }
 
         bool supportsSDFT = fContext->priv().caps()->shaderCaps()->supportsDistanceFieldText();