APZInputBridgeChild.h (2934B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_layers_APZInputBridgeChild_h 8 #define mozilla_layers_APZInputBridgeChild_h 9 10 #include "mozilla/layers/APZInputBridge.h" 11 #include "mozilla/layers/PAPZInputBridgeChild.h" 12 13 #include "mozilla/layers/GeckoContentControllerTypes.h" 14 15 namespace mozilla { 16 namespace layers { 17 18 class RemoteCompositorSession; 19 20 class APZInputBridgeChild : public PAPZInputBridgeChild, public APZInputBridge { 21 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(APZInputBridgeChild, final) 22 using TapType = GeckoContentController_TapType; 23 24 public: 25 static RefPtr<APZInputBridgeChild> Create( 26 const uint64_t& aProcessToken, 27 Endpoint<PAPZInputBridgeChild>&& aEndpoint); 28 29 void Destroy(); 30 31 void SetCompositorSession(RemoteCompositorSession* aSession); 32 33 APZEventResult ReceiveInputEvent( 34 InputData& aEvent, 35 InputBlockCallback&& aCallback = InputBlockCallback()) override; 36 37 MOZ_CAN_RUN_SCRIPT_BOUNDARY 38 mozilla::ipc::IPCResult RecvHandleTap( 39 const TapType& aType, const LayoutDevicePoint& aPoint, 40 const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, 41 const uint64_t& aInputBlockId, 42 const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics); 43 44 mozilla::ipc::IPCResult RecvCallInputBlockCallback( 45 uint64_t aInputBlockId, const APZHandledResult& handledResult); 46 47 protected: 48 void ProcessUnhandledEvent(LayoutDeviceIntPoint* aRefPoint, 49 ScrollableLayerGuid* aOutTargetGuid, 50 uint64_t* aOutFocusSequenceNumber, 51 LayersId* aOutLayersId) override; 52 53 void UpdateWheelTransaction( 54 LayoutDeviceIntPoint aRefPoint, EventMessage aEventMessage, 55 const Maybe<ScrollableLayerGuid>& aTargetGuid) override; 56 57 void ActorDestroy(ActorDestroyReason aWhy) override; 58 59 explicit APZInputBridgeChild(const uint64_t& aProcessToken); 60 virtual ~APZInputBridgeChild(); 61 62 private: 63 void Open(Endpoint<PAPZInputBridgeChild>&& aEndpoint); 64 65 MOZ_CAN_RUN_SCRIPT_BOUNDARY 66 void HandleTapOnMainThread( 67 const TapType& aType, const LayoutDevicePoint& aPoint, 68 const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, 69 const uint64_t& aInputBlockId, 70 const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics); 71 72 bool mIsOpen; 73 uint64_t mProcessToken; 74 MOZ_NON_OWNING_REF RemoteCompositorSession* mCompositorSession = nullptr; 75 76 using InputBlockCallbackMap = 77 std::unordered_map<uint64_t, InputBlockCallback>; 78 InputBlockCallbackMap mInputBlockCallbacks; 79 }; 80 81 } // namespace layers 82 } // namespace mozilla 83 84 #endif // mozilla_layers_APZInputBridgeChild_h