Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / ipc / CompositorOptions.h
blob42b7e361d6ad1dbaa36bccae44ccf8f587957e2a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef _include_mozilla_gfx_ipc_CompositorOptions_h_
7 #define _include_mozilla_gfx_ipc_CompositorOptions_h_
9 namespace IPC {
10 template <typename>
11 struct ParamTraits;
12 } // namespace IPC
14 namespace mozilla {
15 namespace layers {
17 /**
18 * This class holds options that are "per compositor" - that is, these options
19 * affect a particular CompositorBridgeParent and all the content that it
20 * renders.
22 * This class is intended to be created by a platform widget (but NOT
23 * PuppetWidget) and passed to the graphics code during initialization of the
24 * top level compositor associated with that widget. The options are immutable
25 * after creation. The CompositorBridgeParent holds the canonical version of
26 * the options, but they may be accessed by other parts of the code as needed,
27 * and are accessible to content processes over PCompositorBridge as well.
29 class CompositorOptions {
30 public:
31 // This constructor needed for IPDL purposes, don't use it anywhere else.
32 CompositorOptions() = default;
34 CompositorOptions(bool aUseAPZ, bool aUseSoftwareWebRender)
35 : mUseAPZ(aUseAPZ), mUseSoftwareWebRender(aUseSoftwareWebRender) {}
37 bool UseAPZ() const { return mUseAPZ; }
38 bool UseSoftwareWebRender() const { return mUseSoftwareWebRender; }
39 bool AllowSoftwareWebRenderD3D11() const {
40 return mAllowSoftwareWebRenderD3D11;
42 bool AllowSoftwareWebRenderOGL() const { return mAllowSoftwareWebRenderOGL; }
43 bool InitiallyPaused() const { return mInitiallyPaused; }
44 bool NeedFastSnaphot() const { return mNeedFastSnaphot; }
46 void SetUseAPZ(bool aUseAPZ) { mUseAPZ = aUseAPZ; }
48 void SetAllowSoftwareWebRenderD3D11(bool aAllowSoftwareWebRenderD3D11) {
49 mAllowSoftwareWebRenderD3D11 = aAllowSoftwareWebRenderD3D11;
52 void SetAllowSoftwareWebRenderOGL(bool aAllowSoftwareWebRenderOGL) {
53 mAllowSoftwareWebRenderOGL = aAllowSoftwareWebRenderOGL;
56 void SetInitiallyPaused(bool aPauseAtStartup) {
57 mInitiallyPaused = aPauseAtStartup;
60 void SetNeedFastSnaphot(bool aNeedFastSnaphot) {
61 mNeedFastSnaphot = aNeedFastSnaphot;
64 bool EqualsIgnoringApzEnablement(const CompositorOptions& aOther) const {
65 return mUseSoftwareWebRender == aOther.mUseSoftwareWebRender &&
66 mAllowSoftwareWebRenderD3D11 ==
67 aOther.mAllowSoftwareWebRenderD3D11 &&
68 mAllowSoftwareWebRenderOGL == aOther.mAllowSoftwareWebRenderOGL &&
69 mInitiallyPaused == aOther.mInitiallyPaused &&
70 mNeedFastSnaphot == aOther.mNeedFastSnaphot;
73 bool operator==(const CompositorOptions& aOther) const {
74 return mUseAPZ == aOther.mUseAPZ && EqualsIgnoringApzEnablement(aOther);
77 friend struct IPC::ParamTraits<CompositorOptions>;
79 private:
80 bool mUseAPZ = false;
81 bool mUseSoftwareWebRender = false;
82 bool mAllowSoftwareWebRenderD3D11 = false;
83 bool mAllowSoftwareWebRenderOGL = false;
84 bool mInitiallyPaused = false;
85 bool mNeedFastSnaphot = false;
87 // Make sure to add new fields to the ParamTraits implementation
88 // in LayersMessageUtils.h
91 } // namespace layers
92 } // namespace mozilla
94 #endif // _include_mozilla_gfx_ipc_CompositorOptions_h_