Fix for nexus 5 crashing in GL benches

GLBenches do not expect gl state  to change between onPerCanvasPreDraw and *PostDraw, but we do a clear and sometimes we clear as draw.  This causes us to bind vertex objects / programs / etc.

This change creates two new virtual methods which are called right before and immediately after timing.

BUG=skia:

Review URL: https://codereview.chromium.org/1379853003
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index af06c4b..cb561e3 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -113,7 +113,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         int w = 40;
         int h = 40;
         makebm(&fBmp, w, h);
diff --git a/bench/Benchmark.cpp b/bench/Benchmark.cpp
index bf622b0..98fec2e 100644
--- a/bench/Benchmark.cpp
+++ b/bench/Benchmark.cpp
@@ -33,14 +33,22 @@
     return this->onGetSize();
 }
 
-void Benchmark::preDraw() {
-    this->onPreDraw();
+void Benchmark::delayedSetup() {
+    this->onDelayedSetup();
 }
 
 void Benchmark::perCanvasPreDraw(SkCanvas* canvas) {
     this->onPerCanvasPreDraw(canvas);
 }
 
+void Benchmark::preDraw(SkCanvas* canvas) {
+    this->onPreDraw(canvas);
+}
+
+void Benchmark::postDraw(SkCanvas* canvas) {
+    this->onPostDraw(canvas);
+}
+
 void Benchmark::perCanvasPostDraw(SkCanvas* canvas) {
     this->onPerCanvasPostDraw(canvas);
 }
diff --git a/bench/Benchmark.h b/bench/Benchmark.h
index 7511726..06d42e8 100644
--- a/bench/Benchmark.h
+++ b/bench/Benchmark.h
@@ -70,13 +70,17 @@
     // Call before draw, allows the benchmark to do setup work outside of the
     // timer. When a benchmark is repeatedly drawn, this should be called once
     // before the initial draw.
-    void preDraw();
+    void delayedSetup();
 
     // Called once before and after a series of draw calls to a single canvas.
     // The setup/break down in these calls is not timed.
     void perCanvasPreDraw(SkCanvas*);
     void perCanvasPostDraw(SkCanvas*);
 
+    // Called just before and after each call to draw().  Not timed.
+    void preDraw(SkCanvas*);
+    void postDraw(SkCanvas*);
+
     // Bench framework can tune loops to be large enough for stable timing.
     void draw(const int loops, SkCanvas*);
 
@@ -112,9 +116,11 @@
 
     virtual const char* onGetName() = 0;
     virtual const char* onGetUniqueName() { return this->onGetName(); }
-    virtual void onPreDraw() {}
+    virtual void onDelayedSetup() {}
     virtual void onPerCanvasPreDraw(SkCanvas*) {}
     virtual void onPerCanvasPostDraw(SkCanvas*) {}
+    virtual void onPreDraw(SkCanvas*) {}
+    virtual void onPostDraw(SkCanvas*) {}
     // Each bench should do its main work in a loop like this:
     //   for (int i = 0; i < loops; i++) { <work here> }
     virtual void onDraw(const int loops, SkCanvas*) = 0;
diff --git a/bench/BigPathBench.cpp b/bench/BigPathBench.cpp
index f18e3de..a554b38 100644
--- a/bench/BigPathBench.cpp
+++ b/bench/BigPathBench.cpp
@@ -46,7 +46,7 @@
         return SkIPoint::Make(640, 100);
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         make_path(fPath);
     }
 
diff --git a/bench/BitmapBench.cpp b/bench/BitmapBench.cpp
index 8176f38..260a2c9 100644
--- a/bench/BitmapBench.cpp
+++ b/bench/BitmapBench.cpp
@@ -110,7 +110,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkBitmap bm;
 
         if (kIndex_8_SkColorType == fColorType) {
diff --git a/bench/BitmapRectBench.cpp b/bench/BitmapRectBench.cpp
index d95d753..93659c1 100644
--- a/bench/BitmapRectBench.cpp
+++ b/bench/BitmapRectBench.cpp
@@ -67,7 +67,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fBitmap.allocPixels();
         fBitmap.setAlphaType(kOpaque_SkAlphaType);
         fBitmap.eraseColor(SK_ColorBLACK);
diff --git a/bench/BitmapRegionDecoderBench.cpp b/bench/BitmapRegionDecoderBench.cpp
index 77d3423..5872942 100644
--- a/bench/BitmapRegionDecoderBench.cpp
+++ b/bench/BitmapRegionDecoderBench.cpp
@@ -53,7 +53,7 @@
     return kNonRendering_Backend == backend;
 }
 
-void BitmapRegionDecoderBench::onPreDraw() {
+void BitmapRegionDecoderBench::onDelayedSetup() {
     SkStreamRewindable* stream = new SkMemoryStream(fData);
     fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(stream, fStrategy));
 }
diff --git a/bench/BitmapRegionDecoderBench.h b/bench/BitmapRegionDecoderBench.h
index 7be770f..4f4d55e 100644
--- a/bench/BitmapRegionDecoderBench.h
+++ b/bench/BitmapRegionDecoderBench.h
@@ -34,7 +34,7 @@
     const char* onGetName() override;
     bool isSuitableFor(Backend backend) override;
     void onDraw(const int n, SkCanvas* canvas) override;
-    void onPreDraw() override;
+    void onDelayedSetup() override;
 
 private:
     SkString                                       fName;
diff --git a/bench/BitmapScaleBench.cpp b/bench/BitmapScaleBench.cpp
index 2bfa312..b3f0763 100644
--- a/bench/BitmapScaleBench.cpp
+++ b/bench/BitmapScaleBench.cpp
@@ -56,7 +56,7 @@
         fName.printf( "bitmap_scale_%s_%d_%d", name, fInputSize, fOutputSize );
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fInputBitmap.allocN32Pixels(fInputSize, fInputSize, true);
         fInputBitmap.eraseColor(SK_ColorWHITE);
 
diff --git a/bench/BlurImageFilterBench.cpp b/bench/BlurImageFilterBench.cpp
index 8bfd005..d7d3eb2 100644
--- a/bench/BlurImageFilterBench.cpp
+++ b/bench/BlurImageFilterBench.cpp
@@ -35,7 +35,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!fInitialized) {
             make_checkerboard();
             fInitialized = true;
diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp
index a21aae1..0b457a4 100644
--- a/bench/CodecBench.cpp
+++ b/bench/CodecBench.cpp
@@ -32,7 +32,7 @@
     return kNonRendering_Backend == backend;
 }
 
-void CodecBench::onPreDraw() {
+void CodecBench::onDelayedSetup() {
     SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData));
 
     fInfo = codec->getInfo().makeColorType(fColorType);
diff --git a/bench/CodecBench.h b/bench/CodecBench.h
index 0675cca..efa3cb2 100644
--- a/bench/CodecBench.h
+++ b/bench/CodecBench.h
@@ -26,7 +26,7 @@
     const char* onGetName() override;
     bool isSuitableFor(Backend backend) override;
     void onDraw(const int n, SkCanvas* canvas) override;
-    void onPreDraw() override;
+    void onDelayedSetup() override;
 
 private:
     SkString                fName;
diff --git a/bench/ColorCubeBench.cpp b/bench/ColorCubeBench.cpp
index 65270a8..ec0a47b 100644
--- a/bench/ColorCubeBench.cpp
+++ b/bench/ColorCubeBench.cpp
@@ -31,7 +31,7 @@
         return "colorcube";
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!SkToBool(fCubeData)) {
             this->makeCubeData();
             this->make_bitmap();
diff --git a/bench/ColorPrivBench.cpp b/bench/ColorPrivBench.cpp
index 9c8acce..4aa51c4 100644
--- a/bench/ColorPrivBench.cpp
+++ b/bench/ColorPrivBench.cpp
@@ -24,7 +24,7 @@
 
     const char* onGetName() override { return fName.c_str(); }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         // A handful of random srcs and dsts.
         SkRandom rand;
         for (int i = 0; i < kInputs; i++) {
diff --git a/bench/DecodingBench.cpp b/bench/DecodingBench.cpp
index 7b6ad2b..0c95094 100644
--- a/bench/DecodingBench.cpp
+++ b/bench/DecodingBench.cpp
@@ -44,7 +44,7 @@
     return kNonRendering_Backend == backend;
 }
 
-void DecodingBench::onPreDraw() {
+void DecodingBench::onDelayedSetup() {
     // Allocate the pixels now, to remove it from the loop.
     SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData));
     SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
diff --git a/bench/DecodingBench.h b/bench/DecodingBench.h
index a32bfea..b30e972 100644
--- a/bench/DecodingBench.h
+++ b/bench/DecodingBench.h
@@ -28,7 +28,7 @@
     const char* onGetName() override;
     bool isSuitableFor(Backend backend) override;
     void onDraw(const int n, SkCanvas* canvas) override;
-    void onPreDraw() override;
+    void onDelayedSetup() override;
 
 private:
     SkString                fName;
diff --git a/bench/DisplacementBench.cpp b/bench/DisplacementBench.cpp
index b83d0d1..d9ddc8b 100644
--- a/bench/DisplacementBench.cpp
+++ b/bench/DisplacementBench.cpp
@@ -23,7 +23,7 @@
     }
 
 protected:
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!fInitialized) {
             this->makeBitmap();
             this->makeCheckerboard();
diff --git a/bench/DrawBitmapAABench.cpp b/bench/DrawBitmapAABench.cpp
index e4e0296..9d5003b 100644
--- a/bench/DrawBitmapAABench.cpp
+++ b/bench/DrawBitmapAABench.cpp
@@ -32,7 +32,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fBitmap.allocN32Pixels(200, 200);
         fBitmap.eraseARGB(255, 0, 255, 0);
     }
diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp
index d2fc76f..db8e37e 100644
--- a/bench/ETCBitmapBench.cpp
+++ b/bench/ETCBitmapBench.cpp
@@ -144,7 +144,7 @@
         }
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (nullptr == fPKMData) {
             SkDebugf("Failed to load PKM data!\n");
             return;
diff --git a/bench/FSRectBench.cpp b/bench/FSRectBench.cpp
index 03d1504..4c7173b 100644
--- a/bench/FSRectBench.cpp
+++ b/bench/FSRectBench.cpp
@@ -22,7 +22,7 @@
 protected:
     const char* onGetName() override { return "fullscreen_rects"; }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!fInit) {
             SkRandom rand;
             static const SkScalar kMinOffset = 0;
diff --git a/bench/GLBench.cpp b/bench/GLBench.cpp
index a2f7a06..23dd04f 100644
--- a/bench/GLBench.cpp
+++ b/bench/GLBench.cpp
@@ -32,7 +32,7 @@
     return this->onGetGLContext(ctx);
 }
 
-void GLBench::onPerCanvasPreDraw(SkCanvas* canvas) {
+void GLBench::onPreDraw(SkCanvas* canvas) {
     // This bench exclusively tests GL calls directly
     const GrGLContext* ctx = this->getGLContext(canvas);
     if (!ctx) {
@@ -41,7 +41,7 @@
     this->setup(ctx);
 }
 
-void GLBench::onPerCanvasPostDraw(SkCanvas* canvas) {
+void GLBench::onPostDraw(SkCanvas* canvas) {
     // This bench exclusively tests GL calls directly
     const GrGLContext* ctx = this->getGLContext(canvas);
     if (!ctx) {
diff --git a/bench/GLBench.h b/bench/GLBench.h
index 0755c4f..dde0358 100644
--- a/bench/GLBench.h
+++ b/bench/GLBench.h
@@ -29,9 +29,9 @@
 protected:
     const GrGLContext* getGLContext(SkCanvas*);
     virtual const GrGLContext* onGetGLContext(const GrGLContext* ctx) { return ctx; }
-    void onPerCanvasPreDraw(SkCanvas* canvas) override;
+    void onPreDraw(SkCanvas*) override;
     virtual void setup(const GrGLContext*)=0;
-    void onPerCanvasPostDraw(SkCanvas* canvas) override;
+    void onPostDraw(SkCanvas* canvas) override;
     virtual void teardown(const GrGLInterface*)=0;
     void onDraw(const int loops, SkCanvas*) override;
     virtual void glDraw(const int loops, const GrGLContext*)=0;
diff --git a/bench/GameBench.cpp b/bench/GameBench.cpp
index b994400..b1edf2e 100644
--- a/bench/GameBench.cpp
+++ b/bench/GameBench.cpp
@@ -78,7 +78,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!fInitialized) {
             this->makeCheckerboard();
             this->makeAtlas();
diff --git a/bench/GeometryBench.cpp b/bench/GeometryBench.cpp
index 99d39dd..718d6a4 100644
--- a/bench/GeometryBench.cpp
+++ b/bench/GeometryBench.cpp
@@ -46,7 +46,7 @@
 protected:
     SkRect fRects[2048];
 
-    virtual void onPreDraw() {
+    virtual void onDelayedSetup() {
         const SkScalar min = -100;
         const SkScalar max = 100;
         SkRandom rand;
diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp
index ec2f8ca..d022f19 100644
--- a/bench/GrResourceCacheBench.cpp
+++ b/bench/GrResourceCacheBench.cpp
@@ -115,7 +115,7 @@
         return fFullName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fContext.reset(GrContext::CreateMockContext());
         if (!fContext) {
             return;
diff --git a/bench/ImageFilterCollapse.cpp b/bench/ImageFilterCollapse.cpp
index 4024750..010149b 100644
--- a/bench/ImageFilterCollapse.cpp
+++ b/bench/ImageFilterCollapse.cpp
@@ -83,7 +83,7 @@
         return "image_filter_collapse_table";
     }
 
-    virtual void onPreDraw() override {
+    virtual void onDelayedSetup() override {
         for (int i = 0; i < 256; ++i) {
             int n = i >> 5;
             table1[i] = (n << 5) | (n << 2) | (n >> 1);
@@ -139,7 +139,7 @@
         return "image_filter_collapse_matrix";
     }
 
-    virtual void onPreDraw() override {
+    virtual void onDelayedSetup() override {
         SkColorFilter* colorFilters[] = {
             make_brightness(0.1f),
             make_grayscale(),
diff --git a/bench/MagnifierBench.cpp b/bench/MagnifierBench.cpp
index 24bd53c..c79c668 100644
--- a/bench/MagnifierBench.cpp
+++ b/bench/MagnifierBench.cpp
@@ -26,7 +26,7 @@
         return fIsSmall ? "magnifier_small" : "magnifier_large";
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!fInitialized) {
             make_checkerboard();
             fInitialized = true;
diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp
index 75736aa..9471f18 100644
--- a/bench/MatrixBench.cpp
+++ b/bench/MatrixBench.cpp
@@ -146,7 +146,7 @@
     DecomposeMatrixBench() : INHERITED("decompose") {}
 
 protected:
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         for (int i = 0; i < 10; ++i) {
             SkScalar rot0 = (fRandom.nextBool()) ? fRandom.nextRangeF(-180, 180) : 0.0f;
             SkScalar sx = fRandom.nextRangeF(-3000.f, 3000.f);
diff --git a/bench/MergeBench.cpp b/bench/MergeBench.cpp
index 0a2611d..404f646 100644
--- a/bench/MergeBench.cpp
+++ b/bench/MergeBench.cpp
@@ -25,7 +25,7 @@
         return fIsSmall ? "merge_small" : "merge_large";
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (!fInitialized) {
             make_bitmap();
             make_checkerboard();
diff --git a/bench/MipMapBench.cpp b/bench/MipMapBench.cpp
index 18af1e5..2fb52bb 100644
--- a/bench/MipMapBench.cpp
+++ b/bench/MipMapBench.cpp
@@ -22,7 +22,7 @@
 
     const char* onGetName() override { return "mipmap_build"; }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fBitmap.allocN32Pixels(1000, 1000, true);
         fBitmap.eraseColor(SK_ColorWHITE);  // so we don't read uninitialized memory
     }
diff --git a/bench/PatchBench.cpp b/bench/PatchBench.cpp
index a6f5faa..26caad0 100644
--- a/bench/PatchBench.cpp
+++ b/bench/PatchBench.cpp
@@ -107,7 +107,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         this->setCubics();
         this->setColors();
         this->setTexCoords();
diff --git a/bench/PatchGridBench.cpp b/bench/PatchGridBench.cpp
index e6b4487..dc64b53 100644
--- a/bench/PatchGridBench.cpp
+++ b/bench/PatchGridBench.cpp
@@ -200,7 +200,7 @@
         return fName.c_str();
     }
     
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         this->setGrid();
         switch (fVertexMode) {
             case kTexCoords_VertexMode:
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index 8c15711..e09fc3e 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -325,7 +325,7 @@
         return "path_create";
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         this->createData(10, 100);
     }
 
@@ -354,7 +354,7 @@
     const char* onGetName() override {
         return "path_copy";
     }
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         this->createData(10, 100);
         fPaths.reset(kPathCnt);
         fCopies.reset(kPathCnt);
@@ -390,7 +390,7 @@
         return fInPlace ? "path_transform_in_place" : "path_transform_copy";
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fMatrix.setScale(5 * SK_Scalar1, 6 * SK_Scalar1);
         this->createData(10, 100);
         fPaths.reset(kPathCnt);
@@ -438,7 +438,7 @@
         return "path_equality_50%";
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fParity = 0;
         this->createData(10, 100);
         fPaths.reset(kPathCnt);
@@ -501,7 +501,7 @@
         }
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         // reversePathTo assumes a single contour path.
         bool allowMoves = kReversePathTo_AddType != fType;
         this->createData(10, 100, allowMoves);
@@ -769,7 +769,7 @@
         }
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fQueryRects.setCount(kQueryRectCnt);
 
         SkRandom rand;
diff --git a/bench/PictureNestingBench.cpp b/bench/PictureNestingBench.cpp
index 48f2ef4..e315fe6 100644
--- a/bench/PictureNestingBench.cpp
+++ b/bench/PictureNestingBench.cpp
@@ -139,8 +139,8 @@
         : INHERITED("playback", maxLevel, maxPictureLevel) {
     }
 protected:
-    void onPreDraw() override {
-        this->INHERITED::onPreDraw();
+    void onDelayedSetup() override {
+        this->INHERITED::onDelayedSetup();
 
         SkIPoint canvasSize = onGetSize();
         SkPictureRecorder recorder;
diff --git a/bench/PicturePlaybackBench.cpp b/bench/PicturePlaybackBench.cpp
index 04eddc4..6c42a69 100644
--- a/bench/PicturePlaybackBench.cpp
+++ b/bench/PicturePlaybackBench.cpp
@@ -162,7 +162,7 @@
     const char* onGetName() override { return fName.c_str(); }
     SkIPoint onGetSize() override { return SkIPoint::Make(1024,1024); }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkAutoTDelete<SkBBHFactory> factory;
         switch (fBBH) {
             case kNone:                                                 break;
diff --git a/bench/PremulAndUnpremulAlphaOpsBench.cpp b/bench/PremulAndUnpremulAlphaOpsBench.cpp
index 6e79541..a325332 100644
--- a/bench/PremulAndUnpremulAlphaOpsBench.cpp
+++ b/bench/PremulAndUnpremulAlphaOpsBench.cpp
@@ -29,7 +29,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkImageInfo info = SkImageInfo::Make(W, H, fColorType, kUnpremul_SkAlphaType);
         fBmp1.allocPixels(info);   // used in writePixels
 
diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp
index 63d8ed9..61aa154 100644
--- a/bench/RTreeBench.cpp
+++ b/bench/RTreeBench.cpp
@@ -67,7 +67,7 @@
     const char* onGetName() override {
         return fName.c_str();
     }
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkRandom rand;
         SkAutoTMalloc<SkRect> rects(NUM_QUERY_RECTS);
         for (int i = 0; i < NUM_QUERY_RECTS; ++i) {
diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp
index ae8cb7a..456c6f1 100644
--- a/bench/RectBench.cpp
+++ b/bench/RectBench.cpp
@@ -48,7 +48,7 @@
 
     const char* onGetName() override { return computeName("rects"); }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkRandom rand;
         const SkScalar offset = SK_Scalar1/3;
         for (int i = 0; i < N; i++) {
diff --git a/bench/RectanizerBench.cpp b/bench/RectanizerBench.cpp
index fec9bf5..203da01 100644
--- a/bench/RectanizerBench.cpp
+++ b/bench/RectanizerBench.cpp
@@ -72,7 +72,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkASSERT(nullptr == fRectanizer.get());
 
         if (kPow2_RectanizerType == fRectanizerType) {
diff --git a/bench/RepeatTileBench.cpp b/bench/RepeatTileBench.cpp
index 4844f18..9b24eee 100644
--- a/bench/RepeatTileBench.cpp
+++ b/bench/RepeatTileBench.cpp
@@ -108,7 +108,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fBitmap.allocPixels();
         fBitmap.eraseColor(kOpaque_SkAlphaType == fAlphaType ? SK_ColorWHITE : 0);
 
diff --git a/bench/SkipZeroesBench.cpp b/bench/SkipZeroesBench.cpp
index 87d433e..5382832 100644
--- a/bench/SkipZeroesBench.cpp
+++ b/bench/SkipZeroesBench.cpp
@@ -45,7 +45,7 @@
         return fName.c_str();
     }
 
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         SkString resourcePath = GetResourcePath();
         if (resourcePath.isEmpty()) {
             fValid = false;
diff --git a/bench/SortBench.cpp b/bench/SortBench.cpp
index 9d22a45..f621670 100644
--- a/bench/SortBench.cpp
+++ b/bench/SortBench.cpp
@@ -119,7 +119,7 @@
     }
 
     // Delayed initialization only done if onDraw will be called.
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fUnsorted.reset(N);
         gRec[fType].fProc(fUnsorted.get());
     }
diff --git a/bench/TextBench.cpp b/bench/TextBench.cpp
index ee5d5e0..cc9537a 100644
--- a/bench/TextBench.cpp
+++ b/bench/TextBench.cpp
@@ -69,7 +69,7 @@
     }
 
 protected:
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         if (fDoColorEmoji) {
             SkASSERT(kBW == fFQ);
             fColorEmojiTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
diff --git a/bench/TextBlobBench.cpp b/bench/TextBlobBench.cpp
index 0ef5eb9..5f4dbba 100644
--- a/bench/TextBlobBench.cpp
+++ b/bench/TextBlobBench.cpp
@@ -29,7 +29,7 @@
     }
 
 protected:
-    void onPreDraw() override {
+    void onDelayedSetup() override {
         fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypeface::kNormal));
         // make textblob
         SkPaint paint;
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 900ba4d..6328aa1 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -207,6 +207,7 @@
     if (canvas) {
         canvas->clear(SK_ColorWHITE);
     }
+    bench->preDraw(canvas);
     WallTimer timer;
     timer.start();
     canvas = target->beginTiming(canvas);
@@ -216,6 +217,7 @@
     }
     target->endTiming();
     timer.end();
+    bench->postDraw(canvas);
     return timer.fWall;
 }
 
@@ -1164,7 +1166,7 @@
 
         if (!configs.isEmpty()) {
             log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSize().fY);
-            bench->preDraw();
+            bench->delayedSetup();
         }
         for (int i = 0; i < configs.count(); ++i) {
             Target* target = is_enabled(b, configs[i]);
diff --git a/tools/VisualBench/VisualInteractiveModule.cpp b/tools/VisualBench/VisualInteractiveModule.cpp
index 538dda7..af922a9 100755
--- a/tools/VisualBench/VisualInteractiveModule.cpp
+++ b/tools/VisualBench/VisualInteractiveModule.cpp
@@ -98,7 +98,7 @@
     // clear both buffers
     fOwner->clear(canvas, SK_ColorWHITE, 2);
 
-    fBenchmark->preDraw();
+    fBenchmark->delayedSetup();
 
     return true;
 }
@@ -125,6 +125,7 @@
         }
         case kPreTiming_State: {
             fBenchmark->perCanvasPreDraw(canvas);
+            fBenchmark->preDraw(canvas);
             fCurrentFrame = 0;
             fTimer.start();
             fState = kTiming_State;
@@ -148,6 +149,7 @@
 
 void VisualInteractiveModule::perCanvasPreDraw(SkCanvas* canvas, State nextState) {
     fBenchmark->perCanvasPreDraw(canvas);
+    fBenchmark->preDraw(canvas);
     fCurrentFrame = 0;
     this->nextState(nextState);
 }
@@ -206,6 +208,7 @@
 }
 
 void VisualInteractiveModule::postDraw(SkCanvas* canvas) {
+    fBenchmark->postDraw(canvas);
     fBenchmark->perCanvasPostDraw(canvas);
     fBenchmark.reset(nullptr);
     fLoops = 1;
diff --git a/tools/VisualBench/VisualLightweightBenchModule.cpp b/tools/VisualBench/VisualLightweightBenchModule.cpp
index d5e4e5b..d54c788 100644
--- a/tools/VisualBench/VisualLightweightBenchModule.cpp
+++ b/tools/VisualBench/VisualLightweightBenchModule.cpp
@@ -169,7 +169,7 @@
 
     fOwner->clear(canvas, SK_ColorWHITE, 2);
 
-    fBenchmark->preDraw();
+    fBenchmark->delayedSetup();
     fRecords.push_back();
 
     // Log bench name
@@ -184,6 +184,7 @@
 
 void VisualLightweightBenchModule::perCanvasPreDraw(SkCanvas* canvas, State nextState) {
     fBenchmark->perCanvasPreDraw(canvas);
+    fBenchmark->preDraw(canvas);
     fCurrentFrame = 0;
     this->nextState(nextState);
 }
@@ -293,6 +294,7 @@
 }
 
 void VisualLightweightBenchModule::postDraw(SkCanvas* canvas) {
+    fBenchmark->postDraw(canvas);
     fBenchmark->perCanvasPostDraw(canvas);
     fBenchmark.reset(nullptr);
     fCurrentSample = 0;