Move "matches" from GrContextThreadSafeProxy to GrContext_Base

This makes the "matches" functionality available to all the context flavors and uses it for SkImages

Change-Id: I1e3d55f19a7752a9da8789e93a848b7a7a64d180
Reviewed-on: https://skia-review.googlesource.com/c/190227
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 35d5a2e..648f862 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -33,7 +33,7 @@
 
 #if GR_TEST_UTILS
 void SkImage_GpuBase::resetContext(sk_sp<GrContext> newContext) {
-    SkASSERT(fContext->priv().contextID() == newContext->priv().contextID());
+    SkASSERT(fContext->priv().matches(newContext.get()));
     fContext = newContext;
 }
 #endif
@@ -60,10 +60,6 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////////////
 
-uint32_t SkImage_GpuBase::contextID() const {
-    return fContext->priv().contextID();
-}
-
 bool SkImage_GpuBase::getROPixels(SkBitmap* dst, CachingHint chint) const {
     if (!fContext->priv().resourceProvider()) {
         // DDL TODO: buffer up the readback so it occurs when the DDL is drawn?
@@ -211,7 +207,7 @@
 sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
                                                          const GrSamplerState& params,
                                                          SkScalar scaleAdjust[2]) const {
-    if (context->priv().contextID() != fContext->priv().contextID()) {
+    if (!fContext->priv().matches(context)) {
         SkASSERT(0);
         return nullptr;
     }