Bug 1269892 - Dump the name of TextureSource when fails to cast it as TextureSourceOGL, r?nical draft
authorpeter chang <pchang@mozilla.com>
Mon, 16 May 2016 17:29:57 +0800
changeset 367629 1792bf68bfe3bf1743f8c3cc30491ddd0a523a1f
parent 364682 bae525a694e2dc0aa433885be8751330d4995a49
child 369975 7a8b75a9f46d4909133a16655f1875cd2593a3b8
push id18297
push userbmo:howareyou322@gmail.com
push dateTue, 17 May 2016 01:55:15 +0000
reviewersnical
bugs1269892
milestone49.0a1
Bug 1269892 - Dump the name of TextureSource when fails to cast it as TextureSourceOGL, r?nical MozReview-Commit-ID: IAW98qk3987
gfx/layers/composite/TextureHost.h
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -106,17 +106,20 @@ public:
   /**
    * Return the pixel format of this texture
    */
   virtual gfx::SurfaceFormat GetFormat() const { return gfx::SurfaceFormat::UNKNOWN; }
 
   /**
    * Cast to a TextureSource for for each backend..
    */
-  virtual TextureSourceOGL* AsSourceOGL() { return nullptr; }
+  virtual TextureSourceOGL* AsSourceOGL() {
+    gfxCriticalNote << "Failed to cast " << Name() << " into a TextureSourceOGL";
+    return nullptr;
+  }
   virtual TextureSourceD3D9* AsSourceD3D9() { return nullptr; }
   virtual TextureSourceD3D11* AsSourceD3D11() { return nullptr; }
   virtual TextureSourceBasic* AsSourceBasic() { return nullptr; }
   /**
    * Cast to a DataTextureSurce.
    */
   virtual DataTextureSource* AsDataTextureSource() { return nullptr; }