2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2017-01-05 22:04:38 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef include_gfx_ipc_UiCompositorControllerParent_h
|
|
|
|
#define include_gfx_ipc_UiCompositorControllerParent_h
|
|
|
|
|
|
|
|
#include "mozilla/layers/PUiCompositorControllerParent.h"
|
2017-04-06 01:42:50 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
# include "mozilla/layers/AndroidDynamicToolbarAnimator.h"
|
|
|
|
#endif // defined(MOZ_WIDGET_ANDROID)
|
|
|
|
#include "mozilla/ipc/Shmem.h"
|
|
|
|
#include "mozilla/RefPtr.h"
|
2017-01-05 22:04:38 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2019-01-08 21:04:16 +03:00
|
|
|
struct FrameMetrics;
|
|
|
|
|
2017-01-05 22:04:38 +03:00
|
|
|
class UiCompositorControllerParent final
|
|
|
|
: public PUiCompositorControllerParent {
|
2017-04-06 01:42:50 +03:00
|
|
|
// UiCompositorControllerChild needs to call the private constructor when
|
|
|
|
// running in process.
|
|
|
|
friend class UiCompositorControllerChild;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-01-05 22:04:38 +03:00
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UiCompositorControllerParent)
|
|
|
|
|
2018-03-25 02:06:01 +03:00
|
|
|
static RefPtr<UiCompositorControllerParent> GetFromRootLayerTreeId(
|
|
|
|
const LayersId& aRootLayerTreeId);
|
|
|
|
static RefPtr<UiCompositorControllerParent> Start(
|
|
|
|
const LayersId& aRootLayerTreeId,
|
|
|
|
Endpoint<PUiCompositorControllerParent>&& aEndpoint);
|
2017-01-05 22:04:38 +03:00
|
|
|
|
2017-04-06 01:42:50 +03:00
|
|
|
// PUiCompositorControllerParent functions
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPause();
|
|
|
|
mozilla::ipc::IPCResult RecvResume();
|
2018-11-15 04:54:18 +03:00
|
|
|
mozilla::ipc::IPCResult RecvResumeAndResize(const int32_t& aX,
|
|
|
|
const int32_t& aY,
|
|
|
|
const int32_t& aHeight,
|
2019-02-06 18:58:43 +03:00
|
|
|
const int32_t& aWidth);
|
|
|
|
mozilla::ipc::IPCResult RecvInvalidateAndRender();
|
|
|
|
mozilla::ipc::IPCResult RecvMaxToolbarHeight(const int32_t& aHeight);
|
2019-04-27 01:38:10 +03:00
|
|
|
mozilla::ipc::IPCResult RecvFixedBottomOffset(const int32_t& aOffset);
|
2017-04-06 01:42:50 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPinned(const bool& aPinned,
|
2019-02-06 18:58:43 +03:00
|
|
|
const int32_t& aReason);
|
2017-04-06 01:42:50 +03:00
|
|
|
mozilla::ipc::IPCResult RecvToolbarAnimatorMessageFromUI(
|
2019-02-06 18:58:43 +03:00
|
|
|
const int32_t& aMessage);
|
|
|
|
mozilla::ipc::IPCResult RecvDefaultClearColor(const uint32_t& aColor);
|
|
|
|
mozilla::ipc::IPCResult RecvRequestScreenPixels();
|
2017-04-06 01:42:50 +03:00
|
|
|
mozilla::ipc::IPCResult RecvEnableLayerUpdateNotifications(
|
2019-02-06 18:58:43 +03:00
|
|
|
const bool& aEnable);
|
2017-04-06 01:42:50 +03:00
|
|
|
mozilla::ipc::IPCResult RecvToolbarPixelsToCompositor(
|
2019-02-06 18:58:43 +03:00
|
|
|
Shmem&& aMem, const ScreenIntSize& aSize);
|
2017-01-05 22:04:38 +03:00
|
|
|
void ActorDestroy(ActorDestroyReason aWhy) override;
|
2019-05-21 20:04:21 +03:00
|
|
|
void ActorDealloc() override;
|
2017-01-05 22:04:38 +03:00
|
|
|
|
2017-04-06 01:42:50 +03:00
|
|
|
// Class specific functions
|
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
void RegisterAndroidDynamicToolbarAnimator(
|
|
|
|
AndroidDynamicToolbarAnimator* aAnimator);
|
|
|
|
#endif // MOZ_WIDGET_ANDROID
|
|
|
|
void ToolbarAnimatorMessageFromCompositor(int32_t aMessage);
|
|
|
|
bool AllocPixelBuffer(const int32_t aSize, Shmem* aMem);
|
2017-01-05 22:04:38 +03:00
|
|
|
|
2018-10-15 16:19:16 +03:00
|
|
|
// Called when a layer has been updated so the UI thread may be notified if
|
|
|
|
// necessary.
|
|
|
|
void NotifyLayersUpdated();
|
2018-10-15 16:20:27 +03:00
|
|
|
void NotifyFirstPaint();
|
2019-01-08 21:04:16 +03:00
|
|
|
void NotifyUpdateScreenMetrics(const FrameMetrics& aMetrics);
|
2018-10-15 16:19:16 +03:00
|
|
|
|
2017-01-05 22:04:38 +03:00
|
|
|
private:
|
2018-03-25 02:06:01 +03:00
|
|
|
explicit UiCompositorControllerParent(const LayersId& aRootLayerTreeId);
|
2019-04-11 15:36:51 +03:00
|
|
|
virtual ~UiCompositorControllerParent();
|
2017-04-06 01:42:50 +03:00
|
|
|
void InitializeForSameProcess();
|
|
|
|
void InitializeForOutOfProcess();
|
|
|
|
void Initialize();
|
2017-01-05 22:04:38 +03:00
|
|
|
void Open(Endpoint<PUiCompositorControllerParent>&& aEndpoint);
|
2017-04-06 01:42:50 +03:00
|
|
|
void Shutdown();
|
2017-01-05 22:04:38 +03:00
|
|
|
|
2018-03-25 02:06:01 +03:00
|
|
|
LayersId mRootLayerTreeId;
|
2017-04-06 01:42:50 +03:00
|
|
|
|
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
RefPtr<AndroidDynamicToolbarAnimator> mAnimator;
|
2018-10-15 16:19:16 +03:00
|
|
|
bool mCompositorLayersUpdateEnabled; // Flag set to true when the UI thread
|
|
|
|
// is expecting to be notified when a
|
|
|
|
// layer has been updated
|
2017-04-06 01:42:50 +03:00
|
|
|
#endif // defined(MOZ_WIDGET_ANDROID)
|
|
|
|
|
|
|
|
int32_t mMaxToolbarHeight;
|
2017-01-05 22:04:38 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // include_gfx_ipc_UiCompositorControllerParent_h
|