Remove GrProxyPendingIO

Change-Id: I9cf40f0518673206c6304e3f386dd75c9a44f269
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235865
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrPendingIOResource.h b/src/gpu/GrPendingIOResource.h
index 09340fe..17bec29 100644
--- a/src/gpu/GrPendingIOResource.h
+++ b/src/gpu/GrPendingIOResource.h
@@ -13,38 +13,6 @@
 #include "include/private/SkNoncopyable.h"
 #include "src/gpu/GrSurfaceProxy.h"
 
-class GrProxyPendingIO : SkNoncopyable {
-public:
-    GrProxyPendingIO() = default;
-    GrProxyPendingIO(GrSurfaceProxy* resource) { this->reset(resource); }
-    ~GrProxyPendingIO() { this->reset(nullptr); }
-
-    void reset(GrSurfaceProxy* resource = nullptr) {
-        if (resource == fResource) {
-            return;
-        }
-
-        if (fResource) {
-            fResource->unref();
-        }
-
-        fResource = resource;
-        if (fResource) {
-            fResource->ref();
-        }
-    }
-
-    explicit operator bool() const { return SkToBool(fResource); }
-
-    GrSurfaceProxy* get() const { return fResource; }
-    GrSurfaceProxy* operator->() const { return fResource; }
-
-private:
-    bool operator==(const GrProxyPendingIO& other) const = delete;
-
-    GrSurfaceProxy* fResource = nullptr;
-};
-
 /**
  * Helper for owning a pending read, write, read-write on a GrGpuResource. It never owns a regular
  * ref.
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index af2a5e6..1de2199 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -42,7 +42,7 @@
     if (args.fDstProxy.proxy()) {
         SkASSERT(args.fDstProxy.proxy()->isInstantiated());
 
-        fDstTextureProxy.reset(args.fDstProxy.proxy());
+        fDstTextureProxy = args.fDstProxy.refProxy();
         fDstTextureOffset = args.fDstProxy.offset();
     }
 
@@ -75,7 +75,7 @@
 }
 
 GrXferBarrierType GrPipeline::xferBarrierType(GrTexture* texture, const GrCaps& caps) const {
-    if (fDstTextureProxy.get() && fDstTextureProxy.get()->peekTexture() == texture) {
+    if (fDstTextureProxy && fDstTextureProxy->peekTexture() == texture) {
         return kTexture_GrXferBarrierType;
     }
     return this->getXferProcessor().xferBarrierType(caps);
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 2978c69..cacf020 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -142,7 +142,7 @@
             *offset = fDstTextureOffset;
         }
 
-        return fDstTextureProxy ? fDstTextureProxy->asTextureProxy() : nullptr;
+        return fDstTextureProxy.get();
     }
 
     GrTexture* peekDstTexture(SkIPoint* offset = nullptr) const {
@@ -218,7 +218,7 @@
 
     using FragmentProcessorArray = SkAutoSTArray<8, std::unique_ptr<const GrFragmentProcessor>>;
 
-    GrProxyPendingIO fDstTextureProxy;
+    sk_sp<GrTextureProxy> fDstTextureProxy;
     SkIPoint fDstTextureOffset;
     GrWindowRectsState fWindowRectsState;
     const GrUserStencilSettings* fUserStencilSettings;
diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h
index 604c68d..18525e7 100644
--- a/src/gpu/GrXferProcessor.h
+++ b/src/gpu/GrXferProcessor.h
@@ -87,6 +87,7 @@
         void setOffset(int ox, int oy) { fOffset.set(ox, oy); }
 
         GrTextureProxy* proxy() const { return fProxy.get(); }
+        sk_sp<GrTextureProxy> refProxy() const { return fProxy; }
 
         void setProxy(sk_sp<GrTextureProxy> proxy) {
             fProxy = std::move(proxy);
diff --git a/src/gpu/ops/GrCopySurfaceOp.h b/src/gpu/ops/GrCopySurfaceOp.h
index 69652bd..f5d41dd 100644
--- a/src/gpu/ops/GrCopySurfaceOp.h
+++ b/src/gpu/ops/GrCopySurfaceOp.h
@@ -49,8 +49,8 @@
     GrCopySurfaceOp(GrSurfaceProxy* src, GrSurfaceProxy* dst, const SkIRect& srcRect,
                     const SkIPoint& dstPoint)
             : INHERITED(ClassID())
-            , fSrc(src)
-            , fDst(dst)
+            , fSrc(sk_ref_sp(src))
+            , fDst(sk_ref_sp(dst))
             , fSrcRect(srcRect)
             , fDstPoint(dstPoint) {
         SkRect bounds =
@@ -72,10 +72,10 @@
 
     void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
 
-    GrProxyPendingIO fSrc;
-    GrProxyPendingIO fDst;
-    SkIRect          fSrcRect;
-    SkIPoint         fDstPoint;
+    sk_sp<GrSurfaceProxy> fSrc;
+    sk_sp<GrSurfaceProxy> fDst;
+    SkIRect               fSrcRect;
+    SkIPoint              fDstPoint;
 
     typedef GrOp INHERITED;
 };