Revert "Store discard request on the opList and remove GrDiscardOp"

This reverts commit b681a0f1b0acebe36130fd463d14016d48295b97.

Reason for revert: Seems to be messing up some MacMini & Nexus7 bots
Original change's description:
> Store discard request on the opList and remove GrDiscardOp
> 
> Change-Id: Ic1f76bb91c16b23df1fe71c07a4d5ad5abf1dc26
> Reviewed-on: https://skia-review.googlesource.com/32640
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

Change-Id: I8a89fae7bb11791bd023d7444a074bb34d006fd0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/32704
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 48cea29..e76b5ff 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -31,6 +31,7 @@
 #include "ops/GrClearOp.h"
 #include "ops/GrClearStencilClipOp.h"
 #include "ops/GrDebugMarkerOp.h"
+#include "ops/GrDiscardOp.h"
 #include "ops/GrDrawAtlasOp.h"
 #include "ops/GrDrawOp.h"
 #include "ops/GrDrawVerticesOp.h"
@@ -215,22 +216,18 @@
     ASSERT_SINGLE_OWNER
     RETURN_IF_ABANDONED
     SkDEBUGCODE(this->validate();)
-    GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "discard", fContext);
+            GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "discard", fContext);
 
     AutoCheckFlush acf(this->drawingManager());
 
-    // Discard calls to in-progress opLists are ignored. Calls at the start update the
-    // opLists' color & stencil load ops.
-    if (this->getRTOpList()->isEmpty()) {
-        if (this->caps()->discardRenderTargetSupport()) {
-            this->getRTOpList()->setColorLoadOp(GrLoadOp::kDiscard);
-            this->getRTOpList()->setStencilLoadOp(GrLoadOp::kDiscard);
-        } else {
-            // Surely, if a discard was requested, a clear should be acceptable
-            this->getRTOpList()->setColorLoadOp(GrLoadOp::kClear);
-            this->getRTOpList()->setLoadClearColor(0x0);
-            this->getRTOpList()->setStencilLoadOp(GrLoadOp::kClear);
+    // 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(fRenderTargetProxy.get()));
+        if (!op) {
+            return;
         }
+        this->getRTOpList()->addOp(std::move(op), *this->caps());
     }
 }
 
@@ -1764,7 +1761,7 @@
 
     if (fixedFunctionFlags & GrDrawOp::FixedFunctionFlags::kUsesStencil ||
         appliedClip.hasStencilClip()) {
-        this->getOpList()->setStencilLoadOp(GrLoadOp::kClear);
+        this->getOpList()->setRequiresStencil();
 
         // This forces instantiation of the render target.
         GrRenderTarget* rt = this->accessRenderTarget();