Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=99: */
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_
8 :
9 : namespace IPC {
10 : template <typename> struct ParamTraits;
11 : } // namespace IPC
12 :
13 : namespace mozilla {
14 : namespace layers {
15 :
16 : /**
17 : * This class holds options that are "per compositor" - that is, these options
18 : * affect a particular CompositorBridgeParent and all the content that it
19 : * renders.
20 : *
21 : * This class is intended to be created by a platform widget (but NOT
22 : * PuppetWidget) and passed to the graphics code during initialization of the
23 : * top level compositor associated with that widget. The options are immutable
24 : * after creation. The CompositorBridgeParent holds the canonical version of
25 : * the options, but they may be accessed by other parts of the code as needed,
26 : * and are accessible to content processes over PCompositorBridge as well.
27 : */
28 : class CompositorOptions
29 : {
30 : public:
31 : // This constructor needed for IPDL purposes, don't use it anywhere else.
32 3 : CompositorOptions()
33 3 : : mUseAPZ(false)
34 : , mUseWebRender(false)
35 3 : , mUseAdvancedLayers(false)
36 : {
37 3 : }
38 :
39 1 : explicit CompositorOptions(bool aUseAPZ,
40 : bool aUseWebRender)
41 1 : : mUseAPZ(aUseAPZ)
42 : , mUseWebRender(aUseWebRender)
43 1 : , mUseAdvancedLayers(false)
44 : {
45 1 : }
46 :
47 20 : bool UseAPZ() const { return mUseAPZ; }
48 2 : bool UseWebRender() const { return mUseWebRender; }
49 : bool UseAdvancedLayers() const { return mUseAdvancedLayers; }
50 :
51 1 : void SetUseAdvancedLayers(bool aUseAdvancedLayers) {
52 1 : mUseAdvancedLayers = aUseAdvancedLayers;
53 1 : }
54 :
55 1 : bool operator==(const CompositorOptions& aOther) const {
56 2 : return mUseAPZ == aOther.mUseAPZ &&
57 2 : mUseWebRender == aOther.mUseWebRender;
58 : }
59 :
60 : friend struct IPC::ParamTraits<CompositorOptions>;
61 :
62 : private:
63 : bool mUseAPZ;
64 : bool mUseWebRender;
65 : bool mUseAdvancedLayers;
66 :
67 : // Make sure to add new fields to the ParamTraits implementation
68 : };
69 :
70 : } // namespace layers
71 : } // namespace mozilla
72 :
73 : #endif // _include_mozilla_gfx_ipc_CompositorOptions_h_
|