tor-browser

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

UiCompositorControllerParent.h (3421B)


      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 #ifndef include_gfx_ipc_UiCompositorControllerParent_h
      7 #define include_gfx_ipc_UiCompositorControllerParent_h
      8 
      9 #include "mozilla/layers/PUiCompositorControllerParent.h"
     10 #include "mozilla/layers/CompositorScrollUpdate.h"
     11 #include "mozilla/layers/LayersTypes.h"
     12 #include "mozilla/ipc/Shmem.h"
     13 #include "mozilla/RefPtr.h"
     14 
     15 namespace mozilla {
     16 namespace layers {
     17 
     18 struct FrameMetrics;
     19 
     20 class UiCompositorControllerParent final
     21    : public PUiCompositorControllerParent {
     22  // UiCompositorControllerChild needs to call the private constructor when
     23  // running in process.
     24  friend class UiCompositorControllerChild;
     25 
     26 public:
     27  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UiCompositorControllerParent, final)
     28 
     29  static RefPtr<UiCompositorControllerParent> GetFromRootLayerTreeId(
     30      const LayersId& aRootLayerTreeId);
     31  static RefPtr<UiCompositorControllerParent> Start(
     32      const LayersId& aRootLayerTreeId,
     33      Endpoint<PUiCompositorControllerParent>&& aEndpoint);
     34 
     35  // PUiCompositorControllerParent functions
     36  mozilla::ipc::IPCResult RecvPause();
     37  mozilla::ipc::IPCResult RecvResume(bool* aOutResumed);
     38  mozilla::ipc::IPCResult RecvResumeAndResize(const int32_t& aX,
     39                                              const int32_t& aY,
     40                                              const int32_t& aHeight,
     41                                              const int32_t& aWidth,
     42                                              bool* aOutResumed);
     43  mozilla::ipc::IPCResult RecvInvalidateAndRender();
     44  mozilla::ipc::IPCResult RecvMaxToolbarHeight(const int32_t& aHeight);
     45  mozilla::ipc::IPCResult RecvFixedBottomOffset(const int32_t& aOffset);
     46  mozilla::ipc::IPCResult RecvDefaultClearColor(const uint32_t& aColor);
     47  mozilla::ipc::IPCResult RecvRequestScreenPixels();
     48  mozilla::ipc::IPCResult RecvEnableLayerUpdateNotifications(
     49      const bool& aEnable);
     50  void ActorDestroy(ActorDestroyReason aWhy) override;
     51 
     52  // Class specific functions
     53  void ToolbarAnimatorMessageFromCompositor(int32_t aMessage);
     54  bool AllocPixelBuffer(const int32_t aSize, Shmem* aMem);
     55 
     56  // Called when a layer has been updated so the UI thread may be notified if
     57  // necessary.
     58  void NotifyLayersUpdated();
     59  void NotifyFirstPaint();
     60  void NotifyCompositorScrollUpdate(const CompositorScrollUpdate& aUpdate);
     61 
     62 private:
     63  explicit UiCompositorControllerParent(const LayersId& aRootLayerTreeId);
     64  virtual ~UiCompositorControllerParent();
     65  void InitializeForSameProcess();
     66  void InitializeForOutOfProcess();
     67  void Initialize();
     68  void Open(Endpoint<PUiCompositorControllerParent>&& aEndpoint);
     69  void Shutdown();
     70 
     71  LayersId mRootLayerTreeId;
     72 
     73 #if defined(MOZ_WIDGET_ANDROID)
     74  bool mCompositorLayersUpdateEnabled;  // Flag set to true when the UI thread
     75                                        // is expecting to be notified when a
     76                                        // layer has been updated
     77 #endif                                  // defined(MOZ_WIDGET_ANDROID)
     78 
     79  int32_t mMaxToolbarHeight;
     80 };
     81 
     82 }  // namespace layers
     83 }  // namespace mozilla
     84 
     85 #endif  // include_gfx_ipc_UiCompositorControllerParent_h