If a layer contains a filter, flush the compositor context before the filter
bitmap goes out of scope.

BUG=159874


Review URL: https://chromiumcodereview.appspot.com/11365172

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166963 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index 7016d91..e5e4347 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -648,6 +648,11 @@
     setShaderOpacity(quad->opacity(), shaderAlphaLocation);
     setShaderQuadF(surfaceQuad, shaderQuadLocation);
     drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation);
+
+    // Flush the compositor context before the filter bitmap goes out of
+    // scope, so the draw gets processed before the filter texture gets deleted.
+    if (filterBitmap.getTexture())
+        m_context->flush();
 }
 
 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorDrawQuad* quad)