Bug 1576390 - Remove now-unused DrawWindowOverlay and WindowOverlayChanged methods. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Wed, 13 Nov 2019 02:24:06 +0000
changeset 501830 628967f53151659cf2666e15d50f37fd80952d9a
parent 501829 fbab3b7be09261b604148655537ba0ff90d2a9fb
child 501831 16bc115ecd46ed37ff921ed4273532c16d3b0205
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1576390
milestone72.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 1576390 - Remove now-unused DrawWindowOverlay and WindowOverlayChanged methods. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D52748
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayersMessages.ipdlh
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderLayerManager.h
widget/CompositorWidget.h
widget/InProcessCompositorWidget.cpp
widget/InProcessCompositorWidget.h
widget/nsBaseWidget.h
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -111,17 +111,16 @@ void LayerManagerComposite::ClearCachedR
   // XXX the old LayerManagerOGL code had a mMaybeInvalidTree that it set to
   // true here. Do we need that?
 }
 
 HostLayerManager::HostLayerManager()
     : mDebugOverlayWantsNextFrame(false),
       mWarningLevel(0.0f),
       mCompositorBridgeID(0),
-      mWindowOverlayChanged(false),
       mLastPaintTime(TimeDuration::Forever()),
       mRenderStartTime(TimeStamp::Now()) {}
 
 HostLayerManager::~HostLayerManager() {}
 
 void HostLayerManager::RecordPaintTimes(const PaintTiming& aTiming) {
   mDiagnostics->RecordPaintTimes(aTiming);
 }
@@ -613,17 +612,17 @@ void LayerManagerComposite::UpdateAndRen
       // If we didn't have a previous layer tree, invalidate the entire render
       // area.
       mInvalidRegion = mRenderBounds;
     }
 
     invalid = mInvalidRegion;
   }
 
-  if (invalid.IsEmpty() && !mWindowOverlayChanged) {
+  if (invalid.IsEmpty()) {
     // Composition requested, but nothing has changed. Don't do any work.
     mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
     mProfilerScreenshotGrabber.NotifyEmptyFrame();
 
     // Discard the current payloads. These payloads did not require a composite
     // (they caused no changes to anything visible), so we don't want to measure
     // their latency.
     mPayload.Clear();
@@ -641,17 +640,16 @@ void LayerManagerComposite::UpdateAndRen
 
   bool rendered = Render(invalid, opaque);
 #if defined(MOZ_WIDGET_ANDROID)
   RenderToPresentationSurface();
 #endif
 
   if (!mTarget && rendered) {
     mInvalidRegion.SetEmpty();
-    mWindowOverlayChanged = false;
   }
 
   // Update cached layer tree information.
   mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
 }
 
 already_AddRefed<DrawTarget> LayerManagerComposite::CreateOptimalMaskDrawTarget(
     const IntSize& aSize) {
@@ -1269,20 +1267,16 @@ bool LayerManagerComposite::Render(const
         mCompositionRecorder->RecordFrame(frame);
       }
     }
   }
 
   if (usingNativeLayers) {
     UpdateDebugOverlayNativeLayers();
   } else {
-    // Allow widget to render a custom foreground.
-    mCompositor->GetWidget()->DrawWindowOverlay(
-        &widgetContext, LayoutDeviceIntRect::FromUnknownRect(bounds));
-
 #if defined(MOZ_WIDGET_ANDROID)
     if (AndroidDynamicToolbarAnimator::IsEnabled()) {
       // Depending on the content shift the toolbar may be rendered on top of
       // some of the content so it must be rendered after the content.
       RenderToolbar();
     }
     HandlePixelsTarget();
 #endif  // defined(MOZ_WIDGET_ANDROID)
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -155,21 +155,16 @@ class HostLayerManager : public LayerMan
     if (mWarnTime.IsNull() || severity > mWarningLevel ||
         mWarnTime + TimeDuration::FromMilliseconds(kVisualWarningDuration) <
             now) {
       mWarnTime = now;
       mWarningLevel = severity;
     }
   }
 
-  // Indicate that we need to composite even if nothing in our layers has
-  // changed, so that the widget can draw something different in its window
-  // overlay.
-  void SetWindowOverlayChanged() { mWindowOverlayChanged = true; }
-
   void SetPaintTime(const TimeDuration& aPaintTime) {
     mLastPaintTime = aPaintTime;
   }
 
   virtual bool AlwaysScheduleComposite() const { return false; }
   virtual bool IsCompositingToScreen() const { return false; }
 
   void RecordPaintTimes(const PaintTiming& aTiming);
@@ -218,17 +213,16 @@ class HostLayerManager : public LayerMan
   nsTArray<ImageCompositeNotificationInfo> mImageCompositeNotifications;
   // Testing property. If hardware composer is supported, this will return
   // true if the last frame was deemed 'too complicated' to be rendered.
   float mWarningLevel;
   mozilla::TimeStamp mWarnTime;
   UniquePtr<Diagnostics> mDiagnostics;
   uint64_t mCompositorBridgeID;
 
-  bool mWindowOverlayChanged;
   TimeDuration mLastPaintTime;
   TimeStamp mRenderStartTime;
   UniquePtr<CompositionRecorder> mCompositionRecorder = nullptr;
 
   // Render time for the current composition.
   TimeStamp mCompositionTime;
 
   // When nonnull, during rendering, some compositable indicated that it will
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -258,20 +258,16 @@ mozilla::ipc::IPCResult LayerTransaction
         UpdateHitTestingTree(layer, "CreateRefLayer");
         break;
       }
       case Edit::TOpSetDiagnosticTypes: {
         mLayerManager->SetDiagnosticTypes(
             edit.get_OpSetDiagnosticTypes().diagnostics());
         break;
       }
-      case Edit::TOpWindowOverlayChanged: {
-        mLayerManager->SetWindowOverlayChanged();
-        break;
-      }
       // Tree ops
       case Edit::TOpSetRoot: {
         MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
 
         Layer* newRoot = AsLayer(edit.get_OpSetRoot().root());
         if (!newRoot) {
           return IPC_FAIL_NO_REASON(this);
         }
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -423,17 +423,16 @@ struct OpSetLayerAttributes {
 struct OpSetRoot          { LayerHandle root; };
 struct OpInsertAfter      { LayerHandle container; LayerHandle childLayer; LayerHandle after; };
 struct OpPrependChild     { LayerHandle container; LayerHandle childLayer; };
 struct OpRemoveChild      { LayerHandle container; LayerHandle childLayer; };
 struct OpRepositionChild  { LayerHandle container; LayerHandle childLayer; LayerHandle after; };
 struct OpRaiseToTopChild  { LayerHandle container; LayerHandle childLayer; };
 
 struct OpSetDiagnosticTypes { DiagnosticTypes diagnostics; };
-struct OpWindowOverlayChanged { };
 
 struct ShmemSection {
   Shmem shmem;
   uint32_t offset;
   uint32_t size;
 };
 
 struct CrossProcessSemaphoreDescriptor {
@@ -553,18 +552,17 @@ union Edit {
   OpCreatePaintedLayer;
   OpCreateContainerLayer;
   OpCreateImageLayer;
   OpCreateColorLayer;
   OpCreateCanvasLayer;
   OpCreateRefLayer;
 
   OpSetDiagnosticTypes;
-  OpWindowOverlayChanged;
-
+  
   OpSetRoot;
   OpInsertAfter;
   OpPrependChild;
   OpRemoveChild;
   OpRepositionChild;
   OpRaiseToTopChild;
 
   OpAttachCompositable;
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -187,17 +187,16 @@ RefPtr<KnowsCompositor> ShadowLayerForwa
 }
 
 ShadowLayerForwarder::ShadowLayerForwarder(
     ClientLayerManager* aClientLayerManager)
     : mClientLayerManager(aClientLayerManager),
       mMessageLoop(MessageLoop::current()),
       mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC),
       mIsFirstPaint(false),
-      mWindowOverlayChanged(false),
       mNextLayerHandle(1) {
   mTxn = new Transaction();
   if (TabGroup* tabGroup = mClientLayerManager->GetTabGroup()) {
     mEventTarget = tabGroup->EventTargetFor(TaskCategory::Other);
   }
   MOZ_ASSERT(mEventTarget || !XRE_IsContentProcess());
   mActiveResourceTracker = MakeUnique<ActiveResourceTracker>(
       1000, "CompositableForwarder", mEventTarget);
@@ -560,19 +559,16 @@ bool ShadowLayerForwarder::EndTransactio
   MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?");
 
   DiagnosticTypes diagnostics =
       gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes();
   if (mDiagnosticTypes != diagnostics) {
     mDiagnosticTypes = diagnostics;
     mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics));
   }
-  if (mWindowOverlayChanged) {
-    mTxn->AddEdit(OpWindowOverlayChanged());
-  }
 
   AutoTxnEnd _(mTxn);
 
   if (mTxn->Empty() && !mTxn->RotationChanged()) {
     MOZ_LAYERS_LOG(
         ("[LayersForwarder] 0-length cset (?) and no rotation event, skipping "
          "Update()"));
     return true;
@@ -655,18 +651,16 @@ bool ShadowLayerForwarder::EndTransactio
     setAttrs.AppendElement(op);
   }
 
   if (mTxn->mCset.IsEmpty() && mTxn->mPaints.IsEmpty() && setAttrs.IsEmpty() &&
       !mTxn->RotationChanged()) {
     return true;
   }
 
-  mWindowOverlayChanged = false;
-
   info.cset() = std::move(mTxn->mCset);
   info.setSimpleAttrs() = std::move(setSimpleAttrs);
   info.setAttrs() = std::move(setAttrs);
   info.paints() = std::move(mTxn->mPaints);
   info.toDestroy() = mTxn->mDestroyedActors;
   info.fwdTransactionId() = GetFwdTransactionId();
   info.id() = aId;
   info.plugins() = mPluginWindowData;
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -287,18 +287,16 @@ class ShadowLayerForwarder final : publi
   LayerTransactionChild* GetShadowManager() const {
     return mShadowManager.get();
   }
 
   // Send a synchronous message asking the LayerTransactionParent in the
   // compositor to shutdown.
   void SynchronouslyShutdown();
 
-  virtual void WindowOverlayChanged() { mWindowOverlayChanged = true; }
-
   /**
    * The following Alloc/Open/Destroy interfaces abstract over the
    * details of working with surfaces that are shared across
    * processes.  They provide the glue between C++ Layers and the
    * LayerComposite IPC system.
    *
    * The basic lifecycle is
    *
@@ -419,17 +417,16 @@ class ShadowLayerForwarder final : publi
 
  private:
   ClientLayerManager* mClientLayerManager;
   Transaction* mTxn;
   MessageLoop* mMessageLoop;
   DiagnosticTypes mDiagnosticTypes;
   bool mIsFirstPaint;
   FocusTarget mFocusTarget;
-  bool mWindowOverlayChanged;
   nsTArray<PluginWindowData> mPluginWindowData;
   UniquePtr<ActiveResourceTracker> mActiveResourceTracker;
   uint64_t mNextLayerHandle;
   nsDataHashtable<nsUint64HashKey, CompositableClient*> mCompositables;
   PaintTiming mPaintTiming;
   /**
    * ShadowLayerForwarder might dispatch tasks to main while puppet widget and
    * browserChild don't exist anymore; therefore we hold the event target since
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -31,17 +31,16 @@ namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
 WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
     : mWidget(aWidget),
       mLatestTransactionId{0},
-      mWindowOverlayChanged(false),
       mNeedsComposite(false),
       mIsFirstPaint(false),
       mTarget(nullptr),
       mPaintSequenceNumber(0),
       mWebRenderCommandBuilder(this) {
   MOZ_COUNT_CTOR(WebRenderLayerManager);
   for (auto renderRoot : wr::kRenderRoots) {
     mStateManagers[renderRoot].mRenderRoot = renderRoot;
@@ -186,26 +185,16 @@ bool WebRenderLayerManager::BeginTransac
   ++mPaintSequenceNumber;
   if (StaticPrefs::apz_test_logging_enabled()) {
     mApzTestData.StartNewPaint(mPaintSequenceNumber);
   }
   return true;
 }
 
 bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
-  if (mWindowOverlayChanged) {
-    // If the window overlay changed then we can't do an empty transaction
-    // because we need to repaint the window overlay which we only currently
-    // support in a full transaction.
-    // XXX If we end up hitting this branch a lot we can probably optimize it
-    // by just sending an updated window overlay image instead of rebuilding
-    // the entire WR display list.
-    return false;
-  }
-
   // Since we don't do repeat transactions right now, just set the time
   mAnimationReadyTime = TimeStamp::Now();
 
   mLatestTransactionId =
       mTransactionIdAllocator->GetTransactionId(/*aThrottle*/ true);
 
   if (aFlags & EndTransactionFlags::END_NO_COMPOSITE &&
       !mWebRenderCommandBuilder.NeedsEmptyTransaction()) {
@@ -357,17 +346,16 @@ void WebRenderLayerManager::EndTransacti
       printf_stderr("(no display list; background only)\n");
       builderDumpIndex =
           builder.Dump(/*indent*/ 1, Some(builderDumpIndex), Nothing());
     }
   }
 
   mWidget->AddWindowOverlayWebRenderCommands(WrBridge(), builder,
                                              resourceUpdates);
-  mWindowOverlayChanged = false;
   if (dumpEnabled) {
     printf_stderr("(window overlay)\n");
     Unused << builder.Dump(/*indent*/ 1, Some(builderDumpIndex), Nothing());
   }
 
   for (auto& stateManager : mStateManagers) {
     if (AsyncPanZoomEnabled()) {
       auto& scrollData = mScrollDatas[stateManager.GetRenderRoot()];
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -171,17 +171,16 @@ class WebRenderLayerManager final : publ
   WebRenderUserDataRefTable* GetWebRenderUserDataTable() {
     return mWebRenderCommandBuilder.GetWebRenderUserDataTable();
   }
   WebRenderScrollData& GetScrollData(wr::RenderRoot aRenderRoot) {
     return mScrollDatas[aRenderRoot];
   }
 
   void WrUpdated();
-  void WindowOverlayChanged() { mWindowOverlayChanged = true; }
   nsIWidget* GetWidget() { return mWidget; }
 
   dom::TabGroup* GetTabGroup();
 
   uint32_t StartFrameTimeRecording(int32_t aBufferSize) override;
   void StopFrameTimeRecording(uint32_t aStartIndex,
                               nsTArray<float>& aFrameIntervals) override;
 
@@ -210,17 +209,16 @@ class WebRenderLayerManager final : publ
   TransactionId mLatestTransactionId;
 
   nsTArray<DidCompositeObserver*> mDidCompositeObservers;
 
   // This holds the scroll data that we need to send to the compositor for
   // APZ to do it's job
   wr::RenderRootArray<WebRenderScrollData> mScrollDatas;
 
-  bool mWindowOverlayChanged;
   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
   // a PLayers:Update.  We save the original non-default target to
   // mTarget, and then perform the transaction. After the transaction ends,
--- a/widget/CompositorWidget.h
+++ b/widget/CompositorWidget.h
@@ -123,24 +123,16 @@ class CompositorWidget {
    * When native layers are used, StartRemoteDrawing(InRegion) and
    * EndRemoteDrawing(InRegion) will not be called.
    */
   virtual RefPtr<layers::NativeLayerRoot> GetNativeLayerRoot() {
     return nullptr;
   }
 
   /**
-   * Called after the LayerManager draws the layer tree
-   *
-   * Always called from the compositing thread.
-   */
-  virtual void DrawWindowOverlay(WidgetRenderingContext* aContext,
-                                 LayoutDeviceIntRect aRect) {}
-
-  /**
    * Return a DrawTarget for the window which can be composited into.
    *
    * Only called if GetNativeLayerRoot() returns nullptr.
    * Called by BasicCompositor on the compositor thread for OMTC drawing
    * before each composition (unless there's a native layer root).
    *
    * The window may specify its buffer mode. If unspecified, it is assumed
    * to require double-buffering.
--- a/widget/InProcessCompositorWidget.cpp
+++ b/widget/InProcessCompositorWidget.cpp
@@ -44,21 +44,16 @@ void InProcessCompositorWidget::PostRend
   mWidget->PostRender(aContext);
 }
 
 RefPtr<layers::NativeLayerRoot>
 InProcessCompositorWidget::GetNativeLayerRoot() {
   return mWidget->GetNativeLayerRoot();
 }
 
-void InProcessCompositorWidget::DrawWindowOverlay(
-    WidgetRenderingContext* aContext, LayoutDeviceIntRect aRect) {
-  mWidget->DrawWindowOverlay(aContext, aRect);
-}
-
 already_AddRefed<gfx::DrawTarget>
 InProcessCompositorWidget::StartRemoteDrawing() {
   return mWidget->StartRemoteDrawing();
 }
 
 already_AddRefed<gfx::DrawTarget>
 InProcessCompositorWidget::StartRemoteDrawingInRegion(
     LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
--- a/widget/InProcessCompositorWidget.h
+++ b/widget/InProcessCompositorWidget.h
@@ -15,18 +15,16 @@ namespace widget {
 class InProcessCompositorWidget : public CompositorWidget {
  public:
   explicit InProcessCompositorWidget(const layers::CompositorOptions& aOptions,
                                      nsBaseWidget* aWidget);
 
   virtual bool PreRender(WidgetRenderingContext* aManager) override;
   virtual void PostRender(WidgetRenderingContext* aManager) override;
   virtual RefPtr<layers::NativeLayerRoot> GetNativeLayerRoot() override;
-  virtual void DrawWindowOverlay(WidgetRenderingContext* aContext,
-                                 LayoutDeviceIntRect aRect) override;
   virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
   virtual already_AddRefed<gfx::DrawTarget> StartRemoteDrawingInRegion(
       LayoutDeviceIntRegion& aInvalidRegion,
       layers::BufferMode* aBufferMode) override;
   virtual void EndRemoteDrawing() override;
   virtual void EndRemoteDrawingInRegion(
       gfx::DrawTarget* aDrawTarget,
       const LayoutDeviceIntRegion& aInvalidRegion) override;
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -443,19 +443,16 @@ class nsBaseWidget : public nsIWidget, p
   // implement, or none if supporting out-of-process compositing.
   virtual bool PreRender(mozilla::widget::WidgetRenderingContext* aContext) {
     return true;
   }
   virtual void PostRender(mozilla::widget::WidgetRenderingContext* aContext) {}
   virtual RefPtr<mozilla::layers::NativeLayerRoot> GetNativeLayerRoot() {
     return nullptr;
   }
-  virtual void DrawWindowOverlay(
-      mozilla::widget::WidgetRenderingContext* aContext,
-      LayoutDeviceIntRect aRect) {}
   virtual already_AddRefed<DrawTarget> StartRemoteDrawing();
   virtual already_AddRefed<DrawTarget> StartRemoteDrawingInRegion(
       LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode) {
     return StartRemoteDrawing();
   }
   virtual void EndRemoteDrawing() {}
   virtual void EndRemoteDrawingInRegion(
       DrawTarget* aDrawTarget, const LayoutDeviceIntRegion& aInvalidRegion) {