Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / widget / android / CompositorWidgetParent.cpp
blob93b87f3cd331d58d56d2217574733da6ed9b5d02
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 "CompositorWidgetParent.h"
7 #include "mozilla/Unused.h"
8 #include "mozilla/java/GeckoServiceGpuProcessWrappers.h"
9 #include "mozilla/widget/PlatformWidgetTypes.h"
11 namespace mozilla {
12 namespace widget {
14 CompositorWidgetParent::CompositorWidgetParent(
15 const CompositorWidgetInitData& aInitData,
16 const layers::CompositorOptions& aOptions)
17 : AndroidCompositorWidget(aInitData.get_AndroidCompositorWidgetInitData(),
18 aOptions) {
19 MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_GPU);
22 CompositorWidgetParent::~CompositorWidgetParent() = default;
24 nsIWidget* CompositorWidgetParent::RealWidget() { return nullptr; }
26 void CompositorWidgetParent::ObserveVsync(VsyncObserver* aObserver) {
27 if (aObserver) {
28 Unused << SendObserveVsync();
29 } else {
30 Unused << SendUnobserveVsync();
32 mVsyncObserver = aObserver;
35 RefPtr<VsyncObserver> CompositorWidgetParent::GetVsyncObserver() const {
36 MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_GPU);
37 return mVsyncObserver;
40 mozilla::ipc::IPCResult CompositorWidgetParent::RecvNotifyClientSizeChanged(
41 const LayoutDeviceIntSize& aClientSize) {
42 NotifyClientSizeChanged(aClientSize);
43 return IPC_OK();
46 void CompositorWidgetParent::OnCompositorSurfaceChanged() {
47 java::GeckoServiceGpuProcess::RemoteCompositorSurfaceManager::LocalRef
48 manager = java::GeckoServiceGpuProcess::RemoteCompositorSurfaceManager::
49 GetInstance();
50 mSurface = manager->GetCompositorSurface(mWidgetId);
53 } // namespace widget
54 } // namespace mozilla