Remove GrRenderTargetOpList::discard & move functionality to GrRenderTargetContext

Change-Id: If84ffb7b01543a44179837d683c0a4c004e52f63
Reviewed-on: https://skia-review.googlesource.com/13335
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 38bd4ac..40ccbea 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -26,6 +26,7 @@
 #include "instanced/InstancedRendering.h"
 #include "ops/GrClearOp.h"
 #include "ops/GrClearStencilClipOp.h"
+#include "ops/GrDiscardOp.h"
 #include "ops/GrDrawOp.h"
 #include "ops/GrDrawAtlasOp.h"
 #include "ops/GrDrawVerticesOp.h"
@@ -192,7 +193,15 @@
 
     AutoCheckFlush acf(this->drawingManager());
 
-    this->getOpList()->discard(this);
+    // Currently this just inserts a discard op. However, once in MDB this can remove all the
+    // previously recorded ops and change the load op to discard.
+    if (this->caps()->discardRenderTargetSupport()) {
+        std::unique_ptr<GrOp> op(GrDiscardOp::Make(this));
+        if (!op) {
+            return;
+        }
+        this->getOpList()->addOp(std::move(op), this);
+    }
 }
 
 void GrRenderTargetContext::clear(const SkIRect* rect,
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 0e870fd..3d38c99 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -15,7 +15,6 @@
 #include "GrResourceProvider.h"
 #include "ops/GrClearOp.h"
 #include "ops/GrCopySurfaceOp.h"
-#include "ops/GrDiscardOp.h"
 #include "instanced/InstancedRendering.h"
 
 using gr_instanced::InstancedRendering;
@@ -251,18 +250,6 @@
     }
 }
 
-void GrRenderTargetOpList::discard(GrRenderTargetContext* renderTargetContext) {
-    // Currently this just inserts a discard op. However, once in MDB this can remove all the
-    // previously recorded ops and change the load op to discard.
-    if (this->caps()->discardRenderTargetSupport()) {
-        std::unique_ptr<GrOp> op(GrDiscardOp::Make(renderTargetContext));
-        if (!op) {
-            return;
-        }
-        this->recordOp(std::move(op), renderTargetContext);
-    }
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 
 bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 16c103a..cd08559 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -85,9 +85,6 @@
     /** Clears the entire render target */
     void fullClear(GrRenderTargetContext*, GrColor color);
 
-    /** Discards the contents render target. */
-    void discard(GrRenderTargetContext*);
-
     /**
      * Copies a pixel rectangle from one surface to another. This call may finalize
      * reserved vertex/index data (as though a draw call was made). The src pixels