Remove ContentClientRemote. (bug 1409871 part 1, r=nical) draft
authorRyan Hunt <rhunt@eqrion.net>
Wed, 11 Oct 2017 12:43:39 -0400
changeset 684123 672583eb655d89fa231f83617b9aae32c496cc6f
parent 682778 9f8b3fc384ae6fe8053b087548c57020a55f00fd
child 684124 8025b2a5620a4e4aaf437e6816078821f63e82e8
push id85567
push userbmo:rhunt@eqrion.net
push dateFri, 20 Oct 2017 22:13:22 +0000
reviewersnical
bugs1409871
milestone58.0a1
Remove ContentClientRemote. (bug 1409871 part 1, r=nical) This class doesn't seem to be necessary and only complicates the class hierarchy. MozReview-Commit-ID: 6dRXce1vB9T
gfx/layers/client/ClientPaintedLayer.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ContentClient.h
--- a/gfx/layers/client/ClientPaintedLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -76,18 +76,18 @@ ClientPaintedLayer::CanRecordLayer(Readb
 
 void
 ClientPaintedLayer::UpdateContentClient(PaintState& aState)
 {
   Mutated();
 
   AddToValidRegion(aState.mRegionToDraw);
 
-  ContentClientRemote *contentClientRemote =
-      static_cast<ContentClientRemote *>(mContentClient.get());
+  ContentClientRemoteBuffer *contentClientRemote =
+      static_cast<ContentClientRemoteBuffer *>(mContentClient.get());
   MOZ_ASSERT(contentClientRemote->GetIPCHandle());
 
   // Hold(this) ensures this layer is kept alive through the current transaction
   // The ContentClient assumes this layer is kept alive (e.g., in CreateBuffer),
   // so deleting this Hold for whatever reason will break things.
   ClientManager()->Hold(this);
   contentClientRemote->Updated(aState.mRegionToDraw,
                                mVisibleRegion.ToUnknownRegion(),
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -21,17 +21,17 @@ namespace mozilla {
 namespace layers {
 
 class CompositableClient;
 class ImageBridgeChild;
 class ImageContainer;
 class CompositableForwarder;
 class CompositableChild;
 class TextureClientRecycleAllocator;
-class ContentClientRemote;
+class ContentClientRemoteBuffer;
 
 /**
  * CompositableClient manages the texture-specific logic for composite layers,
  * independently of the layer. It is the content side of a CompositableClient/
  * CompositableHost pair.
  *
  * CompositableClient's purpose is to send texture data to the compositor side
  * along with any extra information about how the texture is to be composited.
@@ -160,18 +160,16 @@ public:
   /**
    * Should be called when deataching a TextureClient from a Compositable, because
    * some platforms need to do some extra book keeping when this happens.
    *
    * See AutoRemoveTexture to automatically invoke this at the end of a scope.
    */
   virtual void RemoveTexture(TextureClient* aTexture);
 
-  virtual ContentClientRemote* AsContentClientRemote() { return nullptr; }
-
   void InitIPDL(const CompositableHandle& aHandle);
 
   TextureFlags GetTextureFlags() const { return mTextureFlags; }
 
   TextureClientRecycleAllocator* GetTextureClientRecycler();
 
   bool HasTextureClientRecycler() { return !!mTextureClientRecycler; }
 
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -293,17 +293,17 @@ ContentClientRemoteBuffer::EndPaint(nsTA
     mTextureClient->Unlock();
     mTextureClient->SyncWithObject(mForwarder->GetSyncObject());
   }
   if (mTextureClientOnWhite && mTextureClientOnWhite->IsLocked()) {
     mTextureClientOnWhite->Unlock();
     mTextureClientOnWhite->SyncWithObject(mForwarder->GetSyncObject());
   }
 
-  ContentClientRemote::EndPaint(aReadbackUpdates);
+  ContentClient::EndPaint(aReadbackUpdates);
 }
 
 void
 ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat,
                                                const IntRect& aRect,
                                                uint32_t aFlags)
 {
   // If we hit this assertion, then it might be due to an empty transaction
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -110,35 +110,16 @@ public:
   virtual void BeginPaint() {}
   virtual void BeginAsyncPaint();
   virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr);
 
 protected:
   bool mInAsyncPaint;
 };
 
-/**
- * A ContentClient for use with OMTC.
- */
-class ContentClientRemote : public ContentClient
-{
-public:
-  explicit ContentClientRemote(CompositableForwarder* aForwarder)
-    : ContentClient(aForwarder)
-  {}
-
-  virtual void Updated(const nsIntRegion& aRegionToDraw,
-                       const nsIntRegion& aVisibleRegion,
-                       bool aDidSelfCopy) = 0;
-
-  ContentClientRemote* AsContentClientRemote() override {
-    return this;
-  }
-};
-
 // thin wrapper around RotatedContentBuffer, for on-mtc
 class ContentClientBasic final : public ContentClient
                                , protected RotatedContentBuffer
 {
 public:
   explicit ContentClientBasic(gfx::BackendType aBackend);
 
   typedef RotatedContentBuffer::PaintState PaintState;
@@ -182,39 +163,39 @@ public:
     MOZ_CRASH("GFX: Should not be called on non-remote ContentClient");
   }
 
 private:
   gfx::BackendType mBackend;
 };
 
 /**
- * A ContentClientRemote backed by a RotatedContentBuffer.
+ * A ContentClient backed by a RotatedContentBuffer.
  *
- * When using a ContentClientRemote, SurfaceDescriptors are created on
+ * When using a ContentClientRemoteBuffer, SurfaceDescriptors are created on
  * the rendering side and destroyed on the compositing side. They are only
  * passed from one side to the other when the TextureClient/Hosts are created.
  * *Ownership* of the SurfaceDescriptor moves from the rendering side to the
  * compositing side with the create message (send from CreateBuffer) which
  * tells the compositor that TextureClients have been created and that the
  * compositor should assign the corresponding TextureHosts to our corresponding
  * ContentHost.
  *
  * If the size or type of our buffer(s) change(s), then we simply destroy and
  * create them.
  */
 // Version using new texture clients
-class ContentClientRemoteBuffer : public ContentClientRemote
+class ContentClientRemoteBuffer : public ContentClient
                                 , protected RotatedContentBuffer
 {
   using RotatedContentBuffer::BufferRect;
   using RotatedContentBuffer::BufferRotation;
 public:
   explicit ContentClientRemoteBuffer(CompositableForwarder* aForwarder)
-    : ContentClientRemote(aForwarder)
+    : ContentClient(aForwarder)
     , RotatedContentBuffer(ContainsVisibleBounds)
     , mIsNewBuffer(false)
     , mFrontAndBackBufferDiffer(false)
     , mSurfaceFormat(gfx::SurfaceFormat::B8G8R8A8)
   {}
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
@@ -258,17 +239,17 @@ public:
    * are affected by mapping/unmapping.
    */
   virtual void BeginPaint() override;
   virtual void BeginAsyncPaint() override;
   virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr) override;
 
   virtual void Updated(const nsIntRegion& aRegionToDraw,
                        const nsIntRegion& aVisibleRegion,
-                       bool aDidSelfCopy) override;
+                       bool aDidSelfCopy);
 
   virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override;
 
   // Expose these protected methods from the superclass.
   virtual const gfx::IntRect& BufferRect() const
   {
     return RotatedContentBuffer::BufferRect();
   }