Bug 1356317 - Avoid intermittent debug assertions in browser chrome tests when creation of draw targets fails. r=jimm, a=jcristau FENNEC_55_0b8_BUILD1 FENNEC_55_0b8_RELEASE FIREFOX_55_0b8_BUILD1 FIREFOX_55_0b8_RELEASE
authorStephen A Pohl <spohl.mozilla.bugs@gmail.com>
Tue, 04 Jul 2017 13:45:18 -0500
changeset 414243 0a457907494285ecf2e1745b222436d775476d17
parent 414242 e39f3951ae1cd63cac90615f3b4ed2667d3a3eea
child 414244 2d3be0615a30e0405111e3a663904e6ac2603b28
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, jcristau
bugs1356317
milestone55.0
Bug 1356317 - Avoid intermittent debug assertions in browser chrome tests when creation of draw targets fails. r=jimm, a=jcristau
widget/windows/WinCompositorWidget.cpp
--- a/widget/windows/WinCompositorWidget.cpp
+++ b/widget/windows/WinCompositorWidget.cpp
@@ -99,20 +99,26 @@ WinCompositorWidget::StartRemoteDrawing(
   IntSize size = surf->GetSize();
   if (size.width <= 0 || size.height <= 0) {
     if (dc) {
       FreeWindowSurface(dc);
     }
     return nullptr;
   }
 
-  MOZ_ASSERT(!mCompositeDC);
-  mCompositeDC = dc;
+  RefPtr<DrawTarget> dt =
+    mozilla::gfx::Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(),
+                                                           size);
+  if (dt) {
+    mCompositeDC = dc;
+  } else {
+    FreeWindowSurface(dc);
+  }
 
-  return mozilla::gfx::Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(), size);
+  return dt.forget();
 }
 
 void
 WinCompositorWidget::EndRemoteDrawing()
 {
   MOZ_ASSERT(!mLockedBackBufferData);
 
   if (mTransparencyMode == eTransparencyTransparent) {