Flush GrContext between benchmark draw loops

This change updates a small subset of benchmarks to flush the GrContext
between draw loops (specifically SKP benchmarks, SampleApp, and the
warmup in visualbench). This helps improve timing accuracy by not
allowing the gpu to batch across draw boundaries in the affected
benchmarks.

BUG=skia:

Review URL: https://codereview.chromium.org/1427533002
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 4426133..910af6b 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -10,6 +10,10 @@
 #include "SkMultiPictureDraw.h"
 #include "SkSurface.h"
 
+#if SK_SUPPORT_GPU
+#include "GrContext.h"
+#endif
+
 // These CPU tile sizes are not good per se, but they are similar to what Chrome uses.
 DEFINE_int32(CPUbenchTileW, 256, "Tile width  used for CPU SKP playback.");
 DEFINE_int32(CPUbenchTileH, 256, "Tile height used for CPU SKP playback.");
@@ -115,6 +119,12 @@
             this->drawPicture();
         }
     }
+#if SK_SUPPORT_GPU
+    // Ensure the GrContext doesn't batch across draw loops.
+    if (GrContext* context = canvas->getGrContext()) {
+        context->flush();
+    }
+#endif
 }
 
 void SKPBench::drawMPDPicture() {