Make compressedBackendFormat accessible from GrContextThreadSafeProxy

Not having this available on GrContextThreadSafeProxy was an oversight.
This will allow Chrome to correctly prepare the correct type of compressed promise image.

Change-Id: I3002609fef00a130fe409f318ae0f442ef7591d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437016
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/include/gpu/GrContextThreadSafeProxy.h b/include/gpu/GrContextThreadSafeProxy.h
index f645b87..ed0b884 100644
--- a/include/gpu/GrContextThreadSafeProxy.h
+++ b/include/gpu/GrContextThreadSafeProxy.h
@@ -105,6 +105,15 @@
      */
     GrBackendFormat defaultBackendFormat(SkColorType ct, GrRenderable renderable) const;
 
+    /**
+     * Retrieve the GrBackendFormat for a given SkImage::CompressionType. This is
+     * guaranteed to match the backend format used by the following
+     * createCompressedBackendTexture methods that take a CompressionType.
+     *
+     * The caller should check that the returned format is valid.
+     */
+    GrBackendFormat compressedBackendFormat(SkImage::CompressionType c) const;
+
     bool isValid() const { return nullptr != fCaps; }
 
     bool operator==(const GrContextThreadSafeProxy& that) const {
diff --git a/include/gpu/GrDirectContext.h b/include/gpu/GrDirectContext.h
index 532d41e..66703bd 100644
--- a/include/gpu/GrDirectContext.h
+++ b/include/gpu/GrDirectContext.h
@@ -655,6 +655,7 @@
      * Retrieve the GrBackendFormat for a given SkImage::CompressionType. This is
      * guaranteed to match the backend format used by the following
      * createCompressedBackendTexture methods that take a CompressionType.
+     *
      * The caller should check that the returned format is valid.
      */
     using GrRecordingContext::compressedBackendFormat;
diff --git a/src/gpu/GrContextThreadSafeProxy.cpp b/src/gpu/GrContextThreadSafeProxy.cpp
index 2c3a221..cbdcaa0 100644
--- a/src/gpu/GrContextThreadSafeProxy.cpp
+++ b/src/gpu/GrContextThreadSafeProxy.cpp
@@ -153,6 +153,15 @@
     return format;
 }
 
+GrBackendFormat GrContextThreadSafeProxy::compressedBackendFormat(SkImage::CompressionType c) const {
+    SkASSERT(fCaps);
+
+    GrBackendFormat format = fCaps->getBackendFormatFromCompressionType(c);
+
+    SkASSERT(!format.isValid() || fCaps->isFormatTexturable(format));
+    return format;
+}
+
 void GrContextThreadSafeProxy::abandonContext() {
     if (!fAbandoned.exchange(true)) {
         fTextBlobCache->freeAll();
diff --git a/src/gpu/GrContext_Base.cpp b/src/gpu/GrContext_Base.cpp
index fd99704..50144c7 100644
--- a/src/gpu/GrContext_Base.cpp
+++ b/src/gpu/GrContext_Base.cpp
@@ -41,12 +41,7 @@
 }
 
 GrBackendFormat GrContext_Base::compressedBackendFormat(SkImage::CompressionType c) const {
-    const GrCaps* caps = this->caps();
-
-    GrBackendFormat format = caps->getBackendFormatFromCompressionType(c);
-
-    SkASSERT(!format.isValid() || caps->isFormatTexturable(format));
-    return format;
+    return fThreadSafeProxy->compressedBackendFormat(c);
 }
 
 sk_sp<GrContextThreadSafeProxy> GrContext_Base::threadSafeProxy() { return fThreadSafeProxy; }