Bug 1403915 - Remove some leftover Layer-related goop. r?jrmuizel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 03 Oct 2017 16:31:08 -0400
changeset 674470 1b76e5465fd51d4f7d387055e16b8406d4c13cac
parent 674469 dd14cd329d4fa04da37b0628d0204038a27b4c06
child 674471 06afde8f092cef86a8d6cf55f7c4cf60a34fd394
push id82854
push userkgupta@mozilla.com
push dateTue, 03 Oct 2017 21:03:51 +0000
reviewersjrmuizel
bugs1403915
milestone58.0a1
Bug 1403915 - Remove some leftover Layer-related goop. r?jrmuizel MozReview-Commit-ID: 2XCJaRcQR3s
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderLayerManager.h
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -169,29 +169,24 @@ WebRenderLayerManager::BeginTransaction(
     mApzTestData.StartNewPaint(mPaintSequenceNumber);
   }
   return true;
 }
 
 bool
 WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags)
 {
-  if (!mRoot) {
-    // With the WebRenderLayerManager we reject attempts to set most kind of
-    // "pending data" for empty transactions. Any place that attempts to update
-    // transforms or scroll offset, for example, will get failure return values
-    // back, and will fall back to a full transaction. Therefore the only piece
-    // of "pending" information we need to send in an empty transaction is the
-    // APZ focus state.
-    WrBridge()->SendSetFocusTarget(mFocusTarget);
-    return true;
-  }
-
-  // We might used painted layer images so don't delete them yet.
-  return EndTransactionInternal(aFlags);
+  // With the WebRenderLayerManager we reject attempts to set most kind of
+  // "pending data" for empty transactions. Any place that attempts to update
+  // transforms or scroll offset, for example, will get failure return values
+  // back, and will fall back to a full transaction. Therefore the only piece
+  // of "pending" information we need to send in an empty transaction is the
+  // APZ focus state.
+  WrBridge()->SendSetFocusTarget(mFocusTarget);
+  return true;
 }
 
 /*static*/ int32_t
 PopulateScrollData(WebRenderScrollData& aTarget, Layer* aLayer)
 {
   MOZ_ASSERT(aLayer);
 
   // We want to allocate a WebRenderLayerScrollData object for this layer,
@@ -839,21 +834,16 @@ WebRenderLayerManager::EndTransactionInt
                                mLatestTransactionId, mScrollData, transactionStart);
   }
 
   MakeSnapshotIfRequired(size);
   mNeedsComposite = false;
 
   ClearDisplayItemLayers();
 
-  // this may result in Layers being deleted, which results in
-  // PLayer::Send__delete__() and DeallocShmem()
-  mKeepAlive.Clear();
-  ClearMutatedLayers();
-
   return true;
 }
 
 void
 WebRenderLayerManager::SetFocusTarget(const FocusTarget& aFocusTarget)
 {
   mFocusTarget = aFocusTarget;
 }
@@ -985,54 +975,16 @@ WebRenderLayerManager::DiscardLocalImage
   // Removes images but doesn't tell the parent side about them
   // This is useful in empty / failed transactions where we created
   // image keys but didn't tell the parent about them yet.
   mImageKeysToDeleteLater.Clear();
   mImageKeysToDelete.Clear();
 }
 
 void
-WebRenderLayerManager::Mutated(Layer* aLayer)
-{
-  LayerManager::Mutated(aLayer);
-  AddMutatedLayer(aLayer);
-}
-
-void
-WebRenderLayerManager::MutatedSimple(Layer* aLayer)
-{
-  LayerManager::Mutated(aLayer);
-  AddMutatedLayer(aLayer);
-}
-
-void
-WebRenderLayerManager::AddMutatedLayer(Layer* aLayer)
-{
-  mMutatedLayers.AppendElement(aLayer);
-}
-
-void
-WebRenderLayerManager::ClearMutatedLayers()
-{
-  mMutatedLayers.Clear();
-}
-
-bool
-WebRenderLayerManager::IsMutatedLayer(Layer* aLayer)
-{
-  return mMutatedLayers.Contains(aLayer);
-}
-
-void
-WebRenderLayerManager::Hold(Layer* aLayer)
-{
-  mKeepAlive.AppendElement(aLayer);
-}
-
-void
 WebRenderLayerManager::SetLayerObserverEpoch(uint64_t aLayerObserverEpoch)
 {
   if (WrBridge()->IPCOpen()) {
     WrBridge()->SendSetLayerObserverEpoch(aLayerObserverEpoch);
   }
 }
 
 void
@@ -1083,21 +1035,16 @@ WebRenderLayerManager::ClearLayer(Layer*
     ClearLayer(child);
   }
 }
 
 void
 WebRenderLayerManager::ClearCachedResources(Layer* aSubtree)
 {
   WrBridge()->BeginClearCachedResources();
-  if (aSubtree) {
-    ClearLayer(aSubtree);
-  } else if (mRoot) {
-    ClearLayer(mRoot);
-  }
   DiscardImages();
   WrBridge()->EndClearCachedResources();
 }
 
 void
 WebRenderLayerManager::UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier,
                                                       uint64_t aDeviceResetSeqNo)
 {
@@ -1159,17 +1106,18 @@ void
 WebRenderLayerManager::ScheduleComposite()
 {
   WrBridge()->SendForceComposite();
 }
 
 void
 WebRenderLayerManager::SetRoot(Layer* aLayer)
 {
-  mRoot = aLayer;
+  // This should never get called
+  MOZ_ASSERT(false);
 }
 
 bool
 WebRenderLayerManager::SetPendingScrollUpdateForNextTransaction(FrameMetrics::ViewID aScrollId,
                                                                 const ScrollUpdateInfo& aUpdateInfo)
 {
   // If we ever support changing the scroll position in an "empty transactions"
   // properly in WR we can fill this in. Covered by bug 1382259.
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -166,22 +166,17 @@ public:
   // going, and when they end we discard them and remove them from the active
   // list.
   void AddActiveCompositorAnimationId(uint64_t aId);
   void AddCompositorAnimationsIdForDiscard(uint64_t aId);
   void DiscardCompositorAnimations();
 
   WebRenderBridgeChild* WrBridge() const { return mWrChild; }
 
-  virtual void Mutated(Layer* aLayer) override;
-  virtual void MutatedSimple(Layer* aLayer) override;
-
-  void Hold(Layer* aLayer);
   void SetTransactionIncomplete() { mTransactionIncomplete = true; }
-  bool IsMutatedLayer(Layer* aLayer);
 
   // See equivalent function in ClientLayerManager
   void LogTestDataForCurrentPaint(FrameMetrics::ViewID aScrollId,
                                   const std::string& aKey,
                                   const std::string& aValue) {
     MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.LogTestDataForPaint(mPaintSequenceNumber, aScrollId, aKey, aValue);
   }
@@ -297,18 +292,16 @@ private:
 
   RefPtr<WebRenderBridgeChild> mWrChild;
 
   RefPtr<TransactionIdAllocator> mTransactionIdAllocator;
   uint64_t mLatestTransactionId;
 
   nsTArray<DidCompositeObserver*> mDidCompositeObservers;
 
-  LayerRefArray mKeepAlive;
-
   // These fields are used to save a copy of the display list for
   // empty transactions in layers-free mode.
   wr::BuiltDisplayList mBuiltDisplayList;
   nsTArray<WebRenderParentCommand> mParentCommands;
 
   // This holds the scroll data that we need to send to the compositor for
   // APZ to do it's job
   WebRenderScrollData mScrollData;
@@ -332,22 +325,16 @@ public:
   // is true, and that will incur a performance penalty for all the hashmap
   // operations, so is probably not worth it. With the current code we might
   // end up creating multiple clips in WR that are effectively identical but
   // have separate clip ids. Hopefully this won't happen very often.
   typedef std::unordered_map<const DisplayItemClipChain*, wr::WrClipId> ClipIdMap;
 private:
   ClipIdMap mClipIdCache;
 
-  // Layers that have been mutated. If we have an empty transaction
-  // then a display item layer will no longer be valid
-  // if it was a mutated layers.
-  void AddMutatedLayer(Layer* aLayer);
-  void ClearMutatedLayers();
-  LayerRefArray mMutatedLayers;
   bool mTransactionIncomplete;
 
   bool mNeedsComposite;
   bool mIsFirstPaint;
   FocusTarget mFocusTarget;
 
  // When we're doing a transaction in order to draw to a non-default
  // target, the layers transaction is only performed in order to send