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/. */
6 #include "mozilla/widget/PlatformWidgetTypes.h"
7 #include "HeadlessCompositorWidget.h"
8 #include "VsyncDispatcher.h"
13 HeadlessCompositorWidget::HeadlessCompositorWidget(
14 const HeadlessCompositorWidgetInitData
& aInitData
,
15 const layers::CompositorOptions
& aOptions
, HeadlessWidget
* aWindow
)
16 : CompositorWidget(aOptions
),
18 mClientSize(LayoutDeviceIntSize(aInitData
.InitialClientSize()),
19 "HeadlessCompositorWidget::mClientSize") {}
21 void HeadlessCompositorWidget::ObserveVsync(VsyncObserver
* aObserver
) {
22 if (RefPtr
<CompositorVsyncDispatcher
> cvd
=
23 mWidget
->GetCompositorVsyncDispatcher()) {
24 cvd
->SetCompositorVsyncObserver(aObserver
);
28 nsIWidget
* HeadlessCompositorWidget::RealWidget() { return mWidget
; }
30 void HeadlessCompositorWidget::NotifyClientSizeChanged(
31 const LayoutDeviceIntSize
& aClientSize
) {
32 auto size
= mClientSize
.Lock();
36 LayoutDeviceIntSize
HeadlessCompositorWidget::GetClientSize() {
37 auto size
= mClientSize
.Lock();
41 uintptr_t HeadlessCompositorWidget::GetWidgetKey() {
42 return reinterpret_cast<uintptr_t>(mWidget
);
46 } // namespace mozilla