LCOV - code coverage report
Current view: top level - gfx/thebes - gfxPrefs.h (source / functions) Hit Total Coverage
Test: output.info Lines: 61 284 21.5 %
Date: 2018-08-07 16:42:27 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; 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/. */
       5             : 
       6             : #ifndef GFX_PREFS_H
       7             : #define GFX_PREFS_H
       8             : 
       9             : #include <cmath>                 // for M_PI
      10             : #include <stdint.h>
      11             : #include <string>
      12             : #include "mozilla/Assertions.h"
      13             : #include "mozilla/Atomics.h"
      14             : #include "mozilla/gfx/LoggingConstants.h"
      15             : #include "nsTArray.h"
      16             : 
      17             : // First time gfxPrefs::GetSingleton() needs to be called on the main thread,
      18             : // before any of the methods accessing the values are used, but after
      19             : // the Preferences system has been initialized.
      20             : 
      21             : // The static methods to access the preference value are safe to call
      22             : // from any thread after that first call.
      23             : 
      24             : // To register a preference, you need to add a line in this file using
      25             : // the DECL_GFX_PREF macro.
      26             : //
      27             : // Update argument controls whether we read the preference value and save it
      28             : // or connect with a callback.  See UpdatePolicy enum below.
      29             : // Pref is the string with the preference name.
      30             : // Name argument is the name of the static function to create.
      31             : // Type is the type of the preference - bool, int32_t, uint32_t.
      32             : // Default is the default value for the preference.
      33             : //
      34             : // For example this line in the .h:
      35             : //   DECL_GFX_PREF(Once,"layers.dump",LayersDump,bool,false);
      36             : // means that you can call
      37             : //   bool var = gfxPrefs::LayersDump();
      38             : // from any thread, but that you will only get the preference value of
      39             : // "layers.dump" as it was set at the start of the session (subject to
      40             : // note 2 below). If the value was not set, the default would be false.
      41             : //
      42             : // In another example, this line in the .h:
      43             : //   DECL_GFX_PREF(Live,"gl.msaa-level",MSAALevel,uint32_t,2);
      44             : // means that every time you call
      45             : //   uint32_t var = gfxPrefs::MSAALevel();
      46             : // from any thread, you will get the most up to date preference value of
      47             : // "gl.msaa-level".  If the value is not set, the default would be 2.
      48             : 
      49             : // Note 1: Changing a preference from Live to Once is now as simple
      50             : // as changing the Update argument.  If your code worked before, it will
      51             : // keep working, and behave as if the user never changes the preference.
      52             : // Things are a bit more complicated and perhaps even dangerous when
      53             : // going from Once to Live, or indeed setting a preference to be Live
      54             : // in the first place, so be careful.  You need to be ready for the
      55             : // values changing mid execution, and if you're using those preferences
      56             : // in any setup and initialization, you may need to do extra work.
      57             : 
      58             : // Note 2: Prefs can be set by using the corresponding Set method. For
      59             : // example, if the accessor is Foo() then calling SetFoo(...) will update
      60             : // the preference and also change the return value of subsequent Foo() calls.
      61             : // This is true even for 'Once' prefs which otherwise do not change if the
      62             : // pref is updated after initialization. Changing gfxPrefs values in content
      63             : // processes will not affect the result in other processes. Changing gfxPrefs
      64             : // values in the GPU process is not supported at all.
      65             : 
      66             : #define DECL_GFX_PREF(Update, Prefname, Name, Type, Default)                  \
      67             : public:                                                                       \
      68             : static Type Name() { MOZ_ASSERT(SingletonExists()); return GetSingleton().mPref##Name.mValue; } \
      69             : static void Set##Name(Type aVal) { MOZ_ASSERT(SingletonExists());             \
      70             :     GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal); } \
      71             : static const char* Get##Name##PrefName() { return Prefname; }                 \
      72             : static Type Get##Name##PrefDefault() { return Default; }                      \
      73             : static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) {       \
      74             :     MOZ_ASSERT(SingletonExists());                                            \
      75             :     GetSingleton().mPref##Name.SetChangeCallback(aCallback); }                \
      76             : private:                                                                      \
      77             : PrefTemplate<UpdatePolicy::Update, Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
      78             : 
      79             : // This declares an "override" pref, which is exposed as a "bool" pref by the API,
      80             : // but is internally stored as a tri-state int pref with three possible values:
      81             : // - A value of 0 means that it has been force-disabled, and is exposed as a
      82             : //   false-valued bool.
      83             : // - A value of 1 means that it has been force-enabled, and is exposed as a
      84             : //   true-valued bool.
      85             : // - A value of 2 (the default) means that it returns the provided BaseValue
      86             : //   as a boolean. The BaseValue may be a constant expression or a function.
      87             : // If the prefs defined with this macro are listed in prefs files (e.g. all.js),
      88             : // then they must be listed with an int value (default to 2, but you can use 0
      89             : // or 1 if you want to force it on or off).
      90             : #define DECL_OVERRIDE_PREF(Update, Prefname, Name, BaseValue)                 \
      91             : public:                                                                       \
      92             : static bool Name() { MOZ_ASSERT(SingletonExists());                           \
      93             :     int32_t val = GetSingleton().mPref##Name.mValue;                          \
      94             :     return val == 2 ? !!(BaseValue) : !!val; }                                  \
      95             : static void Set##Name(bool aVal) { MOZ_ASSERT(SingletonExists());             \
      96             :     GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal ? 1 : 0); } \
      97             : static const char* Get##Name##PrefName() { return Prefname; }                 \
      98             : static int32_t Get##Name##PrefDefault() { return 2; }                         \
      99             : static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) {       \
     100             :     MOZ_ASSERT(SingletonExists());                                            \
     101             :     GetSingleton().mPref##Name.SetChangeCallback(aCallback); }                \
     102             : private:                                                                      \
     103             : PrefTemplate<UpdatePolicy::Update, int32_t, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
     104             : 
     105             : namespace mozilla {
     106             : namespace gfx {
     107             : class GfxPrefValue;   // defined in PGPU.ipdl
     108             : } // namespace gfx
     109             : } // namespace mozilla
     110             : 
     111             : class gfxPrefs;
     112             : class gfxPrefs final
     113             : {
     114             :   typedef mozilla::gfx::GfxPrefValue GfxPrefValue;
     115             : 
     116             :   typedef mozilla::Atomic<bool, mozilla::Relaxed> AtomicBool;
     117             :   typedef mozilla::Atomic<int32_t, mozilla::Relaxed> AtomicInt32;
     118             :   typedef mozilla::Atomic<uint32_t, mozilla::Relaxed> AtomicUint32;
     119             : 
     120             : private:
     121             :   // Enums for the update policy.
     122             :   enum class UpdatePolicy {
     123             :     Skip, // Set the value to default, skip any Preferences calls
     124             :     Once, // Evaluate the preference once, unchanged during the session
     125             :     Live  // Evaluate the preference and set callback so it stays current/live
     126             :   };
     127             : 
     128             : public:
     129             :   class Pref
     130             :   {
     131             :   public:
     132             :     Pref() : mChangeCallback(nullptr)
     133             :     {
     134             :       mIndex = sGfxPrefList->Length();
     135             :       sGfxPrefList->AppendElement(this);
     136             :     }
     137             : 
     138             :     size_t Index() const { return mIndex; }
     139             :     void OnChange();
     140             : 
     141             :     typedef void (*ChangeCallback)(const GfxPrefValue&);
     142             :     void SetChangeCallback(ChangeCallback aCallback);
     143             : 
     144             :     virtual const char* Name() const = 0;
     145             : 
     146             :     // Returns true if the value is default, false if changed.
     147             :     virtual bool HasDefaultValue() const = 0;
     148             : 
     149             :     // Returns the pref value as a discriminated union.
     150             :     virtual void GetLiveValue(GfxPrefValue* aOutValue) const = 0;
     151             : 
     152             :     // Returns the pref value as a discriminated union.
     153             :     virtual void GetCachedValue(GfxPrefValue* aOutValue) const = 0;
     154             : 
     155             :     // Change the cached value. GfxPrefValue must be a compatible type.
     156             :     virtual void SetCachedValue(const GfxPrefValue& aOutValue) = 0;
     157             : 
     158             :   protected:
     159             :     void FireChangeCallback();
     160             : 
     161             :   private:
     162             :     size_t mIndex;
     163             :     ChangeCallback mChangeCallback;
     164             :   };
     165             : 
     166             :   static const nsTArray<Pref*>& all() {
     167           0 :     return *sGfxPrefList;
     168             :   }
     169             : 
     170             : private:
     171             :   // We split out a base class to reduce the number of virtual function
     172             :   // instantiations that we do, which saves code size.
     173             :   template<class T>
     174             :   class TypedPref : public Pref
     175             :   {
     176             :   public:
     177             :     explicit TypedPref(T aValue)
     178             :       : mValue(aValue)
     179             :     {}
     180             : 
     181             :     void GetCachedValue(GfxPrefValue* aOutValue) const override {
     182             :       CopyPrefValue(&mValue, aOutValue);
     183             :     }
     184             :     void SetCachedValue(const GfxPrefValue& aOutValue) override {
     185             :       // This is only used in non-XPCOM processes.
     186             :       MOZ_ASSERT(!IsPrefsServiceAvailable());
     187             : 
     188             :       T newValue;
     189             :       CopyPrefValue(&aOutValue, &newValue);
     190             : 
     191             :       if (mValue != newValue) {
     192             :         mValue = newValue;
     193             :         FireChangeCallback();
     194             :       }
     195             :     }
     196             : 
     197             :   protected:
     198             :     T GetLiveValueByName(const char* aPrefName) const {
     199             :       if (IsPrefsServiceAvailable()) {
     200             :         return PrefGet(aPrefName, mValue);
     201             :       }
     202             :       return mValue;
     203             :     }
     204             : 
     205             :   public:
     206             :     T mValue;
     207             :   };
     208             : 
     209             :   // Since we cannot use const char*, use a function that returns it.
     210             :   template <UpdatePolicy Update, class T, T Default(void), const char* Prefname(void)>
     211             :   class PrefTemplate final : public TypedPref<T>
     212             :   {
     213             :     typedef TypedPref<T> BaseClass;
     214             :   public:
     215             :     PrefTemplate()
     216             :       : BaseClass(Default())
     217             :     {
     218             :       // If not using the Preferences service, values are synced over IPC, so
     219             :       // there's no need to register us as a Preferences observer.
     220             :       if (IsPrefsServiceAvailable()) {
     221             :         Register(Update, Prefname());
     222             :       }
     223             :       // By default we only watch changes in the parent process, to communicate
     224             :       // changes to the GPU process.
     225             :       if (IsParentProcess() && Update == UpdatePolicy::Live) {
     226             :         WatchChanges(Prefname(), this);
     227             :       }
     228             :     }
     229             :     ~PrefTemplate() {
     230             :       if (IsParentProcess() && Update == UpdatePolicy::Live) {
     231             :         UnwatchChanges(Prefname(), this);
     232             :       }
     233             :     }
     234             :     void Register(UpdatePolicy aUpdate, const char* aPreference)
     235             :     {
     236             :       AssertMainThread();
     237             :       switch (aUpdate) {
     238             :         case UpdatePolicy::Skip:
     239             :           break;
     240             :         case UpdatePolicy::Once:
     241             :           this->mValue = PrefGet(aPreference, this->mValue);
     242             :           break;
     243             :         case UpdatePolicy::Live:
     244             :           PrefAddVarCache(&this->mValue, aPreference, this->mValue);
     245             :           break;
     246             :         default:
     247             :           MOZ_CRASH("Incomplete switch");
     248             :       }
     249             :     }
     250           0 :     void Set(UpdatePolicy aUpdate, const char* aPref, T aValue)
     251             :     {
     252           0 :       AssertMainThread();
     253           0 :       PrefSet(aPref, aValue);
     254           0 :       switch (aUpdate) {
     255             :         case UpdatePolicy::Skip:
     256             :         case UpdatePolicy::Live:
     257             :           break;
     258             :         case UpdatePolicy::Once:
     259           0 :           this->mValue = PrefGet(aPref, this->mValue);
     260           0 :           break;
     261             :         default:
     262           0 :           MOZ_CRASH("Incomplete switch");
     263             :       }
     264           0 :     }
     265             :     const char *Name() const override {
     266             :       return Prefname();
     267             :     }
     268             :     void GetLiveValue(GfxPrefValue* aOutValue) const override {
     269             :       T value = GetLiveValue();
     270             :       CopyPrefValue(&value, aOutValue);
     271             :     }
     272             :     // When using the Preferences service, the change callback can be triggered
     273             :     // *before* our cached value is updated, so we expose a method to grab the
     274             :     // true live value.
     275             :     T GetLiveValue() const {
     276             :       return BaseClass::GetLiveValueByName(Prefname());
     277             :     }
     278             :     bool HasDefaultValue() const override {
     279             :       return this->mValue == Default();
     280             :     }
     281             :   };
     282             : 
     283             :   // This is where DECL_GFX_PREF for each of the preferences should go.
     284             :   // We will keep these in an alphabetical order to make it easier to see if
     285             :   // a method accessing a pref already exists. Just add yours in the list.
     286             : 
     287           0 :   DECL_GFX_PREF(Live, "accessibility.browsewithcaret", AccessibilityBrowseWithCaret, bool, false);
     288             : 
     289             :   // The apz prefs are explained in AsyncPanZoomController.cpp
     290          16 :   DECL_GFX_PREF(Live, "apz.allow_checkerboarding",             APZAllowCheckerboarding, bool, true);
     291           0 :   DECL_GFX_PREF(Live, "apz.allow_immediate_handoff",           APZAllowImmediateHandoff, bool, true);
     292          10 :   DECL_GFX_PREF(Live, "apz.allow_zooming",                     APZAllowZooming, bool, false);
     293             :   DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.enabled", APZUseChromeFlingPhysics, bool, false);
     294             :   DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.friction", APZChromeFlingPhysicsFriction, float, 0.015f);
     295             :   DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.inflexion", APZChromeFlingPhysicsInflexion, float, 0.35f);
     296             :   DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.stop_threshold", APZChromeFlingPhysicsStopThreshold, float, 0.1f);
     297             :   DECL_GFX_PREF(Live, "apz.autoscroll.enabled",                APZAutoscrollEnabled, bool, false);
     298           0 :   DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle",          APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
     299           0 :   DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold",      APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
     300           0 :   DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle",        APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
     301           0 :   DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle",              APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
     302           0 :   DECL_GFX_PREF(Live, "apz.axis_lock.mode",                    APZAxisLockMode, int32_t, 0);
     303           0 :   DECL_GFX_PREF(Live, "apz.content_response_timeout",          APZContentResponseTimeout, int32_t, 400);
     304           0 :   DECL_GFX_PREF(Live, "apz.danger_zone_x",                     APZDangerZoneX, int32_t, 50);
     305           0 :   DECL_GFX_PREF(Live, "apz.danger_zone_y",                     APZDangerZoneY, int32_t, 100);
     306          30 :   DECL_GFX_PREF(Live, "apz.disable_for_scroll_linked_effects", APZDisableForScrollLinkedEffects, bool, false);
     307           0 :   DECL_GFX_PREF(Live, "apz.displayport_expiry_ms",             APZDisplayPortExpiryTime, uint32_t, 15000);
     308           0 :   DECL_GFX_PREF(Live, "apz.drag.enabled",                      APZDragEnabled, bool, false);
     309           0 :   DECL_GFX_PREF(Live, "apz.drag.initial.enabled",              APZDragInitiationEnabled, bool, false);
     310           0 :   DECL_GFX_PREF(Live, "apz.drag.touch.enabled",                APZTouchDragEnabled, bool, false);
     311           0 :   DECL_GFX_PREF(Live, "apz.enlarge_displayport_when_clipped",  APZEnlargeDisplayPortWhenClipped, bool, false);
     312           0 :   DECL_GFX_PREF(Live, "apz.fling_accel_base_mult",             APZFlingAccelBaseMultiplier, float, 1.0f);
     313           0 :   DECL_GFX_PREF(Live, "apz.fling_accel_interval_ms",           APZFlingAccelInterval, int32_t, 500);
     314           0 :   DECL_GFX_PREF(Live, "apz.fling_accel_supplemental_mult",     APZFlingAccelSupplementalMultiplier, float, 1.0f);
     315           0 :   DECL_GFX_PREF(Live, "apz.fling_accel_min_velocity",          APZFlingAccelMinVelocity, float, 1.5f);
     316           2 :   DECL_GFX_PREF(Once, "apz.fling_curve_function_x1",           APZCurveFunctionX1, float, 0.0f);
     317           2 :   DECL_GFX_PREF(Once, "apz.fling_curve_function_x2",           APZCurveFunctionX2, float, 1.0f);
     318           2 :   DECL_GFX_PREF(Once, "apz.fling_curve_function_y1",           APZCurveFunctionY1, float, 0.0f);
     319           2 :   DECL_GFX_PREF(Once, "apz.fling_curve_function_y2",           APZCurveFunctionY2, float, 1.0f);
     320           0 :   DECL_GFX_PREF(Live, "apz.fling_curve_threshold_inches_per_ms", APZCurveThreshold, float, -1.0f);
     321           0 :   DECL_GFX_PREF(Live, "apz.fling_friction",                    APZFlingFriction, float, 0.002f);
     322           0 :   DECL_GFX_PREF(Live, "apz.fling_min_velocity_threshold",      APZFlingMinVelocityThreshold, float, 0.5f);
     323           0 :   DECL_GFX_PREF(Live, "apz.fling_stop_on_tap_threshold",       APZFlingStopOnTapThreshold, float, 0.05f);
     324           0 :   DECL_GFX_PREF(Live, "apz.fling_stopped_threshold",           APZFlingStoppedThreshold, float, 0.01f);
     325          36 :   DECL_GFX_PREF(Live, "apz.frame_delay.enabled",               APZFrameDelayEnabled, bool, false);
     326           2 :   DECL_GFX_PREF(Once, "apz.keyboard.enabled",                  APZKeyboardEnabled, bool, false);
     327          14 :   DECL_GFX_PREF(Live, "apz.keyboard.passive-listeners",        APZKeyboardPassiveListeners, bool, false);
     328           0 :   DECL_GFX_PREF(Live, "apz.max_tap_time",                      APZMaxTapTime, int32_t, 300);
     329           0 :   DECL_GFX_PREF(Live, "apz.max_velocity_inches_per_ms",        APZMaxVelocity, float, -1.0f);
     330           0 :   DECL_GFX_PREF(Once, "apz.max_velocity_queue_size",           APZMaxVelocityQueueSize, uint32_t, 5);
     331           0 :   DECL_GFX_PREF(Live, "apz.min_skate_speed",                   APZMinSkateSpeed, float, 1.0f);
     332           0 :   DECL_GFX_PREF(Live, "apz.minimap.enabled",                   APZMinimap, bool, false);
     333           0 :   DECL_GFX_PREF(Live, "apz.one_touch_pinch.enabled",           APZOneTouchPinchEnabled, bool, true);
     334           0 :   DECL_GFX_PREF(Live, "apz.overscroll.enabled",                APZOverscrollEnabled, bool, false);
     335           0 :   DECL_GFX_PREF(Live, "apz.overscroll.min_pan_distance_ratio", APZMinPanDistanceRatio, float, 1.0f);
     336             :   DECL_GFX_PREF(Live, "apz.overscroll.spring_stiffness",       APZOverscrollSpringStiffness, float, 0.001f);
     337             :   DECL_GFX_PREF(Live, "apz.overscroll.stop_distance_threshold", APZOverscrollStopDistanceThreshold, float, 5.0f);
     338           0 :   DECL_GFX_PREF(Live, "apz.paint_skipping.enabled",            APZPaintSkipping, bool, true);
     339         102 :   DECL_GFX_PREF(Live, "apz.peek_messages.enabled",             APZPeekMessages, bool, true);
     340           0 :   DECL_GFX_PREF(Live, "apz.pinch_lock.mode",                   APZPinchLockMode, int32_t, 1);
     341           0 :   DECL_GFX_PREF(Live, "apz.pinch_lock.scroll_lock_threshold",  APZPinchLockScrollLockThreshold, float, 1.0f / 32.0f);
     342           0 :   DECL_GFX_PREF(Live, "apz.pinch_lock.span_breakout_threshold", APZPinchLockSpanBreakoutThreshold, float, 1.0f / 32.0f);
     343           0 :   DECL_GFX_PREF(Live, "apz.pinch_lock.span_lock_threshold",    APZPinchLockSpanLockThreshold, float, 1.0f / 32.0f);
     344           0 :   DECL_GFX_PREF(Live, "apz.popups.enabled",                    APZPopupsEnabled, bool, false);
     345          86 :   DECL_GFX_PREF(Live, "apz.printtree",                         APZPrintTree, bool, false);
     346          16 :   DECL_GFX_PREF(Live, "apz.record_checkerboarding",            APZRecordCheckerboarding, bool, false);
     347           0 :   DECL_GFX_PREF(Live, "apz.second_tap_tolerance",              APZSecondTapTolerance, float, 0.5f);
     348             :   DECL_GFX_PREF(Live, "apz.test.fails_with_native_injection",  APZTestFailsWithNativeInjection, bool, false);
     349          46 :   DECL_GFX_PREF(Live, "apz.test.logging_enabled",              APZTestLoggingEnabled, bool, false);
     350           0 :   DECL_GFX_PREF(Live, "apz.touch_move_tolerance",              APZTouchMoveTolerance, float, 0.1f);
     351           0 :   DECL_GFX_PREF(Live, "apz.touch_start_tolerance",             APZTouchStartTolerance, float, 1.0f/4.5f);
     352           0 :   DECL_GFX_PREF(Live, "apz.velocity_bias",                     APZVelocityBias, float, 0.0f);
     353           0 :   DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms",        APZVelocityRelevanceTime, uint32_t, 150);
     354           0 :   DECL_GFX_PREF(Live, "apz.x_skate_highmem_adjust",            APZXSkateHighMemAdjust, float, 0.0f);
     355           0 :   DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier",           APZXSkateSizeMultiplier, float, 1.5f);
     356           0 :   DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier",      APZXStationarySizeMultiplier, float, 3.0f);
     357           0 :   DECL_GFX_PREF(Live, "apz.y_skate_highmem_adjust",            APZYSkateHighMemAdjust, float, 0.0f);
     358           0 :   DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier",           APZYSkateSizeMultiplier, float, 2.5f);
     359           0 :   DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier",      APZYStationarySizeMultiplier, float, 3.5f);
     360           0 :   DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms",        APZZoomAnimationDuration, int32_t, 250);
     361           0 :   DECL_GFX_PREF(Live, "apz.scale_repaint_delay_ms",            APZScaleRepaintDelay, int32_t, 500);
     362             : 
     363             :   DECL_GFX_PREF(Live, "browser.ui.scroll-toolbar-threshold",   ToolbarScrollThreshold, int32_t, 10);
     364           0 :   DECL_GFX_PREF(Live, "browser.ui.zoom.force-user-scalable",   ForceUserScalable, bool, false);
     365           0 :   DECL_GFX_PREF(Live, "browser.viewport.desktopWidth",         DesktopViewportWidth, int32_t, 980);
     366             : 
     367           0 :   DECL_GFX_PREF(Live, "dom.ipc.plugins.asyncdrawing.enabled",  PluginAsyncDrawingEnabled, bool, false);
     368          10 :   DECL_GFX_PREF(Live, "dom.meta-viewport.enabled",             MetaViewportEnabled, bool, false);
     369             :   DECL_GFX_PREF(Once, "dom.vr.enabled",                        VREnabled, bool, false);
     370             :   DECL_GFX_PREF(Live, "dom.vr.autoactivate.enabled",           VRAutoActivateEnabled, bool, false);
     371             :   DECL_GFX_PREF(Live, "dom.vr.controller_trigger_threshold",   VRControllerTriggerThreshold, float, 0.1f);
     372             :   DECL_GFX_PREF(Once, "dom.vr.external.enabled",               VRExternalEnabled, bool, true);
     373           0 :   DECL_GFX_PREF(Live, "dom.vr.navigation.timeout",             VRNavigationTimeout, int32_t, 1000);
     374             :   DECL_GFX_PREF(Once, "dom.vr.oculus.enabled",                 VROculusEnabled, bool, true);
     375             :   DECL_GFX_PREF(Live, "dom.vr.oculus.invisible.enabled",       VROculusInvisibleEnabled, bool, true);
     376             :   DECL_GFX_PREF(Live, "dom.vr.oculus.present.timeout",         VROculusPresentTimeout, int32_t, 500);
     377             :   DECL_GFX_PREF(Live, "dom.vr.oculus.quit.timeout",            VROculusQuitTimeout, int32_t, 10000);
     378             :   DECL_GFX_PREF(Once, "dom.vr.openvr.enabled",                 VROpenVREnabled, bool, false);
     379             :   DECL_GFX_PREF(Once, "dom.vr.osvr.enabled",                   VROSVREnabled, bool, false);
     380             :   DECL_GFX_PREF(Live, "dom.vr.controller.enumerate.interval",  VRControllerEnumerateInterval, int32_t, 1000);
     381             :   DECL_GFX_PREF(Live, "dom.vr.display.enumerate.interval",     VRDisplayEnumerateInterval, int32_t, 5000);
     382             :   DECL_GFX_PREF(Live, "dom.vr.inactive.timeout",               VRInactiveTimeout, int32_t, 5000);
     383             :   DECL_GFX_PREF(Live, "dom.vr.poseprediction.enabled",         VRPosePredictionEnabled, bool, true);
     384           0 :   DECL_GFX_PREF(Live, "dom.vr.require-gesture",                VRRequireGesture, bool, true);
     385             :   DECL_GFX_PREF(Live, "dom.vr.puppet.enabled",                 VRPuppetEnabled, bool, false);
     386             :   DECL_GFX_PREF(Live, "dom.vr.puppet.submitframe",             VRPuppetSubmitFrame, uint32_t, 0);
     387             :   DECL_GFX_PREF(Live, "dom.vr.display.rafMaxDuration",         VRDisplayRafMaxDuration, uint32_t, 50);
     388           0 :   DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled",        PointerEventsEnabled, bool, false);
     389             : 
     390           0 :   DECL_GFX_PREF(Live, "general.smoothScroll",                  SmoothScrollEnabled, bool, true);
     391           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.currentVelocityWeighting",
     392             :                 SmoothScrollCurrentVelocityWeighting, float, 0.25);
     393           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.durationToIntervalRatio",
     394             :                 SmoothScrollDurationToIntervalRatio, int32_t, 200);
     395           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.lines.durationMaxMS",
     396             :                 LineSmoothScrollMaxDurationMs, int32_t, 150);
     397           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.lines.durationMinMS",
     398             :                 LineSmoothScrollMinDurationMs, int32_t, 150);
     399           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel",       WheelSmoothScrollEnabled, bool, true);
     400           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMaxMS",
     401             :                 WheelSmoothScrollMaxDurationMs, int32_t, 400);
     402           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMinMS",
     403             :                 WheelSmoothScrollMinDurationMs, int32_t, 200);
     404           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.other.durationMaxMS",
     405             :                 OtherSmoothScrollMaxDurationMs, int32_t, 150);
     406           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.other.durationMinMS",
     407             :                 OtherSmoothScrollMinDurationMs, int32_t, 150);
     408           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.pages",            PageSmoothScrollEnabled, bool, true);
     409           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMaxMS",
     410             :                 PageSmoothScrollMaxDurationMs, int32_t, 150);
     411           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMinMS",
     412             :                 PageSmoothScrollMinDurationMs, int32_t, 150);
     413           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMaxMS",
     414             :                 PixelSmoothScrollMaxDurationMs, int32_t, 150);
     415           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMinMS",
     416             :                 PixelSmoothScrollMinDurationMs, int32_t, 150);
     417           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.stopDecelerationWeighting",
     418             :                 SmoothScrollStopDecelerationWeighting, float, 0.4f);
     419             : 
     420           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.enabled",
     421             :                 SmoothScrollMSDPhysicsEnabled, bool, false);
     422           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.continuousMotionMaxDeltaMS",
     423             :                 SmoothScrollMSDPhysicsContinuousMotionMaxDeltaMS, int32_t, 120);
     424           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.motionBeginSpringConstant",
     425             :                 SmoothScrollMSDPhysicsMotionBeginSpringConstant, int32_t, 1250);
     426           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.slowdownMinDeltaMS",
     427             :                 SmoothScrollMSDPhysicsSlowdownMinDeltaMS, int32_t, 12);
     428           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.slowdownMinDeltaRatio",
     429             :                 SmoothScrollMSDPhysicsSlowdownMinDeltaRatio, float, 1.3f);
     430           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.slowdownSpringConstant",
     431             :                 SmoothScrollMSDPhysicsSlowdownSpringConstant, int32_t, 2000);
     432           0 :   DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.regularSpringConstant",
     433             :                 SmoothScrollMSDPhysicsRegularSpringConstant, int32_t, 1000);
     434             : 
     435             :   DECL_GFX_PREF(Once, "gfx.android.rgb16.force",               AndroidRGB16Force, bool, false);
     436             : #if defined(ANDROID)
     437             :   DECL_GFX_PREF(Once, "gfx.apitrace.enabled",                  UseApitrace, bool, false);
     438             : #endif
     439             : #if defined(RELEASE_OR_BETA)
     440             :   // "Skip" means this is locked to the default value in beta and release.
     441             :   DECL_GFX_PREF(Skip, "gfx.blocklist.all",                     BlocklistAll, int32_t, 0);
     442             : #else
     443          60 :   DECL_GFX_PREF(Once, "gfx.blocklist.all",                     BlocklistAll, int32_t, 0);
     444             : #endif
     445             :   DECL_GFX_PREF(Live, "gfx.compositor.clearstate",             CompositorClearState, bool, false);
     446             :   DECL_GFX_PREF(Live, "gfx.compositor.glcontext.opaque",       CompositorGLContextOpaque, bool, false);
     447           0 :   DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_calls",  CanvasAutoAccelerateMinCalls, int32_t, 4);
     448           0 :   DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_frames", CanvasAutoAccelerateMinFrames, int32_t, 30);
     449           0 :   DECL_GFX_PREF(Live, "gfx.canvas.auto_accelerate.min_seconds", CanvasAutoAccelerateMinSeconds, float, 5.0f);
     450             :   DECL_GFX_PREF(Live, "gfx.canvas.azure.accelerated",          CanvasAzureAccelerated, bool, false);
     451           0 :   DECL_GFX_PREF(Once, "gfx.canvas.azure.accelerated.limit",    CanvasAzureAcceleratedLimit, int32_t, 0);
     452             :   // 0x7fff is the maximum supported xlib surface size and is more than enough for canvases.
     453           0 :   DECL_GFX_PREF(Live, "gfx.canvas.max-size",                   MaxCanvasSize, int32_t, 0x7fff);
     454             :   DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items",         CanvasSkiaGLCacheItems, int32_t, 256);
     455             :   DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size",          CanvasSkiaGLCacheSize, int32_t, 96);
     456             :   DECL_GFX_PREF(Once, "gfx.canvas.skiagl.dynamic-cache",       CanvasSkiaGLDynamicCache, bool, false);
     457             : 
     458             :   DECL_GFX_PREF(Live, "gfx.color_management.enablev4",         CMSEnableV4, bool, false);
     459             :   DECL_GFX_PREF(Live, "gfx.color_management.mode",             CMSMode, int32_t,-1);
     460             :   // The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
     461             :   DECL_GFX_PREF(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
     462          40 :   DECL_GFX_PREF(Live, "gfx.content.always-paint",              AlwaysPaint, bool, false);
     463             :   // Size in megabytes
     464             :   DECL_GFX_PREF(Once, "gfx.content.skia-font-cache-size",      SkiaContentFontCacheSize, int32_t, 10);
     465             : 
     466           0 :   DECL_GFX_PREF(Once, "gfx.device-reset.limit",                DeviceResetLimitCount, int32_t, 10);
     467           0 :   DECL_GFX_PREF(Once, "gfx.device-reset.threshold-ms",         DeviceResetThresholdMilliseconds, int32_t, -1);
     468             : 
     469             :   DECL_GFX_PREF(Once, "gfx.direct2d.disabled",                 Direct2DDisabled, bool, false);
     470             :   DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled",            Direct2DForceEnabled, bool, false);
     471             :   DECL_GFX_PREF(Live, "gfx.direct2d.destroy-dt-on-paintthread",Direct2DDestroyDTOnPaintThread, bool, true);
     472             :   DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device",   Direct3D11ReuseDecoderDevice, int32_t, -1);
     473             :   DECL_GFX_PREF(Live, "gfx.direct3d11.allow-keyed-mutex",      Direct3D11AllowKeyedMutex, bool, true);
     474             :   DECL_GFX_PREF(Live, "gfx.direct3d11.use-double-buffering",   Direct3D11UseDoubleBuffering, bool, false);
     475             :   DECL_GFX_PREF(Once, "gfx.direct3d11.enable-debug-layer",     Direct3D11EnableDebugLayer, bool, false);
     476             :   DECL_GFX_PREF(Once, "gfx.direct3d11.break-on-error",         Direct3D11BreakOnError, bool, false);
     477             :   DECL_GFX_PREF(Once, "gfx.direct3d11.sleep-on-create-device", Direct3D11SleepOnCreateDevice, int32_t, 0);
     478             :   DECL_GFX_PREF(Live, "gfx.downloadable_fonts.keep_color_bitmaps", KeepColorBitmaps, bool, false);
     479             :   DECL_GFX_PREF(Live, "gfx.downloadable_fonts.validate_variation_tables", ValidateVariationTables, bool, true);
     480             :   DECL_GFX_PREF(Live, "gfx.downloadable_fonts.otl_validation", ValidateOTLTables, bool, true);
     481          12 :   DECL_GFX_PREF(Live, "gfx.draw-color-bars",                   CompositorDrawColorBars, bool, false);
     482           0 :   DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll",      HidePluginsForScroll, bool, true);
     483           2 :   DECL_GFX_PREF(Live, "gfx.layerscope.enabled",                LayerScopeEnabled, bool, false);
     484           0 :   DECL_GFX_PREF(Live, "gfx.layerscope.port",                   LayerScopePort, int32_t, 23456);
     485             :   // Note that        "gfx.logging.level" is defined in Logging.h.
     486             :   DECL_GFX_PREF(Live, "gfx.logging.level",                     GfxLoggingLevel, int32_t, mozilla::gfx::LOG_DEFAULT);
     487             :   DECL_GFX_PREF(Once, "gfx.logging.crash.length",              GfxLoggingCrashLength, uint32_t, 16);
     488          68 :   DECL_GFX_PREF(Live, "gfx.logging.painted-pixel-count.enabled",GfxLoggingPaintedPixelCountEnabled, bool, false);
     489             :   // The maximums here are quite conservative, we can tighten them if problems show up.
     490           0 :   DECL_GFX_PREF(Once, "gfx.logging.texture-usage.enabled",     GfxLoggingTextureUsageEnabled, bool, false);
     491           0 :   DECL_GFX_PREF(Once, "gfx.logging.peak-texture-usage.enabled",GfxLoggingPeakTextureUsageEnabled, bool, false);
     492             :   // Use gfxPlatform::MaxAllocSize instead of the pref directly
     493             :   DECL_GFX_PREF(Once, "gfx.max-alloc-size",                    MaxAllocSizeDoNotUseDirectly, int32_t, (int32_t)500000000);
     494             :   // Use gfxPlatform::MaxTextureSize instead of the pref directly
     495             :   DECL_GFX_PREF(Once, "gfx.max-texture-size",                  MaxTextureSizeDoNotUseDirectly, int32_t, (int32_t)32767);
     496             :   DECL_GFX_PREF(Live, "gfx.partialpresent.force",              PartialPresent, int32_t, 0);
     497             :   DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled",             PerfWarnings, bool, false);
     498             :   DECL_GFX_PREF(Live, "gfx.testing.device-reset",              DeviceResetForTesting, int32_t, 0);
     499             :   DECL_GFX_PREF(Live, "gfx.testing.device-fail",               DeviceFailForTesting, bool, false);
     500          12 :   DECL_GFX_PREF(Once, "gfx.text.disable-aa",                   DisableAllTextAA, bool, false);
     501           0 :   DECL_GFX_PREF(Live, "gfx.ycbcr.accurate-conversion",         YCbCrAccurateConversion, bool, false);
     502             : 
     503             :   // Disable surface sharing due to issues with compatible FBConfigs on
     504             :   // NVIDIA drivers as described in bug 1193015.
     505           0 :   DECL_GFX_PREF(Live, "gfx.use-glx-texture-from-pixmap",       UseGLXTextureFromPixmap, bool, false);
     506             :   DECL_GFX_PREF(Once, "gfx.use-iosurface-textures",            UseIOSurfaceTextures, bool, false);
     507             :   DECL_GFX_PREF(Once, "gfx.use-mutex-on-present",              UseMutexOnPresent, bool, false);
     508             :   DECL_GFX_PREF(Once, "gfx.use-surfacetexture-textures",       UseSurfaceTextureTextures, bool, false);
     509             : 
     510          16 :   DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms",   CollectScrollTransforms, bool, false);
     511         152 :   DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count",  CompositorUnobserveCount, int32_t, 10);
     512             : 
     513             :   DECL_GFX_PREF(Once, "gfx.webrender.all",                     WebRenderAll, bool, false);
     514             :   DECL_GFX_PREF(Once, "gfx.webrender.all.qualified",           WebRenderAllQualified, bool, false);
     515           0 :   DECL_GFX_PREF(Once, "gfx.webrender.async-scene-build",       WebRenderAsyncSceneBuild, bool, true);
     516             :   DECL_GFX_PREF(Once, "gfx.webrender.enabled",                 WebRenderEnabledDoNotUseDirectly, bool, false);
     517           0 :   DECL_GFX_PREF(Live, "gfx.webrender.blob-images",             WebRenderBlobImages, bool, true);
     518           0 :   DECL_GFX_PREF(Live, "gfx.webrender.blob.invalidation",       WebRenderBlobInvalidation, bool, false);
     519           0 :   DECL_GFX_PREF(Live, "gfx.webrender.highlight-painted-layers",WebRenderHighlightPaintedLayers, bool, false);
     520             : 
     521             :   // Use vsync events generated by hardware
     522           0 :   DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs",           WorkAroundDriverBugs, bool, true);
     523             : 
     524             :   DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist",       IgnoreDXInterop2Blacklist, bool, false);
     525           0 :   DECL_GFX_PREF(Live, "gl.msaa-level",                         MSAALevel, uint32_t, 2);
     526             : #if defined(XP_MACOSX)
     527             :   DECL_GFX_PREF(Live, "gl.multithreaded",                      GLMultithreaded, bool, false);
     528             : #endif
     529             :   DECL_GFX_PREF(Live, "gl.require-hardware",                   RequireHardwareGL, bool, false);
     530           0 :   DECL_GFX_PREF(Live, "gl.use-tls-is-current",                 UseTLSIsCurrent, int32_t, 0);
     531             : 
     532           0 :   DECL_GFX_PREF(Live, "image.animated.decode-on-demand.threshold-kb", ImageAnimatedDecodeOnDemandThresholdKB, uint32_t, 20480);
     533           0 :   DECL_GFX_PREF(Live, "image.animated.decode-on-demand.batch-size", ImageAnimatedDecodeOnDemandBatchSize, uint32_t, 6);
     534           0 :   DECL_GFX_PREF(Live, "image.animated.resume-from-last-displayed", ImageAnimatedResumeFromLastDisplayed, bool, false);
     535          28 :   DECL_GFX_PREF(Live, "image.cache.factor2.threshold-surfaces", ImageCacheFactor2ThresholdSurfaces, int32_t, -1);
     536           2 :   DECL_GFX_PREF(Once, "image.cache.size",                      ImageCacheSize, int32_t, 5*1024*1024);
     537           2 :   DECL_GFX_PREF(Once, "image.cache.timeweight",                ImageCacheTimeWeight, int32_t, 500);
     538          32 :   DECL_GFX_PREF(Live, "image.decode-immediately.enabled",      ImageDecodeImmediatelyEnabled, bool, false);
     539           6 :   DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
     540           0 :   DECL_GFX_PREF(Live, "image.infer-src-animation.threshold-ms", ImageInferSrcAnimationThresholdMS, uint32_t, 2000);
     541           0 :   DECL_GFX_PREF(Live, "image.layout_network_priority",         ImageLayoutNetworkPriority, bool, true);
     542           0 :   DECL_GFX_PREF(Once, "image.mem.decode_bytes_at_a_time",      ImageMemDecodeBytesAtATime, uint32_t, 200000);
     543          32 :   DECL_GFX_PREF(Live, "image.mem.discardable",                 ImageMemDiscardable, bool, false);
     544          28 :   DECL_GFX_PREF(Once, "image.mem.animated.discardable",        ImageMemAnimatedDiscardable, bool, false);
     545           0 :   DECL_GFX_PREF(Live, "image.mem.animated.use_heap",           ImageMemAnimatedUseHeap, bool, false);
     546           0 :   DECL_GFX_PREF(Live, "image.mem.shared",                      ImageMemShared, bool, true);
     547           2 :   DECL_GFX_PREF(Once, "image.mem.surfacecache.discard_factor", ImageMemSurfaceCacheDiscardFactor, uint32_t, 1);
     548           2 :   DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb",    ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
     549           2 :   DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
     550           2 :   DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor",    ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
     551          28 :   DECL_GFX_PREF(Live, "image.mem.volatile.min_threshold_kb",   ImageMemVolatileMinThresholdKB, int32_t, -1);
     552           2 :   DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit",    ImageMTDecodingLimit, int32_t, -1);
     553           2 :   DECL_GFX_PREF(Once, "image.multithreaded_decoding.idle_timeout", ImageMTDecodingIdleTimeout, int32_t, -1);
     554             : 
     555             :   DECL_GFX_PREF(Once, "layers.acceleration.disabled",          LayersAccelerationDisabledDoNotUseDirectly, bool, false);
     556         124 :   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps",          LayersDrawFPS, bool, false);
     557           0 :   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram",  FPSPrintHistogram, bool, false);
     558           0 :   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
     559             :   DECL_GFX_PREF(Once, "layers.acceleration.force-enabled",     LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
     560           0 :   DECL_GFX_PREF(Live, "layers.advanced.border-layers",           LayersAllowBorderLayers, bool, false);
     561          98 :   DECL_GFX_PREF(Live, "layers.advanced.basic-layer.enabled",          LayersAdvancedBasicLayerEnabled, bool, false);
     562             :   DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled",     LayersAMDSwitchableGfxEnabled, bool, false);
     563             :   DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled",         AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
     564             :   DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
     565             :   DECL_GFX_PREF(Live, "layers.bench.enabled",                  LayersBenchEnabled, bool, false);
     566             :   DECL_GFX_PREF(Once, "layers.bufferrotation.enabled",         BufferRotationEnabled, bool, true);
     567             :   DECL_GFX_PREF(Live, "layers.child-process-shutdown",         ChildProcessShutdown, bool, true);
     568             : #ifdef MOZ_GFX_OPTIMIZE_MOBILE
     569             :   // If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
     570             :   // and ignore the preference.
     571             :   DECL_GFX_PREF(Skip, "layers.componentalpha.enabled",         ComponentAlphaEnabled, bool, false);
     572             : #else
     573             :   // If MOZ_GFX_OPTIMIZE_MOBILE is not defined, we actually take the
     574             :   // preference value, defaulting to true.
     575           0 :   DECL_GFX_PREF(Once, "layers.componentalpha.enabled",         ComponentAlphaEnabled, bool, true);
     576             : #endif
     577             :   DECL_GFX_PREF(Once, "layers.d3d11.force-warp",               LayersD3D11ForceWARP, bool, false);
     578           0 :   DECL_GFX_PREF(Live, "layers.deaa.enabled",                   LayersDEAAEnabled, bool, false);
     579             :   DECL_GFX_PREF(Live, "layers.draw-bigimage-borders",          DrawBigImageBorders, bool, false);
     580             :   DECL_GFX_PREF(Live, "layers.draw-borders",                   DrawLayerBorders, bool, false);
     581             :   DECL_GFX_PREF(Live, "layers.draw-tile-borders",              DrawTileBorders, bool, false);
     582           0 :   DECL_GFX_PREF(Live, "layers.draw-layer-info",                DrawLayerInfo, bool, false);
     583          12 :   DECL_GFX_PREF(Live, "layers.dump",                           LayersDump, bool, false);
     584           0 :   DECL_GFX_PREF(Live, "layers.dump-texture",                   LayersDumpTexture, bool, false);
     585             : #ifdef MOZ_DUMP_PAINTING
     586          36 :   DECL_GFX_PREF(Live, "layers.dump-client-layers",             DumpClientLayers, bool, false);
     587        1002 :   DECL_GFX_PREF(Live, "layers.dump-decision",                  LayersDumpDecision, bool, false);
     588          16 :   DECL_GFX_PREF(Live, "layers.dump-host-layers",               DumpHostLayers, bool, false);
     589             : #endif
     590             : 
     591             :   // 0 is "no change" for contrast, positive values increase it, negative values
     592             :   // decrease it until we hit mid gray at -1 contrast, after that it gets weird.
     593          12 :   DECL_GFX_PREF(Live, "layers.effect.contrast",                LayersEffectContrast, float, 0.0f);
     594          12 :   DECL_GFX_PREF(Live, "layers.effect.grayscale",               LayersEffectGrayscale, bool, false);
     595          12 :   DECL_GFX_PREF(Live, "layers.effect.invert",                  LayersEffectInvert, bool, false);
     596           0 :   DECL_GFX_PREF(Once, "layers.enable-tiles",                   LayersTilesEnabled, bool, false);
     597             :   DECL_GFX_PREF(Once, "layers.enable-tiles-if-skia-pomtp",     LayersTilesEnabledIfSkiaPOMTP, bool, false);
     598             :   DECL_GFX_PREF(Live, "layers.flash-borders",                  FlashLayerBorders, bool, false);
     599           2 :   DECL_GFX_PREF(Once, "layers.force-shmem-tiles",              ForceShmemTiles, bool, false);
     600             :   DECL_GFX_PREF(Once, "layers.gpu-process.allow-software",     GPUProcessAllowSoftware, bool, false);
     601             :   DECL_GFX_PREF(Once, "layers.gpu-process.enabled",            GPUProcessEnabled, bool, false);
     602             :   DECL_GFX_PREF(Once, "layers.gpu-process.force-enabled",      GPUProcessForceEnabled, bool, false);
     603             :   DECL_GFX_PREF(Once, "layers.gpu-process.ipc_reply_timeout_ms", GPUProcessIPCReplyTimeoutMs, int32_t, 10000);
     604           0 :   DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts",       GPUProcessMaxRestarts, int32_t, 1);
     605             :   // Note: This pref will only be used if it is less than layers.gpu-process.max_restarts.
     606           0 :   DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts_with_decoder", GPUProcessMaxRestartsWithDecoder, int32_t, 0);
     607           0 :   DECL_GFX_PREF(Once, "layers.gpu-process.startup_timeout_ms", GPUProcessTimeoutMs, int32_t, 5000);
     608         640 :   DECL_GFX_PREF(Live, "layers.low-precision-buffer",           UseLowPrecisionBuffer, bool, false);
     609           0 :   DECL_GFX_PREF(Live, "layers.low-precision-opacity",          LowPrecisionOpacity, float, 1.0f);
     610           0 :   DECL_GFX_PREF(Live, "layers.low-precision-resolution",       LowPrecisionResolution, float, 0.25f);
     611          58 :   DECL_GFX_PREF(Live, "layers.max-active",                     MaxActiveLayers, int32_t, -1);
     612             :   DECL_GFX_PREF(Once, "layers.mlgpu.enabled",                  AdvancedLayersEnabledDoNotUseDirectly, bool, false);
     613           0 :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-buffer-cache",      AdvancedLayersEnableBufferCache, bool, true);
     614           0 :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-buffer-sharing",    AdvancedLayersEnableBufferSharing, bool, true);
     615           0 :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-clear-view",        AdvancedLayersEnableClearView, bool, true);
     616           0 :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-cpu-occlusion",     AdvancedLayersEnableCPUOcclusion, bool, true);
     617           0 :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-depth-buffer",      AdvancedLayersEnableDepthBuffer, bool, false);
     618           0 :   DECL_GFX_PREF(Live, "layers.mlgpu.enable-invalidation",      AdvancedLayersUseInvalidation, bool, true);
     619             :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-on-windows7",       AdvancedLayersEnableOnWindows7, bool, false);
     620           0 :   DECL_GFX_PREF(Once, "layers.mlgpu.enable-container-resizing", AdvancedLayersEnableContainerResizing, bool, true);
     621             :   DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
     622          18 :   DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
     623           0 :   DECL_GFX_PREF(Live, "layers.omtp.dump-capture",              LayersOMTPDumpCapture, bool, false);
     624           2 :   DECL_GFX_PREF(Once, "layers.omtp.paint-workers",             LayersOMTPPaintWorkers, int32_t, 1);
     625           0 :   DECL_GFX_PREF(Live, "layers.omtp.release-capture-on-main-thread", LayersOMTPReleaseCaptureOnMainThread, bool, false);
     626           0 :   DECL_GFX_PREF(Live, "layers.orientation.sync.timeout",       OrientationSyncMillis, uint32_t, (uint32_t)0);
     627             :   DECL_GFX_PREF(Once, "layers.prefer-opengl",                  LayersPreferOpenGL, bool, false);
     628           2 :   DECL_GFX_PREF(Live, "layers.progressive-paint",              ProgressivePaint, bool, false);
     629           0 :   DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false);
     630           0 :   DECL_GFX_PREF(Live, "layers.single-tile.enabled",            LayersSingleTileEnabled, bool, true);
     631           0 :   DECL_GFX_PREF(Live, "layers.force-synchronous-resize",       LayersForceSynchronousResize, bool, true);
     632             : 
     633             :   // We allow for configurable and rectangular tile size to avoid wasting memory on devices whose
     634             :   // screen size does not align nicely to the default tile size. Although layers can be any size,
     635             :   // they are often the same size as the screen, especially for width.
     636             :   DECL_GFX_PREF(Once, "layers.tile-width",                     LayersTileWidth, int32_t, 256);
     637             :   DECL_GFX_PREF(Once, "layers.tile-height",                    LayersTileHeight, int32_t, 256);
     638           0 :   DECL_GFX_PREF(Once, "layers.tile-initial-pool-size",         LayersTileInitialPoolSize, uint32_t, (uint32_t)50);
     639           0 :   DECL_GFX_PREF(Once, "layers.tile-pool-unused-size",          LayersTilePoolUnusedSize, uint32_t, (uint32_t)10);
     640           0 :   DECL_GFX_PREF(Once, "layers.tile-pool-shrink-timeout",       LayersTilePoolShrinkTimeout, uint32_t, (uint32_t)50);
     641           0 :   DECL_GFX_PREF(Once, "layers.tile-pool-clear-timeout",        LayersTilePoolClearTimeout, uint32_t, (uint32_t)5000);
     642             :   DECL_GFX_PREF(Once, "layers.tiles.adjust",                   LayersTilesAdjust, bool, true);
     643           0 :   DECL_GFX_PREF(Live, "layers.tiles.retain-back-buffer",       LayersTileRetainBackBuffer, bool, true);
     644           2 :   DECL_GFX_PREF(Once, "layers.tiles.edge-padding",             TileEdgePaddingEnabled, bool, false);
     645           0 :   DECL_GFX_PREF(Live, "layers.tiles.fade-in.enabled",          LayerTileFadeInEnabled, bool, false);
     646           0 :   DECL_GFX_PREF(Live, "layers.tiles.fade-in.duration-ms",      LayerTileFadeInDuration, uint32_t, 250);
     647           0 :   DECL_GFX_PREF(Live, "layers.transaction.warning-ms",         LayerTransactionWarning, uint32_t, 200);
     648           0 :   DECL_GFX_PREF(Once, "layers.uniformity-info",                UniformityInfo, bool, false);
     649             :   DECL_GFX_PREF(Once, "layers.use-image-offscreen-surfaces",   UseImageOffscreenSurfaces, bool, true);
     650           0 :   DECL_GFX_PREF(Live, "layers.draw-mask-debug",                DrawMaskLayer, bool, false);
     651             : 
     652           0 :   DECL_GFX_PREF(Live, "layers.geometry.opengl.enabled",        OGLLayerGeometry, bool, false);
     653           0 :   DECL_GFX_PREF(Live, "layers.geometry.basic.enabled",         BasicLayerGeometry, bool, false);
     654             :   DECL_GFX_PREF(Live, "layers.geometry.d3d11.enabled",         D3D11LayerGeometry, bool, false);
     655             : 
     656           0 :   DECL_GFX_PREF(Live, "layout.animation.prerender.partial", PartiallyPrerenderAnimatedContent, bool, false);
     657           0 :   DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-x", AnimationPrerenderViewportRatioLimitX, float, 1.125f);
     658           0 :   DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-y", AnimationPrerenderViewportRatioLimitY, float, 1.125f);
     659           0 :   DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-x", AnimationPrerenderAbsoluteLimitX, uint32_t, 4096);
     660           0 :   DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-y", AnimationPrerenderAbsoluteLimitY, uint32_t, 4096);
     661             : 
     662           0 :   DECL_GFX_PREF(Live, "layout.css.paint-order.enabled",        PaintOrderEnabled, bool, false);
     663           0 :   DECL_GFX_PREF(Live, "layout.css.scroll-behavior.damping-ratio", ScrollBehaviorDampingRatio, float, 1.0f);
     664           0 :   DECL_GFX_PREF(Live, "layout.css.scroll-behavior.enabled",    ScrollBehaviorEnabled, bool, true);
     665           0 :   DECL_GFX_PREF(Live, "layout.css.scroll-behavior.spring-constant", ScrollBehaviorSpringConstant, float, 250.0f);
     666           0 :   DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-max-velocity", ScrollSnapPredictionMaxVelocity, int32_t, 2000);
     667           0 :   DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f);
     668           0 :   DECL_GFX_PREF(Live, "layout.css.scroll-snap.proximity-threshold", ScrollSnapProximityThreshold, int32_t, 200);
     669           0 :   DECL_GFX_PREF(Live, "layout.css.touch_action.enabled",       TouchActionEnabled, bool, false);
     670             : 
     671           0 :   DECL_GFX_PREF(Live, "layout.display-list.build-twice",       LayoutDisplayListBuildTwice, bool, false);
     672           0 :   DECL_GFX_PREF(Live, "layout.display-list.retain",            LayoutRetainDisplayList, bool, true);
     673        1638 :   DECL_GFX_PREF(Live, "layout.display-list.retain.chrome",     LayoutRetainDisplayListChrome, bool, false);
     674           0 :   DECL_GFX_PREF(Live, "layout.display-list.retain.verify",     LayoutVerifyRetainDisplayList, bool, false);
     675           0 :   DECL_GFX_PREF(Live, "layout.display-list.retain.verify.order", LayoutVerifyRetainDisplayListOrder, bool, false);
     676           0 :   DECL_GFX_PREF(Live, "layout.display-list.rebuild-frame-limit", LayoutRebuildFrameLimit, uint32_t, 500);
     677             :   DECL_GFX_PREF(Live, "layout.display-list.dump",              LayoutDumpDisplayList, bool, false);
     678             :   DECL_GFX_PREF(Live, "layout.display-list.dump-content",      LayoutDumpDisplayListContent, bool, false);
     679             :   DECL_GFX_PREF(Live, "layout.display-list.dump-parent",       LayoutDumpDisplayListParent, bool, false);
     680           0 :   DECL_GFX_PREF(Live, "layout.display-list.show-rebuild-area", LayoutDisplayListShowArea, bool, false);
     681             : 
     682           2 :   DECL_GFX_PREF(Once, "layout.frame_rate",                     LayoutFrameRate, int32_t, -1);
     683          36 :   DECL_GFX_PREF(Once, "layout.less-event-region-items",        LessEventRegionItems, bool, true);
     684           0 :   DECL_GFX_PREF(Live, "layout.min-active-layer-size",          LayoutMinActiveLayerSize, int, 64);
     685          32 :   DECL_GFX_PREF(Once, "layout.paint_rects_separately",         LayoutPaintRectsSeparately, bool, true);
     686             : 
     687             :   // This and code dependent on it should be removed once containerless scrolling looks stable.
     688         292 :   DECL_GFX_PREF(Once, "layout.scroll.root-frame-containers",   LayoutUseContainersForRootFrames, bool, true);
     689             :   // This pref is to be set by test code only.
     690           0 :   DECL_GFX_PREF(Live, "layout.scrollbars.always-layerize-track", AlwaysLayerizeScrollbarTrackTestOnly, bool, false);
     691           0 :   DECL_GFX_PREF(Live, "layout.smaller-painted-layers",         LayoutSmallerPaintedLayers, bool, false);
     692             : 
     693             :   DECL_GFX_PREF(Once, "media.hardware-video-decoding.force-enabled",
     694             :                                                                HardwareVideoDecodingForceEnabled, bool, false);
     695             : #ifdef XP_WIN
     696             :   DECL_GFX_PREF(Live, "media.wmf.dxva.d3d11.enabled", PDMWMFAllowD3D11, bool, true);
     697             :   DECL_GFX_PREF(Live, "media.wmf.dxva.max-videos", PDMWMFMaxDXVAVideos, uint32_t, 8);
     698             :   DECL_GFX_PREF(Live, "media.wmf.use-nv12-format", PDMWMFUseNV12Format, bool, true);
     699             :   DECL_GFX_PREF(Once, "media.wmf.use-sync-texture", PDMWMFUseSyncTexture, bool, true);
     700             :   DECL_GFX_PREF(Live, "media.wmf.low-latency.enabled", PDMWMFLowLatencyEnabled, bool, false);
     701             :   DECL_GFX_PREF(Live, "media.wmf.skip-blacklist", PDMWMFSkipBlacklist, bool, false);
     702             :   DECL_GFX_PREF(Live, "media.wmf.deblacklisting-for-telemetry-in-gpu-process", PDMWMFDeblacklistingForTelemetryInGPUProcess, bool, false);
     703             :   DECL_GFX_PREF(Live, "media.wmf.amd.vp9.enabled", PDMWMFAMDVP9DecoderEnabled, bool, false);
     704             :   DECL_GFX_PREF(Live, "media.wmf.amd.highres.enabled", PDMWMFAMDHighResEnabled, bool, true);
     705             :   DECL_GFX_PREF(Live, "media.wmf.allow-unsupported-resolutions",  PDMWMFAllowUnsupportedResolutions, bool, false);
     706             : #endif
     707             : 
     708             :   // These affect how line scrolls from wheel events will be accelerated.
     709           0 :   DECL_GFX_PREF(Live, "mousewheel.acceleration.factor",        MouseWheelAccelerationFactor, int32_t, -1);
     710           0 :   DECL_GFX_PREF(Live, "mousewheel.acceleration.start",         MouseWheelAccelerationStart, int32_t, -1);
     711             : 
     712             :   // This affects whether events will be routed through APZ or not.
     713           0 :   DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.enabled",
     714             :                                                                MouseWheelHasRootScrollDeltaOverride, bool, false);
     715           0 :   DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.horizontal.factor",
     716             :                                                                MouseWheelRootScrollHorizontalFactor, int32_t, 0);
     717           0 :   DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.vertical.factor",
     718             :                                                                MouseWheelRootScrollVerticalFactor, int32_t, 0);
     719           0 :   DECL_GFX_PREF(Live, "mousewheel.transaction.ignoremovedelay",MouseWheelIgnoreMoveDelayMs, int32_t, (int32_t)100);
     720           0 :   DECL_GFX_PREF(Live, "mousewheel.transaction.timeout",        MouseWheelTransactionTimeoutMs, int32_t, (int32_t)1500);
     721             : 
     722           0 :   DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
     723             : 
     724           0 :   DECL_GFX_PREF(Live, "print.font-variations-as-paths",        PrintFontVariationsAsPaths, bool, true);
     725             : 
     726           0 :   DECL_GFX_PREF(Once, "slider.snapMultiplier",                 SliderSnapMultiplier, int32_t, 0);
     727             : 
     728           0 :   DECL_GFX_PREF(Live, "test.events.async.enabled",             TestEventsAsyncEnabled, bool, false);
     729           0 :   DECL_GFX_PREF(Live, "test.mousescroll",                      MouseScrollTestingEnabled, bool, false);
     730             : 
     731           0 :   DECL_GFX_PREF(Live, "toolkit.scrollbox.horizontalScrollDistance", ToolkitHorizontalScrollDistance, int32_t, 5);
     732           0 :   DECL_GFX_PREF(Live, "toolkit.scrollbox.verticalScrollDistance",   ToolkitVerticalScrollDistance, int32_t, 3);
     733             : 
     734           0 :   DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay",     UiClickHoldContextMenusDelay, int32_t, 500);
     735             : 
     736             :   // WebGL (for pref access from Worker threads)
     737           0 :   DECL_GFX_PREF(Live, "webgl.1.allow-core-profiles",           WebGL1AllowCoreProfile, bool, false);
     738             : 
     739           0 :   DECL_GFX_PREF(Live, "webgl.all-angle-options",               WebGLAllANGLEOptions, bool, false);
     740           2 :   DECL_GFX_PREF(Live, "webgl.angle.force-d3d11",               WebGLANGLEForceD3D11, bool, false);
     741           0 :   DECL_GFX_PREF(Live, "webgl.angle.try-d3d11",                 WebGLANGLETryD3D11, bool, false);
     742           2 :   DECL_GFX_PREF(Live, "webgl.angle.force-warp",                WebGLANGLEForceWARP, bool, false);
     743           0 :   DECL_GFX_PREF(Live, "webgl.bypass-shader-validation",        WebGLBypassShaderValidator, bool, true);
     744           0 :   DECL_GFX_PREF(Live, "webgl.can-lose-context-in-foreground",  WebGLCanLoseContextInForeground, bool, true);
     745           0 :   DECL_GFX_PREF(Live, "webgl.default-no-alpha",                WebGLDefaultNoAlpha, bool, false);
     746             :   DECL_GFX_PREF(Live, "webgl.disable-angle",                   WebGLDisableANGLE, bool, false);
     747             :   DECL_GFX_PREF(Live, "webgl.disable-wgl",                     WebGLDisableWGL, bool, false);
     748           0 :   DECL_GFX_PREF(Live, "webgl.disable-extensions",              WebGLDisableExtensions, bool, false);
     749             :   DECL_GFX_PREF(Live, "webgl.dxgl.enabled",                    WebGLDXGLEnabled, bool, false);
     750             :   DECL_GFX_PREF(Live, "webgl.dxgl.needs-finish",               WebGLDXGLNeedsFinish, bool, false);
     751             : 
     752           0 :   DECL_GFX_PREF(Live, "webgl.disable-fail-if-major-performance-caveat",
     753             :                 WebGLDisableFailIfMajorPerformanceCaveat, bool, false);
     754           0 :   DECL_GFX_PREF(Live, "webgl.disable-DOM-blit-uploads",
     755             :                 WebGLDisableDOMBlitUploads, bool, false);
     756             : 
     757           0 :   DECL_GFX_PREF(Live, "webgl.disabled",                        WebGLDisabled, bool, false);
     758             : 
     759           0 :   DECL_GFX_PREF(Live, "webgl.enable-draft-extensions",         WebGLDraftExtensionsEnabled, bool, false);
     760           0 :   DECL_GFX_PREF(Live, "webgl.enable-privileged-extensions",    WebGLPrivilegedExtensionsEnabled, bool, false);
     761             :   DECL_GFX_PREF(Live, "webgl.enable-surface-texture",          WebGLSurfaceTextureEnabled, bool, false);
     762           0 :   DECL_GFX_PREF(Live, "webgl.enable-webgl2",                   WebGL2Enabled, bool, true);
     763           0 :   DECL_GFX_PREF(Live, "webgl.force-enabled",                   WebGLForceEnabled, bool, false);
     764           2 :   DECL_GFX_PREF(Once, "webgl.force-layers-readback",           WebGLForceLayersReadback, bool, false);
     765           0 :   DECL_GFX_PREF(Live, "webgl.force-index-validation",          WebGLForceIndexValidation, int32_t, 0);
     766           0 :   DECL_GFX_PREF(Live, "webgl.lose-context-on-memory-pressure", WebGLLoseContextOnMemoryPressure, bool, false);
     767           0 :   DECL_GFX_PREF(Live, "webgl.max-contexts",                    WebGLMaxContexts, uint32_t, 32);
     768           0 :   DECL_GFX_PREF(Live, "webgl.max-contexts-per-principal",      WebGLMaxContextsPerPrincipal, uint32_t, 16);
     769           0 :   DECL_GFX_PREF(Live, "webgl.max-warnings-per-context",        WebGLMaxWarningsPerContext, uint32_t, 32);
     770           0 :   DECL_GFX_PREF(Live, "webgl.min_capability_mode",             WebGLMinCapabilityMode, bool, false);
     771           0 :   DECL_GFX_PREF(Live, "webgl.msaa-force",                      WebGLForceMSAA, bool, false);
     772           0 :   DECL_GFX_PREF(Live, "webgl.msaa-samples",                    WebGLMsaaSamples, uint32_t, 4);
     773             :   DECL_GFX_PREF(Live, "webgl.prefer-16bpp",                    WebGLPrefer16bpp, bool, false);
     774           0 :   DECL_GFX_PREF(Live, "webgl.restore-context-when-visible",    WebGLRestoreWhenVisible, bool, true);
     775           0 :   DECL_GFX_PREF(Live, "webgl.allow-immediate-queries",         WebGLImmediateQueries, bool, false);
     776           0 :   DECL_GFX_PREF(Live, "webgl.allow-fb-invalidation",           WebGLFBInvalidation, bool, false);
     777             : 
     778           0 :   DECL_GFX_PREF(Live, "webgl.perf.max-warnings",                    WebGLMaxPerfWarnings, int32_t, 0);
     779           0 :   DECL_GFX_PREF(Live, "webgl.perf.max-acceptable-fb-status-invals", WebGLMaxAcceptableFBStatusInvals, int32_t, 0);
     780           0 :   DECL_GFX_PREF(Live, "webgl.perf.spew-frame-allocs",          WebGLSpewFrameAllocs, bool, true);
     781             : 
     782             : 
     783           0 :   DECL_GFX_PREF(Live, "webgl.webgl2-compat-mode",              WebGL2CompatMode, bool, false);
     784             : 
     785             :   DECL_GFX_PREF(Live, "widget.window-transforms.disabled",     WindowTransformsDisabled, bool, false);
     786             : 
     787             :   // WARNING:
     788             :   // Please make sure that you've added your new preference to the list above in alphabetical order.
     789             :   // Please do not just append it to the end of the list.
     790             : 
     791             : public:
     792             :   // Manage the singleton:
     793           0 :   static gfxPrefs& GetSingleton()
     794             :   {
     795           0 :     return sInstance ? *sInstance : CreateAndInitializeSingleton();
     796             :   }
     797             :   static void DestroySingleton();
     798             :   static bool SingletonExists();
     799             : 
     800             : private:
     801             :   static gfxPrefs& CreateAndInitializeSingleton();
     802             : 
     803             :   static gfxPrefs* sInstance;
     804             :   static bool sInstanceHasBeenDestroyed;
     805             :   static nsTArray<Pref*>* sGfxPrefList;
     806             : 
     807             : private:
     808             :   // The constructor cannot access GetSingleton(), since sInstance (necessarily)
     809             :   // has not been assigned yet. Follow-up initialization that needs GetSingleton()
     810             :   // must be added to Init().
     811             :   void Init();
     812             : 
     813             :   static bool IsPrefsServiceAvailable();
     814             :   static bool IsParentProcess();
     815             :   // Creating these to avoid having to include Preferences.h in the .h
     816             :   static void PrefAddVarCache(bool*, const char*, bool);
     817             :   static void PrefAddVarCache(int32_t*, const char*, int32_t);
     818             :   static void PrefAddVarCache(uint32_t*, const char*, uint32_t);
     819             :   static void PrefAddVarCache(float*, const char*, float);
     820             :   static void PrefAddVarCache(std::string*, const char*, std::string);
     821             :   static void PrefAddVarCache(AtomicBool*, const char*, bool);
     822             :   static void PrefAddVarCache(AtomicInt32*, const char*, int32_t);
     823             :   static void PrefAddVarCache(AtomicUint32*, const char*, uint32_t);
     824             :   static bool PrefGet(const char*, bool);
     825             :   static int32_t PrefGet(const char*, int32_t);
     826             :   static uint32_t PrefGet(const char*, uint32_t);
     827             :   static float PrefGet(const char*, float);
     828             :   static std::string PrefGet(const char*, std::string);
     829             :   static void PrefSet(const char* aPref, bool aValue);
     830             :   static void PrefSet(const char* aPref, int32_t aValue);
     831             :   static void PrefSet(const char* aPref, uint32_t aValue);
     832             :   static void PrefSet(const char* aPref, float aValue);
     833             :   static void PrefSet(const char* aPref, std::string aValue);
     834             :   static void WatchChanges(const char* aPrefname, Pref* aPref);
     835             :   static void UnwatchChanges(const char* aPrefname, Pref* aPref);
     836             :   // Creating these to avoid having to include PGPU.h in the .h
     837             :   static void CopyPrefValue(const bool* aValue, GfxPrefValue* aOutValue);
     838             :   static void CopyPrefValue(const int32_t* aValue, GfxPrefValue* aOutValue);
     839             :   static void CopyPrefValue(const uint32_t* aValue, GfxPrefValue* aOutValue);
     840             :   static void CopyPrefValue(const float* aValue, GfxPrefValue* aOutValue);
     841             :   static void CopyPrefValue(const std::string* aValue, GfxPrefValue* aOutValue);
     842             :   static void CopyPrefValue(const GfxPrefValue* aValue, bool* aOutValue);
     843             :   static void CopyPrefValue(const GfxPrefValue* aValue, int32_t* aOutValue);
     844             :   static void CopyPrefValue(const GfxPrefValue* aValue, uint32_t* aOutValue);
     845             :   static void CopyPrefValue(const GfxPrefValue* aValue, float* aOutValue);
     846             :   static void CopyPrefValue(const GfxPrefValue* aValue, std::string* aOutValue);
     847             : 
     848             :   static void AssertMainThread();
     849             : 
     850             :   // Some wrapper functions for the DECL_OVERRIDE_PREF prefs' base values, so
     851             :   // that we don't to include all sorts of header files into this gfxPrefs.h
     852             :   // file.
     853             :   static bool OverrideBase_WebRender();
     854             : 
     855             :   gfxPrefs();
     856             :   ~gfxPrefs();
     857             :   gfxPrefs(const gfxPrefs&) = delete;
     858             :   gfxPrefs& operator=(const gfxPrefs&) = delete;
     859             : };
     860             : 
     861             : #undef DECL_GFX_PREF /* Don't need it outside of this file */
     862             : 
     863             : #endif /* GFX_PREFS_H */

Generated by: LCOV version 1.13-14-ga5dd952