Bug 1447299 - Move the RunOnControllerThread from APZCTreeManager::SetLongTapEnabled to the caller. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 22 Mar 2018 16:35:23 -0400
changeset 771266 82138e76aa6e8e716e60886fe9fa9e0b6c588b7f
parent 771265 137ce36e461701ea60e49c38f31768d11f9af3d1
child 771267 deb84fcbd209072b009aaa13f96d7e79cdea78c4
push id103646
push userkgupta@mozilla.com
push dateThu, 22 Mar 2018 21:38:36 +0000
reviewersbotond
bugs1447299
milestone61.0a1
Bug 1447299 - Move the RunOnControllerThread from APZCTreeManager::SetLongTapEnabled to the caller. r?botond This is functionally a no-op (it just moves the thread-bouncing code from inside APZCTreeManager::SetLongTapEnabled to the call site in APZCTreeManagerParent. The other call site, in widget/android/nsWindow.cpp, is already known to be running on the controller thread (which would be the Java UI thread in that case). This makes the code in APZCTreeManagerParent more consistent and simplifies the next changes. MozReview-Commit-ID: 7bDWS9auknL
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/ipc/APZCTreeManagerParent.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -2528,19 +2528,18 @@ APZCTreeManager::BuildOverscrollHandoffC
   }
 
   return result;
 }
 
 void
 APZCTreeManager::SetLongTapEnabled(bool aLongTapEnabled)
 {
-  APZThreadUtils::RunOnControllerThread(
-    NewRunnableFunction("SetLongTapEnabledRunnable",
-                        GestureEventListener::SetLongTapEnabled, aLongTapEnabled));
+  APZThreadUtils::AssertOnControllerThread();
+  GestureEventListener::SetLongTapEnabled(aLongTapEnabled);
 }
 
 RefPtr<HitTestingTreeNode>
 APZCTreeManager::FindScrollThumbNode(const AsyncDragMetrics& aDragMetrics)
 {
   RecursiveMutexAutoLock lock(mTreeLock);
 
   return DepthFirstSearch<ReverseIterator>(mRootNode.get(),
--- a/gfx/layers/ipc/APZCTreeManagerParent.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerParent.cpp
@@ -200,16 +200,22 @@ APZCTreeManagerParent::RecvStopAutoscrol
         mTreeManager,
         &IAPZCTreeManager::StopAutoscroll,
         aGuid));
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvSetLongTapEnabled(const bool& aTapGestureEnabled)
+APZCTreeManagerParent::RecvSetLongTapEnabled(const bool& aLongTapEnabled)
 {
-  mTreeManager->SetLongTapEnabled(aTapGestureEnabled);
+  APZThreadUtils::RunOnControllerThread(
+      NewRunnableMethod<bool>(
+        "layers::IAPZCTreeManager::SetLongTapEnabled",
+        mTreeManager,
+        &IAPZCTreeManager::SetLongTapEnabled,
+        aLongTapEnabled));
+
   return IPC_OK();
 }
 
 } // namespace layers
 } // namespace mozilla