tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RemoteContentController.h (4982B)


      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_RemoteContentController_h
      8 #define mozilla_layers_RemoteContentController_h
      9 
     10 #include "mozilla/layers/GeckoContentController.h"
     11 #include "mozilla/layers/PAPZParent.h"
     12 
     13 namespace mozilla {
     14 
     15 namespace dom {
     16 class BrowserParent;
     17 }
     18 
     19 namespace layers {
     20 
     21 struct DoubleTapToZoomMetrics;
     22 /**
     23 * RemoteContentController implements PAPZChild and is used to access a
     24 * GeckoContentController that lives in a different process.
     25 *
     26 * RemoteContentController lives on the compositor thread. All methods can
     27 * be called off the compositor thread and will get dispatched to the right
     28 * thread, with the exception of RequestContentRepaint and NotifyFlushComplete,
     29 * which must be called on the repaint thread, which in this case is the
     30 * compositor thread.
     31 */
     32 class RemoteContentController : public GeckoContentController,
     33                                public PAPZParent {
     34  using GeckoContentController::APZStateChange;
     35  using GeckoContentController::TapType;
     36 
     37 public:
     38  RemoteContentController();
     39 
     40  virtual ~RemoteContentController();
     41 
     42  void NotifyLayerTransforms(nsTArray<MatrixMessage>&& aTransforms) override;
     43 
     44  void RequestContentRepaint(const RepaintRequest& aRequest) override;
     45 
     46  void HandleTap(
     47      TapType aTapType, const LayoutDevicePoint& aPoint, Modifiers aModifiers,
     48      const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId,
     49      const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) override;
     50 
     51  void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType,
     52                          const ScrollableLayerGuid& aGuid,
     53                          const LayoutDevicePoint& aFocusPoint,
     54                          LayoutDeviceCoord aSpanChange,
     55                          Modifiers aModifiers) override;
     56 
     57  bool IsRepaintThread() override;
     58 
     59  void DispatchToRepaintThread(already_AddRefed<Runnable> aTask) override;
     60 
     61  void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
     62                            APZStateChange aChange, int aArg,
     63                            Maybe<uint64_t> aInputBlockId) override;
     64 
     65  void UpdateOverscrollVelocity(const ScrollableLayerGuid& aGuid, float aX,
     66                                float aY, bool aIsRootContent) override;
     67 
     68  void UpdateOverscrollOffset(const ScrollableLayerGuid& aGuid, float aX,
     69                              float aY, bool aIsRootContent) override;
     70 
     71  void HideDynamicToolbar(const ScrollableLayerGuid& aGuid) override;
     72 
     73  void NotifyMozMouseScrollEvent(const ScrollableLayerGuid::ViewID& aScrollId,
     74                                 const nsString& aEvent) override;
     75 
     76  void NotifyFlushComplete() override;
     77 
     78  void NotifyAsyncScrollbarDragInitiated(
     79      uint64_t aDragBlockId, const ScrollableLayerGuid::ViewID& aScrollId,
     80      ScrollDirection aDirection) override;
     81  void NotifyAsyncScrollbarDragRejected(
     82      const ScrollableLayerGuid::ViewID& aScrollId) override;
     83 
     84  void NotifyAsyncAutoscrollRejected(
     85      const ScrollableLayerGuid::ViewID& aScrollId) override;
     86 
     87  void CancelAutoscroll(const ScrollableLayerGuid& aScrollId) override;
     88 
     89  void NotifyScaleGestureComplete(const ScrollableLayerGuid& aGuid,
     90                                  float aScale) override;
     91 
     92  void ActorDestroy(ActorDestroyReason aWhy) override;
     93 
     94  void Destroy() override;
     95  mozilla::ipc::IPCResult RecvDestroy();
     96 
     97  bool IsRemote() override;
     98 
     99 private:
    100  nsCOMPtr<nsISerialEventTarget> mCompositorThread;
    101  bool mCanSend;
    102 
    103  void HandleTapOnParentProcessMainThread(
    104      TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
    105      ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
    106      const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
    107  void HandleTapOnGPUProcessMainThread(
    108      TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
    109      ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
    110      const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
    111  void NotifyPinchGestureOnCompositorThread(
    112      PinchGestureInput::PinchGestureType aType,
    113      const ScrollableLayerGuid& aGuid, const LayoutDevicePoint& aFocusPoint,
    114      LayoutDeviceCoord aSpanChange, Modifiers aModifiers);
    115 
    116  void CancelAutoscrollInProcess(const ScrollableLayerGuid& aScrollId);
    117  void CancelAutoscrollCrossProcess(const ScrollableLayerGuid& aScrollId);
    118  void NotifyScaleGestureCompleteInProcess(const ScrollableLayerGuid& aGuid,
    119                                           float aScale);
    120  void NotifyScaleGestureCompleteCrossProcess(const ScrollableLayerGuid& aGuid,
    121                                              float aScale);
    122 };
    123 
    124 }  // namespace layers
    125 
    126 }  // namespace mozilla
    127 
    128 #endif  // mozilla_layers_RemoteContentController_h