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 #ifndef widget_windows_RemoteBackbuffer_h
7 #define widget_windows_RemoteBackbuffer_h
10 #include "mozilla/widget/PCompositorWidgetParent.h"
11 #include "mozilla/Maybe.h"
12 #include "mozilla/gfx/2D.h"
18 namespace remote_backbuffer
{
22 struct BorrowResponseData
;
23 struct PresentRequestData
;
24 struct PresentResponseData
;
26 class PresentableSharedImage
;
33 bool Initialize(HWND aWindowHandle
, DWORD aTargetProcessId
);
35 Maybe
<RemoteBackbufferHandles
> CreateRemoteHandles();
37 Provider(const Provider
&) = delete;
38 Provider(Provider
&&) = delete;
39 Provider
& operator=(const Provider
&) = delete;
40 Provider
& operator=(Provider
&&) = delete;
45 void HandleBorrowRequest(BorrowResponseData
* aResponseData
,
46 bool aAllowSameBuffer
);
47 void HandlePresentRequest(const PresentRequestData
& aRequestData
,
48 PresentResponseData
* aResponseData
);
51 HANDLE mTargetProcess
;
53 HANDLE mRequestReadyEvent
;
54 HANDLE mResponseReadyEvent
;
55 SharedData
* mSharedDataPtr
;
56 bool mStopServiceThread
;
57 PRThread
* mServiceThread
;
58 std::unique_ptr
<PresentableSharedImage
> mBackbuffer
;
66 bool Initialize(const RemoteBackbufferHandles
& aRemoteHandles
);
68 already_AddRefed
<gfx::DrawTarget
> BorrowDrawTarget();
69 bool PresentDrawTarget(gfx::IntRegion aDirtyRegion
);
71 Client(const Client
&) = delete;
72 Client(Client
&&) = delete;
73 Client
& operator=(const Client
&) = delete;
74 Client
& operator=(Client
&&) = delete;
78 HANDLE mRequestReadyEvent
;
79 HANDLE mResponseReadyEvent
;
80 SharedData
* mSharedDataPtr
;
81 std::unique_ptr
<SharedImage
> mBackbuffer
;
84 } // namespace remote_backbuffer
86 } // namespace mozilla
88 #endif // widget_windows_RemoteBackbuffer_h