When cache is full delay flush until GrContext draw is finished


Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/25673004

git-svn-id: http://skia.googlecode.com/svn/trunk/include@11613 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/GrContext.h b/gpu/GrContext.h
index 5b25fe4..973185c 100644
--- a/gpu/GrContext.h
+++ b/gpu/GrContext.h
@@ -877,6 +877,9 @@
     GrIndexBufferAllocPool*         fDrawBufferIBAllocPool;
     GrInOrderDrawBuffer*            fDrawBuffer;
+    // Set by OverbudgetCB() to request that GrContext flush before exiting a draw.
+    bool                            fFlushToReduceCacheSize;
     GrAARectRenderer*               fAARectRenderer;
     GrOvalRenderer*                 fOvalRenderer;
@@ -899,9 +902,10 @@
     void setupDrawBuffer();
     class AutoRestoreEffects;
+    class AutoCheckFlush;
     /// Sets the paint and returns the target to draw into. The paint can be NULL in which case the
     /// draw state is left unmodified.
-    GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects*);
+    GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects*, AutoCheckFlush*);
     void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path,
                           const SkStrokeRec& stroke);