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 #include "CompositorWidgetChild.h"
7 #include "mozilla/Unused.h"
8 #include "mozilla/widget/CompositorWidgetVsyncObserver.h"
9 #include "nsBaseWidget.h"
10 #include "VsyncDispatcher.h"
11 #include "gfxPlatform.h"
12 
13 namespace mozilla {
14 namespace widget {
15 
CompositorWidgetChild(RefPtr<CompositorVsyncDispatcher> aVsyncDispatcher,RefPtr<CompositorWidgetVsyncObserver> aVsyncObserver)16 CompositorWidgetChild::CompositorWidgetChild(
17     RefPtr<CompositorVsyncDispatcher> aVsyncDispatcher,
18     RefPtr<CompositorWidgetVsyncObserver> aVsyncObserver)
19     : mVsyncDispatcher(aVsyncDispatcher), mVsyncObserver(aVsyncObserver) {
20   MOZ_ASSERT(XRE_IsParentProcess());
21   MOZ_ASSERT(!gfxPlatform::IsHeadless());
22 }
23 
~CompositorWidgetChild()24 CompositorWidgetChild::~CompositorWidgetChild() {}
25 
EnterPresentLock()26 void CompositorWidgetChild::EnterPresentLock() {
27   Unused << SendEnterPresentLock();
28 }
29 
LeavePresentLock()30 void CompositorWidgetChild::LeavePresentLock() {
31   Unused << SendLeavePresentLock();
32 }
33 
OnDestroyWindow()34 void CompositorWidgetChild::OnDestroyWindow() {}
35 
UpdateTransparency(nsTransparencyMode aMode)36 void CompositorWidgetChild::UpdateTransparency(nsTransparencyMode aMode) {
37   Unused << SendUpdateTransparency(static_cast<int32_t>(aMode));
38 }
39 
ClearTransparentWindow()40 void CompositorWidgetChild::ClearTransparentWindow() {
41   Unused << SendClearTransparentWindow();
42 }
43 
GetTransparentDC() const44 HDC CompositorWidgetChild::GetTransparentDC() const {
45   // Not supported in out-of-process mode.
46   return nullptr;
47 }
48 
RecvObserveVsync()49 mozilla::ipc::IPCResult CompositorWidgetChild::RecvObserveVsync() {
50   mVsyncDispatcher->SetCompositorVsyncObserver(mVsyncObserver);
51   return IPC_OK();
52 }
53 
RecvUnobserveVsync()54 mozilla::ipc::IPCResult CompositorWidgetChild::RecvUnobserveVsync() {
55   mVsyncDispatcher->SetCompositorVsyncObserver(nullptr);
56   return IPC_OK();
57 }
58 
59 }  // namespace widget
60 }  // namespace mozilla
61