Bug 1284721 - Flush CanvasRenderingContext2D's DrawTarget when returning it to the BufferProvider. r=lsalzman
authorNicolas Silva <nsilva@mozilla.com>
Mon, 11 Jul 2016 17:44:27 +0200
changeset 304556 3a276d3d8d6b2f0581a4fd275b3301567fc7fd09
parent 304555 da1046d9acb778c40b5dc573d60040c3be29217d
child 304557 0dd733f54a0d9022b0f59864f92a2075ce263d3e
push id30557
push usercbook@mozilla.com
push dateTue, 12 Jul 2016 09:08:54 +0000
treeherderautoland@722bbf56e5da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1284721
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1284721 - Flush CanvasRenderingContext2D's DrawTarget when returning it to the BufferProvider. r=lsalzman
dom/canvas/CanvasRenderingContext2D.cpp
gfx/layers/PersistentBufferProvider.cpp
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -899,19 +899,16 @@ public:
   static void PreTransactionCallback(void* aData)
   {
     CanvasRenderingContext2DUserData* self =
       static_cast<CanvasRenderingContext2DUserData*>(aData);
     CanvasRenderingContext2D* context = self->mContext;
     if (!context || !context->mTarget)
       return;
 
-    // Since SkiaGL default to store drawing command until flush
-    // We will have to flush it before present.
-    context->mTarget->Flush();
     context->ReturnTarget();
   }
 
   static void DidTransactionCallback(void* aData)
   {
     CanvasRenderingContext2DUserData* self =
       static_cast<CanvasRenderingContext2DUserData*>(aData);
     if (self->mContext) {
--- a/gfx/layers/PersistentBufferProvider.cpp
+++ b/gfx/layers/PersistentBufferProvider.cpp
@@ -35,16 +35,21 @@ PersistentBufferProviderBasic::BorrowDra
   return dt.forget();
 }
 
 bool
 PersistentBufferProviderBasic::ReturnDrawTarget(already_AddRefed<gfx::DrawTarget> aDT)
 {
   RefPtr<gfx::DrawTarget> dt(aDT);
   MOZ_ASSERT(mDrawTarget == dt);
+  if (dt) {
+    // Since SkiaGL default to storing drawing command until flush
+    // we have to flush it before present.
+    dt->Flush();
+  }
   return true;
 }
 
 already_AddRefed<gfx::SourceSurface>
 PersistentBufferProviderBasic::BorrowSnapshot()
 {
   mSnapshot = mDrawTarget->Snapshot();
   RefPtr<SourceSurface> snapshot = mSnapshot;