Bug 947213 - Fix an e10s with basic layers crash. r=bjacob
authorNicolas Silva <nical@mozilla.com>
Thu, 23 Jan 2014 15:11:36 +0100
changeset 180854 d97cb0a0873a4843919f1d3a26bd58d6ccb740b9
parent 180853 b10b085ab73c804f01f38fd150d95bb0314115c7
child 180855 4ba9cf2966f6d1cbc3a26f92ab594d76c5f33638
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs947213
milestone29.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 947213 - Fix an e10s with basic layers crash. r=bjacob
gfx/layers/basic/BasicCompositor.cpp
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -91,27 +91,36 @@ public:
 
 protected:
   virtual void UpdateImpl(const SurfaceDescriptor& aImage,
                           nsIntRegion *aRegion,
                           nsIntPoint*) MOZ_OVERRIDE
   {
     AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
     nsRefPtr<gfxASurface> surface = ShadowLayerForwarder::OpenDescriptor(OPEN_READ_ONLY, aImage);
+    if (!surface) {
+      if (aImage.type() != SurfaceDescriptor::TShmem &&
+          aImage.type() != SurfaceDescriptor::TMemoryImage &&
+          aImage.type() != SurfaceDescriptor::TRGBImage) {
+        printf_stderr("Unsupported SurfaceDescriptor type: %i\n", static_cast<int>(aImage.type()));
+      }
+      NS_WARNING("Could not open the SurfaceDescriptor");
+      return;
+    }
     nsRefPtr<gfxImageSurface> image = surface->GetAsImageSurface();
     mFormat = ImageFormatToSurfaceFormat(image->Format());
     mSize = IntSize(image->Width(), image->Height());
     mSurface = Factory::CreateWrappingDataSourceSurface(image->Data(),
                                                         image->Stride(),
                                                         mSize,
                                                         mFormat);
   }
 
   virtual bool EnsureSurface() {
-    return true;
+    return mSurface != nullptr;
   }
 
   virtual bool Lock() MOZ_OVERRIDE {
     return EnsureSurface();
   }
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE {
     if (!mSurface) {