Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/config/gfxVars.h
Line
Count
Source (jump to first uncovered line)
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 mozilla_gfx_config_gfxVars_h
7
#define mozilla_gfx_config_gfxVars_h
8
9
#include <stdint.h>
10
#include "mozilla/Assertions.h"
11
#include "mozilla/StaticPtr.h"
12
#include "mozilla/gfx/GraphicsMessages.h"
13
#include "mozilla/gfx/Point.h"
14
#include "mozilla/gfx/Types.h"
15
#include "nsTArray.h"
16
#include "nsXULAppAPI.h"
17
18
namespace mozilla {
19
namespace gfx {
20
21
class gfxVarReceiver;
22
23
// Generator for graphics vars.
24
#define GFX_VARS_LIST(_)                                                \
25
  /* C++ Name,                  Data Type,        Default Value */      \
26
  _(BrowserTabsRemoteAutostart, bool,             false)                \
27
  _(ContentBackend,             BackendType,      BackendType::NONE)    \
28
  _(SoftwareBackend,            BackendType,      BackendType::NONE)    \
29
  _(TileSize,                   IntSize,          IntSize(-1, -1))      \
30
  _(UseXRender,                 bool,             false)                \
31
  _(OffscreenFormat,            gfxImageFormat,   mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32) \
32
  _(RequiresAcceleratedGLContextForCompositorOGL, bool, false)          \
33
  _(CanUseHardwareVideoDecoding, bool,            false)                \
34
  _(PDMWMFDisableD3D11Dlls,     nsCString,        nsCString())          \
35
  _(PDMWMFDisableD3D9Dlls,      nsCString,        nsCString())          \
36
  _(DXInterop2Blocked,          bool,             false)                \
37
  _(DXNV12Blocked,              bool,             false)                \
38
  _(UseWebRender,               bool,             false)                \
39
  _(UseWebRenderANGLE,          bool,             false)                \
40
  _(UseWebRenderDCompWin,       bool,             false)                \
41
  _(UseWebRenderProgramBinary,  bool,             false)                \
42
  _(UseWebRenderProgramBinaryDisk, bool,          false)                \
43
  _(WebRenderDebugFlags,        int32_t,          0)                    \
44
  _(ScreenDepth,                int32_t,          0)                    \
45
  _(GREDirectory,               nsString,         nsString())           \
46
  _(ProfDirectory,              nsString,         nsString())           \
47
  _(UseOMTP,                    bool,             false)                \
48
  _(AllowD3D11KeyedMutex,       bool,             false)                \
49
  _(SystemTextQuality,          int32_t,          5 /* CLEARTYPE_QUALITY */) \
50
51
  /* Add new entries above this line. */
52
53
// Some graphics settings are computed on the UI process and must be
54
// communicated to content and GPU processes. gfxVars helps facilitate
55
// this. Its function is similar to gfxPrefs, except rather than hold
56
// user preferences, it holds dynamically computed values.
57
//
58
// Each variable in GFX_VARS_LIST exposes the following static methods:
59
//
60
//    const DataType& CxxName();
61
//    void SetCxxName(const DataType& aValue);
62
//
63
// Note that the setter may only be called in the UI process; a gfxVar must be
64
// a variable that is determined in the UI process and pushed to child
65
// processes.
66
class gfxVars final
67
{
68
public:
69
  // These values will be used during the Initialize() call if set.  Any
70
  // updates that come before initialization will get added to this array.
71
  static void SetValuesForInitialize(const nsTArray<GfxVarUpdate>& aInitUpdates);
72
73
  static void Initialize();
74
  static void Shutdown();
75
76
  static void ApplyUpdate(const GfxVarUpdate& aUpdate);
77
  static void AddReceiver(gfxVarReceiver* aReceiver);
78
  static void RemoveReceiver(gfxVarReceiver* aReceiver);
79
80
  // Return a list of updates for all variables with non-default values.
81
  static nsTArray<GfxVarUpdate> FetchNonDefaultVars();
82
83
public:
84
  // Each variable must expose Set and Get methods for IPDL.
85
  class VarBase
86
  {
87
  public:
88
    VarBase();
89
    virtual void SetValue(const GfxVarValue& aValue) = 0;
90
    virtual void GetValue(GfxVarValue* aOutValue) = 0;
91
    virtual bool HasDefaultValue() const = 0;
92
0
    size_t Index() const {
93
0
      return mIndex;
94
0
    }
95
  private:
96
    size_t mIndex;
97
  };
98
99
private:
100
  static StaticAutoPtr<gfxVars> sInstance;
101
  static StaticAutoPtr<nsTArray<VarBase*>> sVarList;
102
103
  template <typename T, T Default()>
104
  class VarImpl final : public VarBase
105
  {
106
  public:
107
    VarImpl()
108
     : mValue(Default())
109
0
    {}
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetBrowserTabsRemoteAutostartDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetContentBackendDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetSoftwareBackendDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>, &mozilla::gfx::gfxVars::GetTileSizeDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseXRenderDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::SurfaceFormat, &mozilla::gfx::gfxVars::GetOffscreenFormatDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetRequiresAcceleratedGLContextForCompositorOGLDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetCanUseHardwareVideoDecodingDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D11DllsDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D9DllsDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXInterop2BlockedDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXNV12BlockedDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderANGLEDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDCompWinDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDiskDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetWebRenderDebugFlagsDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetScreenDepthDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetGREDirectoryDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetProfDirectoryDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseOMTPDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetAllowD3D11KeyedMutexDefault>::VarImpl()
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetSystemTextQualityDefault>::VarImpl()
110
0
    void SetValue(const GfxVarValue& aValue) override {
111
0
      aValue.get(&mValue);
112
0
      if (mListener) {
113
0
        mListener();
114
0
      }
115
0
    }
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetSystemTextQualityDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetAllowD3D11KeyedMutexDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseOMTPDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetProfDirectoryDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetGREDirectoryDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetScreenDepthDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetWebRenderDebugFlagsDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDiskDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDCompWinDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderANGLEDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXNV12BlockedDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXInterop2BlockedDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D9DllsDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D11DllsDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetCanUseHardwareVideoDecodingDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetRequiresAcceleratedGLContextForCompositorOGLDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::SurfaceFormat, &mozilla::gfx::gfxVars::GetOffscreenFormatDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseXRenderDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>, &mozilla::gfx::gfxVars::GetTileSizeDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetSoftwareBackendDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetContentBackendDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetBrowserTabsRemoteAutostartDefault>::SetValue(mozilla::gfx::GfxVarValue const&)
116
0
    void GetValue(GfxVarValue* aOutValue) override {
117
0
      *aOutValue = GfxVarValue(mValue);
118
0
    }
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetSystemTextQualityDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetAllowD3D11KeyedMutexDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseOMTPDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetProfDirectoryDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetGREDirectoryDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetScreenDepthDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetWebRenderDebugFlagsDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDiskDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDCompWinDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderANGLEDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXNV12BlockedDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXInterop2BlockedDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D9DllsDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D11DllsDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetCanUseHardwareVideoDecodingDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetRequiresAcceleratedGLContextForCompositorOGLDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::SurfaceFormat, &mozilla::gfx::gfxVars::GetOffscreenFormatDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseXRenderDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>, &mozilla::gfx::gfxVars::GetTileSizeDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetSoftwareBackendDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetContentBackendDefault>::GetValue(mozilla::gfx::GfxVarValue*)
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetBrowserTabsRemoteAutostartDefault>::GetValue(mozilla::gfx::GfxVarValue*)
119
0
    bool HasDefaultValue() const override {
120
0
      return mValue == Default();
121
0
    }
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetSystemTextQualityDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetAllowD3D11KeyedMutexDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseOMTPDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetProfDirectoryDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char16_t>, &mozilla::gfx::gfxVars::GetGREDirectoryDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetScreenDepthDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<int, &mozilla::gfx::gfxVars::GetWebRenderDebugFlagsDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDiskDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDCompWinDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderANGLEDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseWebRenderDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXNV12BlockedDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetDXInterop2BlockedDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D9DllsDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<nsTString<char>, &mozilla::gfx::gfxVars::GetPDMWMFDisableD3D11DllsDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetCanUseHardwareVideoDecodingDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetRequiresAcceleratedGLContextForCompositorOGLDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::SurfaceFormat, &mozilla::gfx::gfxVars::GetOffscreenFormatDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetUseXRenderDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>, &mozilla::gfx::gfxVars::GetTileSizeDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetSoftwareBackendDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<mozilla::gfx::BackendType, &mozilla::gfx::gfxVars::GetContentBackendDefault>::HasDefaultValue() const
Unexecuted instantiation: mozilla::gfx::gfxVars::VarImpl<bool, &mozilla::gfx::gfxVars::GetBrowserTabsRemoteAutostartDefault>::HasDefaultValue() const
122
    const T& Get() const {
123
      return mValue;
124
    }
125
    // Return true if the value changed, false otherwise.
126
    bool Set(const T& aValue) {
127
      MOZ_ASSERT(XRE_IsParentProcess());
128
      if (mValue == aValue) {
129
        return false;
130
      }
131
      mValue = aValue;
132
      if (mListener) {
133
        mListener();
134
      }
135
      return true;
136
    }
137
138
    void SetListener(const std::function<void()>& aListener)
139
    {
140
      mListener = aListener;
141
    }
142
  private:
143
    T mValue;
144
    std::function<void()> mListener;
145
  };
146
147
#define GFX_VAR_DECL(CxxName, DataType, DefaultValue)           \
148
private:                                                        \
149
0
  static DataType Get##CxxName##Default() {                     \
150
0
    return DefaultValue;                                        \
151
0
  }                                                             \
Unexecuted instantiation: mozilla::gfx::gfxVars::GetBrowserTabsRemoteAutostartDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetContentBackendDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetSoftwareBackendDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetTileSizeDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseXRenderDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetOffscreenFormatDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetRequiresAcceleratedGLContextForCompositorOGLDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetCanUseHardwareVideoDecodingDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetPDMWMFDisableD3D11DllsDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetPDMWMFDisableD3D9DllsDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetDXInterop2BlockedDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetDXNV12BlockedDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseWebRenderDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseWebRenderANGLEDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseWebRenderDCompWinDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseWebRenderProgramBinaryDiskDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetWebRenderDebugFlagsDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetScreenDepthDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetGREDirectoryDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetProfDirectoryDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetUseOMTPDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetAllowD3D11KeyedMutexDefault()
Unexecuted instantiation: mozilla::gfx::gfxVars::GetSystemTextQualityDefault()
152
  VarImpl<DataType, Get##CxxName##Default> mVar##CxxName;       \
153
public:                                                         \
154
  static const DataType& CxxName() {                            \
155
    return sInstance->mVar##CxxName.Get();                      \
156
  }                                                             \
157
  static DataType Get##CxxName##OrDefault() {                   \
158
    if (!sInstance) {                                           \
159
      return DefaultValue;                                      \
160
    }                                                           \
161
    return sInstance->mVar##CxxName.Get();                      \
162
  }                                                             \
163
  static void Set##CxxName(const DataType& aValue) {            \
164
    if (sInstance->mVar##CxxName.Set(aValue)) {                 \
165
      sInstance->NotifyReceivers(&sInstance->mVar##CxxName);    \
166
    }                                                           \
167
  }                                                             \
168
                                                                \
169
  static void                                                   \
170
  Set##CxxName##Listener(const std::function<void()>& aListener)  \
171
  {                                                             \
172
    sInstance->mVar##CxxName.SetListener(aListener);            \
173
  }
174
175
  GFX_VARS_LIST(GFX_VAR_DECL)
176
#undef GFX_VAR_DECL
177
178
private:
179
  gfxVars();
180
181
  void NotifyReceivers(VarBase* aVar);
182
183
private:
184
  nsTArray<gfxVarReceiver*> mReceivers;
185
};
186
187
#undef GFX_VARS_LIST
188
189
} // namespace gfx
190
} // namespace mozilla
191
192
#endif // mozilla_gfx_config_gfxVars_h