Bug 1498699 - Move the FIRST_PAINT notification from AndroidDynamicToolbarAnimator to UiCompositorControllerParent. r=jnicol
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 15 Oct 2018 13:20:27 +0000
changeset 499750 da505775320b6d209ecac91e25d018b7b7197894
parent 499749 dcd095eb89108d1171c25b9d32ca01a6d317087f
child 499751 8866a66f76593da837ea35dc27ebf5e289735c7f
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjnicol
bugs1498699
milestone64.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 1498699 - Move the FIRST_PAINT notification from AndroidDynamicToolbarAnimator to UiCompositorControllerParent. r=jnicol Depends on D8657 Differential Revision: https://phabricator.services.mozilla.com/D8658
gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
gfx/layers/composite/AsyncCompositionManager.cpp
gfx/layers/ipc/UiCompositorControllerParent.cpp
gfx/layers/ipc/UiCompositorControllerParent.h
--- a/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
+++ b/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
@@ -437,17 +437,16 @@ AndroidDynamicToolbarAnimator::UpdateAni
   return continueAnimating;
 }
 
 void
 AndroidDynamicToolbarAnimator::FirstPaint()
 {
   MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
   mCompositorReceivedFirstPaint = true;
-  PostMessage(FIRST_PAINT);
 }
 
 void
 AndroidDynamicToolbarAnimator::UpdateRootFrameMetrics(const FrameMetrics& aMetrics)
 {
   CSSToScreenScale scale = ViewTargetAs<ScreenPixel>(aMetrics.GetZoom().ToScaleFactor(),
                                                      PixelCastJustification::ScreenIsParentLayerForRoot);
   ScreenPoint scrollOffset = aMetrics.GetScrollOffset() * scale;
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -1015,16 +1015,20 @@ AsyncCompositionManager::ApplyAsyncConte
                 mRootScrollableId = metrics.GetScrollId();
                 Compositor* compositor = mLayerManager->GetCompositor();
                 if (CompositorBridgeParent* bridge = compositor->GetCompositorBridgeParent()) {
                   AndroidDynamicToolbarAnimator* animator = bridge->GetAndroidDynamicToolbarAnimator();
                   MOZ_ASSERT(animator);
                   if (mIsFirstPaint) {
                     animator->UpdateRootFrameMetrics(metrics);
                     animator->FirstPaint();
+                    LayersId rootLayerTreeId = bridge->RootLayerTreeId();
+                    if (RefPtr<UiCompositorControllerParent> uiController = UiCompositorControllerParent::GetFromRootLayerTreeId(rootLayerTreeId)) {
+                      uiController->NotifyFirstPaint();
+                    }
                     mIsFirstPaint = false;
                   }
                   if (mLayersUpdated) {
                     LayersId rootLayerTreeId = bridge->RootLayerTreeId();
                     if (RefPtr<UiCompositorControllerParent> uiController = UiCompositorControllerParent::GetFromRootLayerTreeId(rootLayerTreeId)) {
                       uiController->NotifyLayersUpdated();
                     }
                     mLayersUpdated = false;
--- a/gfx/layers/ipc/UiCompositorControllerParent.cpp
+++ b/gfx/layers/ipc/UiCompositorControllerParent.cpp
@@ -241,16 +241,23 @@ UiCompositorControllerParent::NotifyLaye
 {
 #ifdef MOZ_WIDGET_ANDROID
   if (mCompositorLayersUpdateEnabled) {
     ToolbarAnimatorMessageFromCompositor(LAYERS_UPDATED);
   }
 #endif
 }
 
+void
+UiCompositorControllerParent::NotifyFirstPaint()
+{
+  ToolbarAnimatorMessageFromCompositor(FIRST_PAINT);
+}
+
+
 UiCompositorControllerParent::UiCompositorControllerParent(const LayersId& aRootLayerTreeId)
   : mRootLayerTreeId(aRootLayerTreeId)
 #ifdef MOZ_WIDGET_ANDROID
   , mCompositorLayersUpdateEnabled(false)
 #endif
   , mMaxToolbarHeight(0)
 {
   MOZ_COUNT_CTOR(UiCompositorControllerParent);
--- a/gfx/layers/ipc/UiCompositorControllerParent.h
+++ b/gfx/layers/ipc/UiCompositorControllerParent.h
@@ -46,16 +46,17 @@ public:
 #if defined(MOZ_WIDGET_ANDROID)
   void RegisterAndroidDynamicToolbarAnimator(AndroidDynamicToolbarAnimator* aAnimator);
 #endif // MOZ_WIDGET_ANDROID
   void ToolbarAnimatorMessageFromCompositor(int32_t aMessage);
   bool AllocPixelBuffer(const int32_t aSize, Shmem* aMem);
 
   // Called when a layer has been updated so the UI thread may be notified if necessary.
   void NotifyLayersUpdated();
+  void NotifyFirstPaint();
 
 private:
   explicit UiCompositorControllerParent(const LayersId& aRootLayerTreeId);
   ~UiCompositorControllerParent();
   void InitializeForSameProcess();
   void InitializeForOutOfProcess();
   void Initialize();
   void Open(Endpoint<PUiCompositorControllerParent>&& aEndpoint);