Bug 1455715 - Fix some controller thread tasks that were bypassing the updater thread. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 20 Apr 2018 14:27:35 -0400
changeset 785831 7565ec12514f7928016cc4c69c42c6f19c139acc
parent 785586 cc0d7de218cb0c260c8ba0cf6637845ad2222f49
push id107329
push userkgupta@mozilla.com
push dateFri, 20 Apr 2018 18:27:58 +0000
reviewersbotond
bugs1455715
milestone61.0a1
Bug 1455715 - Fix some controller thread tasks that were bypassing the updater thread. r?botond These tasks have an implicit ordering with other tasks that are dispatched from the compositor thread to the updater thread, and so they need to be bounced through the updater thread before we run them on the controller thread. MozReview-Commit-ID: 92nIYgyV8A2
gfx/layers/ipc/CompositorBridgeParent.cpp
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -1394,19 +1394,20 @@ CompositorBridgeParent::SetTestAsyncZoom
     mApzUpdater->SetTestAsyncZoom(aLayersId, aScrollId, aZoom);
   }
 }
 
 void
 CompositorBridgeParent::FlushApzRepaints(const LayersId& aLayersId)
 {
   MOZ_ASSERT(mApzcTreeManager);
+  MOZ_ASSERT(mApzUpdater);
   MOZ_ASSERT(aLayersId.IsValid());
   RefPtr<CompositorBridgeParent> self = this;
-  APZThreadUtils::RunOnControllerThread(NS_NewRunnableFunction(
+  mApzUpdater->RunOnControllerThread(aLayersId, NS_NewRunnableFunction(
     "layers::CompositorBridgeParent::FlushApzRepaints",
     [=]() { self->mApzcTreeManager->FlushApzRepaints(aLayersId); }));
 }
 
 void
 CompositorBridgeParent::GetAPZTestData(const LayersId& aLayersId,
                                        APZTestData* aOutData)
 {
@@ -1416,32 +1417,32 @@ CompositorBridgeParent::GetAPZTestData(c
   }
 }
 
 void
 CompositorBridgeParent::SetConfirmedTargetAPZC(const LayersId& aLayersId,
                                                const uint64_t& aInputBlockId,
                                                const nsTArray<ScrollableLayerGuid>& aTargets)
 {
-  if (!mApzcTreeManager) {
+  if (!mApzcTreeManager || !mApzUpdater) {
     return;
   }
   // Need to specifically bind this since it's overloaded.
   void (APZCTreeManager::*setTargetApzcFunc)
         (uint64_t, const nsTArray<ScrollableLayerGuid>&) =
         &APZCTreeManager::SetTargetAPZC;
   RefPtr<Runnable> task =
     NewRunnableMethod<uint64_t,
                       StoreCopyPassByConstLRef<nsTArray<ScrollableLayerGuid>>>(
       "layers::CompositorBridgeParent::SetConfirmedTargetAPZC",
       mApzcTreeManager.get(),
       setTargetApzcFunc,
       aInputBlockId,
       aTargets);
-  APZThreadUtils::RunOnControllerThread(task.forget());
+  mApzUpdater->RunOnControllerThread(aLayersId, task.forget());
 }
 
 void
 CompositorBridgeParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
 {
   NS_ASSERTION(!mLayerManager, "Already initialised mLayerManager");
   NS_ASSERTION(!mCompositor,   "Already initialised mCompositor");