Bug 1447299 - Move the RunOnControllerThread from APZCTreeManager::SetLongTapEnabled to the caller. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 28 Mar 2018 14:56:48 -0400
changeset 774004 6ae32df4223671f5be360da5293703491f72db81
parent 774003 07b61ef11e41353805565afa94365dcc85de3d83
child 774005 a750744bd2203f3e7711ea5f88ab2b1c5fa5c8bb
push id104365
push userkgupta@mozilla.com
push dateWed, 28 Mar 2018 18:59:12 +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: 8VfEDVVFNl8
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
@@ -2529,19 +2529,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