Bug 1306234 - Back out changeset f7aeb4b3ccb1 (bug 1279398) for causing top crashes. r=edwin, a=ritu
authorEdwin Flores <eflores@mozilla.com>
Tue, 27 Sep 2016 19:52:17 +0100
changeset 355792 1283217c5463dc3206ec563f3609809a1da3275d
parent 355791 fef3ee4668579fc66566c77f240f1c0e10dba886
child 355793 3db11822d83f7a97cb882ec8338578f50b51a994
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin, ritu
bugs1306234, 1279398
milestone51.0a2
Bug 1306234 - Back out changeset f7aeb4b3ccb1 (bug 1279398) for causing top crashes. r=edwin, a=ritu
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxASurface.h
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -166,17 +166,17 @@ gfxASurface::Wrap (cairo_surface_t *csur
     }
 #endif
 #ifdef CAIRO_HAS_QUARTZ_SURFACE
     else if (stype == CAIRO_SURFACE_TYPE_QUARTZ) {
         result = new gfxQuartzSurface(csurf, aSize);
     }
 #endif
     else {
-        MOZ_CRASH("Unknown cairo surface type");
+        result = new gfxUnknownSurface(csurf, aSize);
     }
 
     // fprintf(stderr, "New wrapper for %p -> %p\n", csurf, result);
 
     return result.forget();
 }
 
 void
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -178,9 +178,27 @@ private:
 
     int32_t mFloatingRefs;
     int32_t mBytesRecorded;
 
 protected:
     bool mSurfaceValid;
 };
 
+/**
+ * An Unknown surface; used to wrap unknown cairo_surface_t returns from cairo
+ */
+class gfxUnknownSurface : public gfxASurface {
+public:
+    gfxUnknownSurface(cairo_surface_t *surf, const mozilla::gfx::IntSize& aSize)
+        : mSize(aSize)
+    {
+        Init(surf, true);
+    }
+
+    virtual ~gfxUnknownSurface() { }
+    virtual const mozilla::gfx::IntSize GetSize() const override { return mSize; }
+
+private:
+    mozilla::gfx::IntSize mSize;
+};
+
 #endif /* GFX_ASURFACE_H */