Bug 893302 - Rename the CanvasClient class to include Deprecated so we can implement one on top of NewTextureHost. r=nical
authorMatt Woodrow <mwoodrow@mozilla.com>
Sat, 03 Aug 2013 13:29:28 -0400
changeset 153586 a525086d0bf298fa8d0d4f751eebb5c9273c6187
parent 153585 779afd60e5206c21a0844c0cb111cee536dbe426
child 153587 760e66b2908e70886892d68a45dbc7045bb5dec9
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs893302
milestone25.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 893302 - Rename the CanvasClient class to include Deprecated so we can implement one on top of NewTextureHost. r=nical
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/CanvasClient.h
gfx/layers/client/ClientCanvasLayer.h
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -23,37 +23,37 @@ namespace layers {
 
 /* static */ TemporaryRef<CanvasClient>
 CanvasClient::CreateCanvasClient(CanvasClientType aType,
                                  CompositableForwarder* aForwarder,
                                  TextureFlags aFlags)
 {
   if (aType == CanvasClientGLContext &&
       aForwarder->GetCompositorBackendType() == LAYERS_OPENGL) {
-    return new CanvasClientSurfaceStream(aForwarder, aFlags);
+    return new DeprecatedCanvasClientSurfaceStream(aForwarder, aFlags);
   }
-  return new CanvasClient2D(aForwarder, aFlags);
+  return new DeprecatedCanvasClient2D(aForwarder, aFlags);
 }
 
 void
-CanvasClient::Updated()
+DeprecatedCanvasClient2D::Updated()
 {
   mForwarder->UpdateTexture(this, 1, mDeprecatedTextureClient->GetDescriptor());
 }
 
 
-CanvasClient2D::CanvasClient2D(CompositableForwarder* aFwd,
-                               TextureFlags aFlags)
+DeprecatedCanvasClient2D::DeprecatedCanvasClient2D(CompositableForwarder* aFwd,
+                                                   TextureFlags aFlags)
 : CanvasClient(aFwd, aFlags)
 {
   mTextureInfo.mCompositableType = BUFFER_IMAGE_SINGLE;
 }
 
 void
-CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
+DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
 {
   if (!mDeprecatedTextureClient) {
     mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
     MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
   }
 
   bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
   gfxASurface::gfxContentType contentType = isOpaque
@@ -62,35 +62,35 @@ CanvasClient2D::Update(gfx::IntSize aSiz
   mDeprecatedTextureClient->EnsureAllocated(aSize, contentType);
 
   gfxASurface* surface = mDeprecatedTextureClient->LockSurface();
   aLayer->UpdateSurface(surface);
   mDeprecatedTextureClient->Unlock();
 }
 
 void
-CanvasClientSurfaceStream::Updated()
+DeprecatedCanvasClientSurfaceStream::Updated()
 {
   if (mNeedsUpdate) {
     mForwarder->UpdateTextureNoSwap(this, 1, mDeprecatedTextureClient->GetDescriptor());
     mNeedsUpdate = false;
   }
 }
 
 
-CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aFwd,
-                                                     TextureFlags aFlags)
+DeprecatedCanvasClientSurfaceStream::DeprecatedCanvasClientSurfaceStream(CompositableForwarder* aFwd,
+                                                                         TextureFlags aFlags)
 : CanvasClient(aFwd, aFlags)
 , mNeedsUpdate(false)
 {
   mTextureInfo.mCompositableType = BUFFER_IMAGE_SINGLE;
 }
 
 void
-CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
+DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
 {
   if (!mDeprecatedTextureClient) {
     mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL);
     MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
   }
 
   NS_ASSERTION(aLayer->mGLContext, "CanvasClientSurfaceStream should only be used with GL canvases");
 
--- a/gfx/layers/client/CanvasClient.h
+++ b/gfx/layers/client/CanvasClient.h
@@ -39,59 +39,70 @@ public:
   {
     mTextureInfo.mTextureFlags = aFlags;
   }
 
   virtual ~CanvasClient() {}
 
   virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) = 0;
 
-  virtual void Updated();
+  virtual void Updated() { }
 
-  virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
-                                      const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
-  {
-    mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
-  }
 protected:
-  RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
   TextureInfo mTextureInfo;
 };
 
 // Used for 2D canvases and WebGL canvas on non-GL systems where readback is requried.
-class CanvasClient2D : public CanvasClient
+class DeprecatedCanvasClient2D : public CanvasClient
 {
 public:
-  CanvasClient2D(CompositableForwarder* aLayerForwarder,
-                 TextureFlags aFlags);
-
-  TextureInfo GetTextureInfo() const MOZ_OVERRIDE
-  {
-    return mTextureInfo;
-  }
-
-  virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
-};
-
-// Used for GL canvases where we don't need to do any readback, i.e., with a
-// GL backend.
-class CanvasClientSurfaceStream : public CanvasClient
-{
-public:
-  CanvasClientSurfaceStream(CompositableForwarder* aFwd,
-                            TextureFlags aFlags);
+  DeprecatedCanvasClient2D(CompositableForwarder* aLayerForwarder,
+                           TextureFlags aFlags);
 
   TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
     return mTextureInfo;
   }
 
   virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
   virtual void Updated() MOZ_OVERRIDE;
 
+  virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
+                                      const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
+  {
+    mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
+  }
+
 private:
+  RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
+};
+
+// Used for GL canvases where we don't need to do any readback, i.e., with a
+// GL backend.
+class DeprecatedCanvasClientSurfaceStream : public CanvasClient
+{
+public:
+  DeprecatedCanvasClientSurfaceStream(CompositableForwarder* aFwd,
+                                      TextureFlags aFlags);
+
+  TextureInfo GetTextureInfo() const MOZ_OVERRIDE
+  {
+    return mTextureInfo;
+  }
+
+  virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
+  virtual void Updated() MOZ_OVERRIDE;
+
+  virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
+                                      const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
+  {
+    mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
+  }
+
+private:
+  RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
   bool mNeedsUpdate;
 };
 
 }
 }
 
 #endif
--- a/gfx/layers/client/ClientCanvasLayer.h
+++ b/gfx/layers/client/ClientCanvasLayer.h
@@ -81,15 +81,15 @@ protected:
     if (mGLContext) {
       return CanvasClient::CanvasClientGLContext;
     }
     return CanvasClient::CanvasClientSurface;
   }
 
   RefPtr<CanvasClient> mCanvasClient;
 
-  friend class CanvasClient2D;
-  friend class CanvasClientSurfaceStream;
+  friend class DeprecatedCanvasClient2D;
+  friend class DeprecatedCanvasClientSurfaceStream;
 };
 }
 }
 
 #endif