Move mFrontAndBackBufferDiffer to ContentClientDoubleBuffered. (bug 1409871 part 8, r=nical) draft
authorRyan Hunt <rhunt@eqrion.net>
Thu, 12 Oct 2017 12:58:17 -0400
changeset 684130 410b136e1c49586545e7285a2994bdae061c1845
parent 684129 ed1f305fccc7a67ed690b58b55a47072afba4b94
child 684131 ed130d22917161d3fa9f98f5090bd231f65ccaed
push id85567
push userbmo:rhunt@eqrion.net
push dateFri, 20 Oct 2017 22:13:22 +0000
reviewersnical
bugs1409871
milestone58.0a1
Move mFrontAndBackBufferDiffer to ContentClientDoubleBuffered. (bug 1409871 part 8, r=nical) Miscellaneous cleanup, ContentClientSingleBuffered doesn't need to track if the front and back buffer differ. MozReview-Commit-ID: IvAw0b92jsh
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ContentClient.h
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -466,22 +466,16 @@ ContentClientRemoteBuffer::Updated(const
   // by the time we paint next.
   mForwarder->UpdateTextureRegion(this,
                                   ThebesBufferData(BufferRect(),
                                                    BufferRotation()),
                                   updatedRegion);
   SwapBuffers(updatedRegion);
 }
 
-void
-ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
-{
-  mFrontAndBackBufferDiffer = true;
-}
-
 bool
 ContentClientRemoteBuffer::LockBuffers()
 {
   OpenMode mode = OpenMode::OPEN_READ_WRITE;
   if (mInAsyncPaint) {
     mode |= OpenMode::OPEN_ASYNC_WRITE;
   }
   if (mTextureClient) {
@@ -583,17 +577,17 @@ ContentClientDoubleBuffered::SwapBuffers
   mFrontBuffer = Some(RemoteRotatedBuffer(mTextureClient, mTextureClientOnWhite,
                                           mBufferRect, mBufferRotation));
 
   mTextureClient = newBack;
   mTextureClientOnWhite = newBackOnWhite;
   mBufferRect = newBackBufferRect;
   mBufferRotation = newBackBufferRotation;
 
-  ContentClientRemoteBuffer::SwapBuffers(aFrontUpdatedRegion);
+  mFrontAndBackBufferDiffer = true;
 }
 
 void
 ContentClientDoubleBuffered::BeginPaint()
 {
   ContentClientRemoteBuffer::BeginPaint();
 
   mIsNewBuffer = false;
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -185,17 +185,16 @@ class ContentClientRemoteBuffer : public
 {
   using RotatedContentBuffer::BufferRect;
   using RotatedContentBuffer::BufferRotation;
 public:
   explicit ContentClientRemoteBuffer(CompositableForwarder* aForwarder)
     : ContentClient(aForwarder)
     , RotatedContentBuffer(ContainsVisibleBounds)
     , mIsNewBuffer(false)
-    , mFrontAndBackBufferDiffer(false)
     , mSurfaceFormat(gfx::SurfaceFormat::B8G8R8A8)
   {}
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
   virtual void Clear() override
   {
@@ -238,18 +237,16 @@ public:
   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);
 
-  virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) override;
-
   // Expose these protected methods from the superclass.
   virtual const gfx::IntRect& BufferRect() const
   {
     return RotatedContentBuffer::BufferRect();
   }
   virtual const nsIntPoint& BufferRotation() const
   {
     return RotatedContentBuffer::BufferRotation();
@@ -297,17 +294,16 @@ protected:
   RefPtr<TextureClient> mTextureClient;
   RefPtr<TextureClient> mTextureClientOnWhite;
   // keep a record of texture clients we have created and need to keep around
   // (for RotatedBuffer to access), then unlock and remove them when we are done
   // painting.
   nsTArray<RefPtr<TextureClient> > mOldTextures;
 
   bool mIsNewBuffer;
-  bool mFrontAndBackBufferDiffer;
   gfx::IntSize mSize;
   gfx::SurfaceFormat mSurfaceFormat;
 };
 
 /**
  * A double buffered ContentClient. mTextureClient is the back buffer, which
  * we draw into. mFrontClient is the front buffer which we may read from, but
  * not write to, when the compositor does not have the 'soft' lock. We can write
@@ -318,16 +314,17 @@ protected:
  * references. In response to the compositor's reply we swap our references
  * (in SwapBuffers).
  */
 class ContentClientDoubleBuffered : public ContentClientRemoteBuffer
 {
 public:
   explicit ContentClientDoubleBuffered(CompositableForwarder* aFwd)
     : ContentClientRemoteBuffer(aFwd)
+    , mFrontAndBackBufferDiffer(false)
   {}
 
   virtual ~ContentClientDoubleBuffered() {}
 
   virtual void Clear() override
   {
     ContentClientRemoteBuffer::Clear();
     mFrontBuffer = Nothing();
@@ -364,16 +361,17 @@ private:
   {
     mTextureClient = nullptr;
     mTextureClientOnWhite = nullptr;
     mFrontBuffer = Nothing();
   }
 
   Maybe<RemoteRotatedBuffer> mFrontBuffer;
   nsIntRegion mFrontUpdatedRegion;
+  bool mFrontAndBackBufferDiffer;
 };
 
 /**
  * A single buffered ContentClient. We have a single TextureClient/Host
  * which we update and then send a message to the compositor that we are
  * done updating. It is not safe for the compositor to use the corresponding
  * TextureHost's memory directly, it must upload it to video memory of some
  * kind. We are free to modify the TextureClient once we receive reply from