1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef widget_windows_CompositorWidgetChild_h
7 #define widget_windows_CompositorWidgetChild_h
8 
9 #include "WinCompositorWidget.h"
10 #include "mozilla/widget/PCompositorWidgetChild.h"
11 #include "mozilla/widget/CompositorWidgetVsyncObserver.h"
12 
13 namespace mozilla {
14 class CompositorVsyncDispatcher;
15 
16 namespace widget {
17 
18 namespace remote_backbuffer {
19 class Provider;
20 }
21 
22 class CompositorWidgetChild final : public PCompositorWidgetChild,
23                                     public PlatformCompositorWidgetDelegate {
24  public:
25   CompositorWidgetChild(RefPtr<CompositorVsyncDispatcher> aVsyncDispatcher,
26                         RefPtr<CompositorWidgetVsyncObserver> aVsyncObserver,
27                         const CompositorWidgetInitData& aInitData);
28   ~CompositorWidgetChild() override;
29 
30   bool Initialize();
31 
32   void EnterPresentLock() override;
33   void LeavePresentLock() override;
34   void OnDestroyWindow() override;
35   bool OnWindowResize(const LayoutDeviceIntSize& aSize) override;
36   void OnWindowModeChange(nsSizeMode aSizeMode) override;
37   void UpdateTransparency(nsTransparencyMode aMode) override;
38   void ClearTransparentWindow() override;
39 
40   mozilla::ipc::IPCResult RecvObserveVsync() override;
41   mozilla::ipc::IPCResult RecvUnobserveVsync() override;
42   mozilla::ipc::IPCResult RecvUpdateCompositorWnd(
43       const WindowsHandle& aCompositorWnd, const WindowsHandle& aParentWnd,
44       UpdateCompositorWndResolver&& aResolve) override;
45 
46  private:
47   RefPtr<CompositorVsyncDispatcher> mVsyncDispatcher;
48   RefPtr<CompositorWidgetVsyncObserver> mVsyncObserver;
49   HWND mCompositorWnd;
50 
51   HWND mWnd;
52   nsTransparencyMode mTransparencyMode;
53 
54   std::unique_ptr<remote_backbuffer::Provider> mRemoteBackbufferProvider;
55 };
56 
57 }  // namespace widget
58 }  // namespace mozilla
59 
60 #endif  // widget_windows_CompositorWidgetChild_h
61