Disable preemptive batch preparation

Preemptive batch preparation makes MultiDrawBuffer more difficult to implement. This CL disables it.

BUG=skia:4094

Review URL: https://codereview.chromium.org/1430403002
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp
index 8f866e7..2d90206 100644
--- a/src/gpu/GrBatchAtlas.cpp
+++ b/src/gpu/GrBatchAtlas.cpp
@@ -331,6 +331,8 @@
     SkDEBUGCODE(bool verify = )newPlot->addSubImage(width, height, image, loc);
     SkASSERT(verify);
 
+    // Note that this plot will be uploaded inline with the draws whereas the
+    // one it displaced most likely was uploaded asap.
     newPlot->setLastUploadToken(batchTarget->currentToken());
     SkAutoTUnref<GrPlotUploader> uploader(new GrPlotUploader(newPlot, fTexture));
     batchTarget->upload(uploader);
diff --git a/src/gpu/GrBatchFlushState.cpp b/src/gpu/GrBatchFlushState.cpp
index f120666..52261a1 100644
--- a/src/gpu/GrBatchFlushState.cpp
+++ b/src/gpu/GrBatchFlushState.cpp
@@ -10,15 +10,14 @@
 #include "GrBatchAtlas.h"
 #include "GrPipeline.h"
 
-GrBatchFlushState::GrBatchFlushState(GrGpu* gpu, GrResourceProvider* resourceProvider,
-                                     GrBatchToken lastFlushedToken)
+GrBatchFlushState::GrBatchFlushState(GrGpu* gpu, GrResourceProvider* resourceProvider)
     : fGpu(gpu)
     , fUploader(gpu)
     , fResourceProvider(resourceProvider)
     , fVertexPool(gpu)
     , fIndexPool(gpu)
-    , fCurrentToken(lastFlushedToken)
-    , fLastFlushedToken(lastFlushedToken) {}
+    , fCurrentToken(0)
+    , fLastFlushedToken(0) {}
 
 void* GrBatchFlushState::makeVertexSpace(size_t vertexSize, int vertexCount,
                                          const GrVertexBuffer** buffer, int* startVertex) {
diff --git a/src/gpu/GrBatchFlushState.h b/src/gpu/GrBatchFlushState.h
index f9b304d..2008fa6 100644
--- a/src/gpu/GrBatchFlushState.h
+++ b/src/gpu/GrBatchFlushState.h
@@ -44,7 +44,7 @@
 /** Tracks the state across all the GrBatches in a GrDrawTarget flush. */
 class GrBatchFlushState {
 public:
-    GrBatchFlushState(GrGpu*, GrResourceProvider*, GrBatchToken lastFlushedToken);
+    GrBatchFlushState(GrGpu*, GrResourceProvider*);
 
     ~GrBatchFlushState() { this->reset(); }
 
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index e13d9b8..3aa7a54 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -36,9 +36,8 @@
                            const Options& options)
     : fGpu(SkRef(gpu))
     , fResourceProvider(resourceProvider)
-    , fFlushState(fGpu, fResourceProvider, 0)
+    , fFlushState(fGpu, fResourceProvider)
     , fFlushing(false)
-    , fFirstUnpreparedBatch(0)
     , fFlags(0)
     , fOptions(options)
     , fRenderTarget(rt) {
@@ -190,8 +189,8 @@
     this->makeClosed();
 
     // Loop over the batches that haven't yet generated their geometry
-    for (; fFirstUnpreparedBatch < fBatches.count(); ++fFirstUnpreparedBatch) {
-        fBatches[fFirstUnpreparedBatch]->prepare(&fFlushState);
+    for (int i = 0; i < fBatches.count(); ++i) {
+        fBatches[i]->prepare(&fFlushState);
     }
 
     // Upload all data to the GPU
@@ -209,7 +208,6 @@
 }
 
 void GrDrawTarget::reset() {
-    fFirstUnpreparedBatch = 0;
     fBatches.reset();
     fFlushState.reset();
 }
@@ -522,10 +520,6 @@
         GrBATCH_INFO("\t\tFirstBatch\n");
     }
     fBatches.push_back().reset(SkRef(batch));
-    if (fBatches.count() > kMaxLookback) {
-        SkASSERT(fBatches.count() - kMaxLookback - fFirstUnpreparedBatch == 1);
-        fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState);
-    }
     if (fOptions.fImmediateMode) {
         this->flush();
     }
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 6350803..bfb62a8 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -36,7 +36,6 @@
 //#define ENABLE_MDB 1
 
 class GrBatch;
-class GrBatchFlushState;
 class GrClip;
 class GrCaps;
 class GrPath;
@@ -314,7 +313,6 @@
     GrResourceProvider*                         fResourceProvider;
     GrBatchFlushState                           fFlushState;
     bool                                        fFlushing;
-    int                                         fFirstUnpreparedBatch;
 
     SkDEBUGCODE(int                             fDebugID;)
     uint32_t                                    fFlags;