Bug 1533617 part 2. Improve MOZ_CAN_RUN_SCRIPT annotations around APZ tap events. r=kats
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 11 Mar 2019 14:18:51 +0000
changeset 521385 dc5ced18861d
parent 521384 7aefe7888eab
child 521386 341a6a2e5237
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1533617
milestone67.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 1533617 part 2. Improve MOZ_CAN_RUN_SCRIPT annotations around APZ tap events. r=kats Differential Revision: https://phabricator.services.mozilla.com/D22836
gfx/layers/apz/public/GeckoContentController.h
gfx/layers/apz/src/AsyncPanZoomController.h
gfx/layers/ipc/APZCTreeManagerChild.cpp
gfx/layers/ipc/APZCTreeManagerChild.h
--- a/gfx/layers/apz/public/GeckoContentController.h
+++ b/gfx/layers/apz/public/GeckoContentController.h
@@ -6,16 +6,17 @@
 
 #ifndef mozilla_layers_GeckoContentController_h
 #define mozilla_layers_GeckoContentController_h
 
 #include "InputData.h"                           // for PinchGestureInput
 #include "LayersTypes.h"                         // for ScrollDirection
 #include "Units.h"                               // for CSSPoint, CSSRect, etc
 #include "mozilla/Assertions.h"                  // for MOZ_ASSERT_HELPER2
+#include "mozilla/Attributes.h"                  // for MOZ_CAN_RUN_SCRIPT
 #include "mozilla/DefineEnum.h"                  // for MOZ_DEFINE_ENUM
 #include "mozilla/EventForwards.h"               // for Modifiers
 #include "mozilla/layers/MatrixMessage.h"        // for MatrixMessage
 #include "mozilla/layers/RepaintRequest.h"       // for RepaintRequest
 #include "mozilla/layers/ScrollableLayerGuid.h"  // for ScrollableLayerGuid, etc
 #include "nsISupportsImpl.h"
 
 namespace mozilla {
@@ -71,16 +72,17 @@ class GeckoContentController {
       eLongTapUp
   ));
   // clang-format on
 
   /**
    * Requests handling of a tap event. |aPoint| is in LD pixels, relative to the
    * current scroll offset.
    */
+  MOZ_CAN_RUN_SCRIPT
   virtual void HandleTap(TapType aType, const LayoutDevicePoint& aPoint,
                          Modifiers aModifiers, const ScrollableLayerGuid& aGuid,
                          uint64_t aInputBlockId) = 0;
 
   /**
    * When the apz.allow_zooming pref is set to false, the APZ will not
    * translate pinch gestures to actual zooming. Instead, it will call this
    * method to notify gecko of the pinch gesture, and allow it to deal with it
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -659,32 +659,34 @@ class AsyncPanZoomController {
    */
   nsEventStatus OnKeyboard(const KeyboardInput& aEvent);
 
   CSSPoint GetKeyboardDestination(const KeyboardScrollAction& aAction) const;
 
   /**
    * Helper methods for long press gestures.
    */
+  MOZ_CAN_RUN_SCRIPT_BOUNDARY
   nsEventStatus OnLongPress(const TapGestureInput& aEvent);
   nsEventStatus OnLongPressUp(const TapGestureInput& aEvent);
 
   /**
    * Helper method for single tap gestures.
    */
   nsEventStatus OnSingleTapUp(const TapGestureInput& aEvent);
 
   /**
    * Helper method for a single tap confirmed.
    */
   nsEventStatus OnSingleTapConfirmed(const TapGestureInput& aEvent);
 
   /**
    * Helper method for double taps.
    */
+  MOZ_CAN_RUN_SCRIPT_BOUNDARY
   nsEventStatus OnDoubleTap(const TapGestureInput& aEvent);
 
   /**
    * Helper method for double taps where the double-tap gesture is disabled.
    */
   nsEventStatus OnSecondTap(const TapGestureInput& aEvent);
 
   /**
--- a/gfx/layers/ipc/APZCTreeManagerChild.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerChild.cpp
@@ -122,17 +122,19 @@ void APZCTreeManagerChild::ActorDestroy(
 mozilla::ipc::IPCResult APZCTreeManagerChild::RecvHandleTap(
     const TapType& aType, const LayoutDevicePoint& aPoint,
     const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
     const uint64_t& aInputBlockId) {
   MOZ_ASSERT(XRE_IsParentProcess());
   if (mCompositorSession &&
       mCompositorSession->RootLayerTreeId() == aGuid.mLayersId &&
       mCompositorSession->GetContentController()) {
-    mCompositorSession->GetContentController()->HandleTap(
+    RefPtr<GeckoContentController> controller =
+      mCompositorSession->GetContentController();
+    controller->HandleTap(
         aType, aPoint, aModifiers, aGuid, aInputBlockId);
     return IPC_OK();
   }
   dom::TabParent* tab =
       dom::TabParent::GetTabParentFromLayersId(aGuid.mLayersId);
   if (tab) {
     tab->SendHandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
   }
--- a/gfx/layers/ipc/APZCTreeManagerChild.h
+++ b/gfx/layers/ipc/APZCTreeManagerChild.h
@@ -61,16 +61,17 @@ class APZCTreeManagerChild : public IAPZ
 
   APZInputBridge* InputBridge() override;
 
   void AddIPDLReference();
   void ReleaseIPDLReference();
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
  protected:
+  MOZ_CAN_RUN_SCRIPT_BOUNDARY
   mozilla::ipc::IPCResult RecvHandleTap(const TapType& aType,
                                         const LayoutDevicePoint& aPoint,
                                         const Modifiers& aModifiers,
                                         const ScrollableLayerGuid& aGuid,
                                         const uint64_t& aInputBlockId);
 
   mozilla::ipc::IPCResult RecvNotifyPinchGesture(
       const PinchGestureType& aType, const ScrollableLayerGuid& aGuid,