Bug 1251716 - use UniquePtr instead of ScopedDeletePtr in DrawTargetCairo; r=jrmuizel
authorNathan Froyd <froydnj@mozilla.com>
Fri, 26 Feb 2016 13:34:11 -0500
changeset 322254 8e93182402a9742f890c722ae8057e724105a21b
parent 322253 e2d9ecda1acf2939def4dcefb9acd0a62b76c768
child 322255 67c35da48ad1cdac96d77c5dd33cfab9612971ca
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1251716
milestone47.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 1251716 - use UniquePtr instead of ScopedDeletePtr in DrawTargetCairo; r=jrmuizel UniquePtr is more standard than ScopedDeletePtr; using standard constructs whenever possible is preferable.
gfx/2d/DrawTargetCairo.cpp
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -7,16 +7,17 @@
 
 #include "SourceSurfaceCairo.h"
 #include "PathCairo.h"
 #include "HelpersCairo.h"
 #include "ScaledFontBase.h"
 #include "BorrowedContext.h"
 #include "FilterNodeSoftware.h"
 #include "mozilla/Scoped.h"
+#include "mozilla/UniquePtr.h"
 #include "mozilla/Vector.h"
 
 #include "cairo.h"
 #include "cairo-tee.h"
 #include <string.h>
 
 #include "Blur.h"
 #include "Logging.h"
@@ -1698,29 +1699,28 @@ DrawTargetCairo::OptimizeSourceSurface(S
 
   Drawable pixmap = XCreatePixmap(dpy, RootWindowOfScreen(screen),
                                   size.width, size.height,
                                   xrenderFormat->depth);
   if (!pixmap) {
     return surface.forget();
   }
 
-  ScopedDeletePtr<DestroyPixmapClosure> closure(
-    new DestroyPixmapClosure(pixmap, screen));
+  auto closure = MakeUnique<DestroyPixmapClosure>(pixmap, screen);
 
   ScopedCairoSurface csurf(
     cairo_xlib_surface_create_with_xrender_format(dpy, pixmap,
                                                   screen, xrenderFormat,
                                                   size.width, size.height));
   if (!csurf || cairo_surface_status(csurf)) {
     return surface.forget();
   }
 
   cairo_surface_set_user_data(csurf, &gDestroyPixmapKey,
-                              closure.forget(), DestroyPixmap);
+                              closure.release(), DestroyPixmap);
 
   RefPtr<DrawTargetCairo> dt = new DrawTargetCairo();
   if (!dt->Init(csurf, size, &format)) {
     return surface.forget();
   }
 
   dt->CopySurface(aSurface,
                   IntRect(0, 0, size.width, size.height),