Bug 1550422 - P23. Remove now unused gfxPrefs. r=jrmuizel

And with some tidying some comments and removing stray #include "gfxPrefs.h"

Differential Revision: https://phabricator.services.mozilla.com/D31468

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-05-24 11:37:50 +00:00
Родитель 50f48b12ca
Коммит 074aea57fe
113 изменённых файлов: 52 добавлений и 902 удалений

Просмотреть файл

@ -27,8 +27,9 @@ const { getComputedStyle } = require("./markup");
// //
// This canvas size value is the safest we can use because most GPUs can handle it. // This canvas size value is the safest we can use because most GPUs can handle it.
// It's also far from the maximum canvas memory allocation limit (4096x4096x4 is // It's also far from the maximum canvas memory allocation limit (4096x4096x4 is
// 67.108.864 bytes, where the limit is 500.000.000 bytes, see: // 67.108.864 bytes, where the limit is 500.000.000 bytes, see
// http://searchfox.org/mozilla-central/source/gfx/thebes/gfxPrefs.h#401). // MaxAllocSizeDoNotUseDirectly in:
// https://searchfox.org/mozilla-central/source/modules/libpref/init/StaticPrefList.h).
// //
// Note: // Note:
// Once bug 1232491 lands, we could try to refactor this code to use the values from // Once bug 1232491 lands, we could try to refactor this code to use the values from

Просмотреть файл

@ -269,7 +269,6 @@
#include "nsWindowSizes.h" #include "nsWindowSizes.h"
#include "mozilla/dom/Location.h" #include "mozilla/dom/Location.h"
#include "mozilla/dom/FontFaceSet.h" #include "mozilla/dom/FontFaceSet.h"
#include "gfxPrefs.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "mozilla/ServoStyleSet.h" #include "mozilla/ServoStyleSet.h"
#include "mozilla/StyleSheet.h" #include "mozilla/StyleSheet.h"

Просмотреть файл

@ -4,7 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxPrefs.h"
#include "mozilla/dom/Event.h" #include "mozilla/dom/Event.h"
#include "mozilla/EventForwards.h" #include "mozilla/EventForwards.h"
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"

Просмотреть файл

@ -39,8 +39,6 @@
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "SVGObserverUtils.h" #include "SVGObserverUtils.h"
#include "gfxPrefs.h"
#include "mozAutoDocUpdate.h" #include "mozAutoDocUpdate.h"
#include "mozilla/AsyncEventDispatcher.h" #include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "WebGL2Context.h" #include "WebGL2Context.h"
#include "GLContext.h" #include "GLContext.h"
#include "WebGLQuery.h" #include "WebGLQuery.h"
#include "gfxPrefs.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
namespace mozilla { namespace mozilla {

Просмотреть файл

@ -6,7 +6,6 @@
#include "WebGLContext.h" #include "WebGLContext.h"
#include "WebGLContextUtils.h" #include "WebGLContextUtils.h"
#include "WebGLExtensions.h" #include "WebGLExtensions.h"
#include "gfxPrefs.h"
#include "GLContext.h" #include "GLContext.h"
#include "nsString.h" #include "nsString.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "WebGLExtensions.h" #include "WebGLExtensions.h"
#include "gfxPrefs.h"
#include "GLContext.h" #include "GLContext.h"
#include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h" #include "mozilla/dom/WebGLRenderingContextBinding.h"

Просмотреть файл

@ -5,7 +5,6 @@
#include "WebGLFormats.h" #include "WebGLFormats.h"
#include "gfxPrefs.h"
#include "GLContext.h" #include "GLContext.h"
#include "GLDefs.h" #include "GLDefs.h"
#include "mozilla/gfx/Logging.h" #include "mozilla/gfx/Logging.h"

Просмотреть файл

@ -5,7 +5,6 @@
#include "WebGLQuery.h" #include "WebGLQuery.h"
#include "gfxPrefs.h"
#include "GLContext.h" #include "GLContext.h"
#include "mozilla/dom/WebGL2RenderingContextBinding.h" #include "mozilla/dom/WebGL2RenderingContextBinding.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "mozilla/dom/HTMLCanvasElement.h" #include "mozilla/dom/HTMLCanvasElement.h"
#include "gfxPrefs.h"
#include "ImageEncoder.h" #include "ImageEncoder.h"
#include "jsapi.h" #include "jsapi.h"
#include "jsfriendapi.h" #include "jsfriendapi.h"

Просмотреть файл

@ -8,7 +8,6 @@
#include "BrowserChild.h" #include "BrowserChild.h"
#include "gfxPrefs.h"
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
# include "mozilla/a11y/DocAccessibleChild.h" # include "mozilla/a11y/DocAccessibleChild.h"
#endif #endif

Просмотреть файл

@ -95,7 +95,6 @@
#include "nsIAuthPromptCallback.h" #include "nsIAuthPromptCallback.h"
#include "nsAuthInformationHolder.h" #include "nsAuthInformationHolder.h"
#include "nsICancelable.h" #include "nsICancelable.h"
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "nsILoginManagerPrompter.h" #include "nsILoginManagerPrompter.h"
#include "nsPIWindowRoot.h" #include "nsPIWindowRoot.h"

Просмотреть файл

@ -206,7 +206,6 @@
#include "mozilla/net/NeckoMessageUtils.h" #include "mozilla/net/NeckoMessageUtils.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPlatformFontList.h" #include "gfxPlatformFontList.h"
#include "gfxPrefs.h"
#include "prio.h" #include "prio.h"
#include "private/pprio.h" #include "private/pprio.h"
#include "ContentProcessManager.h" #include "ContentProcessManager.h"

Просмотреть файл

@ -18,7 +18,6 @@
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include "CubebUtils.h" #include "CubebUtils.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "gfxPrefs.h"
#include "AudioConverter.h" #include "AudioConverter.h"
#if defined(XP_WIN) #if defined(XP_WIN)
# include "nsXULAppAPI.h" # include "nsXULAppAPI.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "PDMFactory.h" #include "PDMFactory.h"
#include "VideoUtils.h" #include "VideoUtils.h"
#include "WebMDemuxer.h" #include "WebMDemuxer.h"
#include "gfxPrefs.h"
#include "mozilla/AbstractThread.h" #include "mozilla/AbstractThread.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/SharedThreadPool.h" #include "mozilla/SharedThreadPool.h"
@ -168,7 +167,6 @@ void Benchmark::Dispose() {
void Benchmark::Init() { void Benchmark::Init() {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
gfxVars::Initialize(); gfxVars::Initialize();
gfxPrefs::GetSingleton();
} }
BenchmarkPlayback::BenchmarkPlayback(Benchmark* aGlobalState, BenchmarkPlayback::BenchmarkPlayback(Benchmark* aGlobalState,

Просмотреть файл

@ -6,7 +6,6 @@
#include "mozilla/TaskQueue.h" #include "mozilla/TaskQueue.h"
#include "gfxPrefs.h"
#include "MediaSystemResourceManagerChild.h" #include "MediaSystemResourceManagerChild.h"
#include "mozilla/layers/ImageBridgeChild.h" #include "mozilla/layers/ImageBridgeChild.h"

Просмотреть файл

@ -35,7 +35,6 @@
#include "ImageContainer.h" #include "ImageContainer.h"
#include "GLContext.h" #include "GLContext.h"
#include "GLContextProvider.h" #include "GLContextProvider.h"
#include "gfxPrefs.h"
#include "LayersLogging.h" #include "LayersLogging.h"
#include "mozilla/layers/TextureWrapperImage.h" #include "mozilla/layers/TextureWrapperImage.h"
#include "mozilla/layers/TextureClientRecycleAllocator.h" #include "mozilla/layers/TextureClientRecycleAllocator.h"

Просмотреть файл

@ -20,7 +20,7 @@ class FeatureFailure;
// Manages the history and state of a graphics feature. The flow of a feature // Manages the history and state of a graphics feature. The flow of a feature
// is: // is:
// - A default value, set by all.js, gfxPrefs, or gfxPlatform. // - A default value, set by all.js, or gfxPlatform.
// - A user value, set by an external value or user pref. // - A user value, set by an external value or user pref.
// - An environment value, determined by system/hardware factors or // - An environment value, determined by system/hardware factors or
// nsIGfxInfo. // nsIGfxInfo.

Просмотреть файл

@ -56,7 +56,7 @@ class gfxVarReceiver;
// Some graphics settings are computed on the UI process and must be // Some graphics settings are computed on the UI process and must be
// communicated to content and GPU processes. gfxVars helps facilitate // communicated to content and GPU processes. gfxVars helps facilitate
// this. Its function is similar to gfxPrefs, except rather than hold // this. Its function is similar to StaticPrefs, except rather than hold
// user preferences, it holds dynamically computed values. // user preferences, it holds dynamically computed values.
// //
// Each variable in GFX_VARS_LIST exposes the following static methods: // Each variable in GFX_VARS_LIST exposes the following static methods:

Просмотреть файл

@ -7,7 +7,6 @@
#include "GLContextEAGL.h" #include "GLContextEAGL.h"
#include "nsDebug.h" #include "nsDebug.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "gfxPrefs.h"
#include "gfxFailure.h" #include "gfxFailure.h"
#include "prenv.h" #include "prenv.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"

Просмотреть файл

@ -9,7 +9,6 @@
#include "nsDebug.h" #include "nsDebug.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "gfxWindowsSurface.h" #include "gfxWindowsSurface.h"
#include "gfxCrashReporterUtils.h" #include "gfxCrashReporterUtils.h"

Просмотреть файл

@ -30,7 +30,6 @@
#include "prsystem.h" #include "prsystem.h"
#include "GLContext.h" #include "GLContext.h"
#include "GLContextProvider.h" #include "GLContextProvider.h"
#include "gfxPrefs.h"
#include "ScopedGLHelpers.h" #include "ScopedGLHelpers.h"
#ifdef MOZ_WIDGET_GTK #ifdef MOZ_WIDGET_GTK
# include <gdk/gdk.h> # include <gdk/gdk.h>
@ -86,7 +85,6 @@ PRLibrary* LoadApitraceLibrary() {
if (!path) return nullptr; if (!path) return nullptr;
// Initialization of gfx prefs here is only needed during the unit tests... // Initialization of gfx prefs here is only needed during the unit tests...
gfxPrefs::GetSingleton();
if (!StaticPrefs::UseApitrace()) { if (!StaticPrefs::UseApitrace()) {
return nullptr; return nullptr;
} }

Просмотреть файл

@ -7,7 +7,6 @@
#include <d3d11.h> #include <d3d11.h>
#include <d3d11_1.h> #include <d3d11_1.h>
#include "gfxPrefs.h"
#include "GLContext.h" #include "GLContext.h"
#include "WGLLibrary.h" #include "WGLLibrary.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"

Просмотреть файл

@ -10,7 +10,6 @@
#include "gfxConfig.h" #include "gfxConfig.h"
#include "gfxCrashReporterUtils.h" #include "gfxCrashReporterUtils.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "GLContextProvider.h" #include "GLContextProvider.h"
#include "GPUProcessHost.h" #include "GPUProcessHost.h"
#include "GPUProcessManager.h" #include "GPUProcessManager.h"
@ -110,8 +109,6 @@ bool GPUParent::Init(base::ProcessId aParentPid, const char* aParentBuildID,
// Init crash reporter support. // Init crash reporter support.
CrashReporterClient::InitSingleton(this); CrashReporterClient::InitSingleton(this);
// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
gfxConfig::Init(); gfxConfig::Init();
gfxVars::Initialize(); gfxVars::Initialize();
gfxPlatform::InitNullMetadata(); gfxPlatform::InitNullMetadata();
@ -552,7 +549,6 @@ void GPUParent::ActorDestroy(ActorDestroyReason aWhy) {
LayerTreeOwnerTracker::Shutdown(); LayerTreeOwnerTracker::Shutdown();
gfxVars::Shutdown(); gfxVars::Shutdown();
gfxConfig::Shutdown(); gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
CrashReporterClient::DestroySingleton(); CrashReporterClient::DestroySingleton();
XRE_ShutdownChildProcess(); XRE_ShutdownChildProcess();
} }

Просмотреть файл

@ -17,19 +17,6 @@ using mozilla::gfx::D3D11Checks::VideoFormatOptionSet from "mozilla/gfx/D3D11Che
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
union GfxPrefValue {
bool;
int32_t;
uint32_t;
float;
nsCString;
};
struct GfxPrefSetting {
int32_t index;
GfxPrefValue value;
};
struct D3D11DeviceStatus struct D3D11DeviceStatus
{ {
bool isWARP; bool isWARP;

Просмотреть файл

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FrameMetrics.h" #include "FrameMetrics.h"
#include "gfxPrefs.h"
#include "nsStyleConsts.h" #include "nsStyleConsts.h"
#include "nsStyleStruct.h" #include "nsStyleStruct.h"
#include "mozilla/WritingModes.h" #include "mozilla/WritingModes.h"

Просмотреть файл

@ -987,7 +987,7 @@ struct ScrollMetadata {
mIsAutoDirRootContentRTL = aValue; mIsAutoDirRootContentRTL = aValue;
} }
bool IsAutoDirRootContentRTL() const { return mIsAutoDirRootContentRTL; } bool IsAutoDirRootContentRTL() const { return mIsAutoDirRootContentRTL; }
// Implemented out of line because the implementation needs gfxPrefs.h // Implemented out of line because the implementation needs StaticPrefs.h
// and we don't want to include that from FrameMetrics.h. // and we don't want to include that from FrameMetrics.h.
void SetUsesContainerScrolling(bool aValue); void SetUsesContainerScrolling(bool aValue);
bool UsesContainerScrolling() const { return mUsesContainerScrolling; } bool UsesContainerScrolling() const { return mUsesContainerScrolling; }

Просмотреть файл

@ -21,7 +21,7 @@
#include "gfxContext.h" #include "gfxContext.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "gfxPrefs.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "GLContext.h" #include "GLContext.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "mozilla/layers/APZInputBridge.h" #include "mozilla/layers/APZInputBridge.h"
#include "gfxPrefs.h" // for gfxPrefs
#include "InputData.h" // for MouseInput, etc #include "InputData.h" // for MouseInput, etc
#include "mozilla/dom/WheelEventBinding.h" // for WheelEvent constants #include "mozilla/dom/WheelEventBinding.h" // for WheelEvent constants
#include "mozilla/EventStateManager.h" // for EventStateManager #include "mozilla/EventStateManager.h" // for EventStateManager

Просмотреть файл

@ -11,7 +11,6 @@
#include "AsyncPanZoomController.h" #include "AsyncPanZoomController.h"
#include "GeneratedJNIWrappers.h" #include "GeneratedJNIWrappers.h"
#include "GenericFlingAnimation.h" #include "GenericFlingAnimation.h"
#include "gfxPrefs.h"
#include "OverscrollHandoffState.h" #include "OverscrollHandoffState.h"
#include "SimpleVelocityTracker.h" #include "SimpleVelocityTracker.h"
#include "ViewConfiguration.h" #include "ViewConfiguration.h"

Просмотреть файл

@ -9,7 +9,6 @@
#include "AsyncPanZoomController.h" #include "AsyncPanZoomController.h"
#include "Units.h" #include "Units.h"
#include "gfxPrefs.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
namespace mozilla { namespace mozilla {

Просмотреть файл

@ -23,7 +23,6 @@
#include "nsPrintfCString.h" // for nsPrintfCString #include "nsPrintfCString.h" // for nsPrintfCString
#include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc #include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc
#include "nscore.h" // for NS_IMETHOD #include "nscore.h" // for NS_IMETHOD
#include "gfxPrefs.h" // for the preferences
#define AXIS_LOG(...) #define AXIS_LOG(...)
// #define AXIS_LOG(...) printf_stderr("AXIS: " __VA_ARGS__) // #define AXIS_LOG(...) printf_stderr("AXIS: " __VA_ARGS__)

Просмотреть файл

@ -9,7 +9,6 @@
#include "AsyncPanZoomController.h" #include "AsyncPanZoomController.h"
#include "Units.h" #include "Units.h"
#include "gfxPrefs.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#define FLING_PHYS_LOG(...) #define FLING_PHYS_LOG(...)

Просмотреть файл

@ -15,7 +15,6 @@
#include "LayersLogging.h" #include "LayersLogging.h"
#include "Units.h" #include "Units.h"
#include "OverscrollHandoffState.h" #include "OverscrollHandoffState.h"
#include "gfxPrefs.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Monitor.h" #include "mozilla/Monitor.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"

Просмотреть файл

@ -8,7 +8,6 @@
#include "AsyncPanZoomController.h" #include "AsyncPanZoomController.h"
#include "FrameMetrics.h" #include "FrameMetrics.h"
#include "gfxPrefs.h"
#include "nsPoint.h" #include "nsPoint.h"
#include "ScrollAnimationPhysics.h" #include "ScrollAnimationPhysics.h"
#include "ScrollAnimationBezierPhysics.h" #include "ScrollAnimationBezierPhysics.h"

Просмотреть файл

@ -10,7 +10,6 @@
#include "AsyncPanZoomController.h" // for AsyncPanZoomController #include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "InputBlockState.h" // for TouchBlockState #include "InputBlockState.h" // for TouchBlockState
#include "base/task.h" // for CancelableTask, etc #include "base/task.h" // for CancelableTask, etc
#include "gfxPrefs.h" // for gfxPrefs
#include "InputBlockState.h" // for TouchBlockState #include "InputBlockState.h" // for TouchBlockState
#include "mozilla/StaticPrefs.h" // for StaticPrefs #include "mozilla/StaticPrefs.h" // for StaticPrefs
#include "nsDebug.h" // for NS_WARNING #include "nsDebug.h" // for NS_WARNING

Просмотреть файл

@ -5,7 +5,6 @@
#include "HitTestingTreeNode.h" #include "HitTestingTreeNode.h"
#include "AsyncPanZoomController.h" // for AsyncPanZoomController #include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "gfxPrefs.h"
#include "LayersLogging.h" // for Stringify #include "LayersLogging.h" // for Stringify
#include "mozilla/gfx/Point.h" // for Point4D #include "mozilla/gfx/Point.h" // for Point4D
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform #include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform

Просмотреть файл

@ -9,7 +9,7 @@
#include "APZUtils.h" #include "APZUtils.h"
#include "AsyncPanZoomController.h" // for AsyncPanZoomController #include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "ScrollAnimationPhysics.h" // for kScrollSeriesTimeoutMs #include "ScrollAnimationPhysics.h" // for kScrollSeriesTimeoutMs
#include "gfxPrefs.h" // for gfxPrefs
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "mozilla/Telemetry.h" // for Telemetry #include "mozilla/Telemetry.h" // for Telemetry
#include "mozilla/layers/IAPZCTreeManager.h" // for AllowedTouchBehavior #include "mozilla/layers/IAPZCTreeManager.h" // for AllowedTouchBehavior

Просмотреть файл

@ -7,7 +7,7 @@
#include "InputQueue.h" #include "InputQueue.h"
#include "AsyncPanZoomController.h" #include "AsyncPanZoomController.h"
#include "gfxPrefs.h"
#include "InputBlockState.h" #include "InputBlockState.h"
#include "LayersLogging.h" #include "LayersLogging.h"
#include "mozilla/layers/APZThreadUtils.h" #include "mozilla/layers/APZThreadUtils.h"

Просмотреть файл

@ -7,8 +7,6 @@
#include "KeyboardScrollAnimation.h" #include "KeyboardScrollAnimation.h"
#include "ScrollAnimationBezierPhysics.h" #include "ScrollAnimationBezierPhysics.h"
#include "gfxPrefs.h"
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {

Просмотреть файл

@ -12,7 +12,7 @@
*/ */
#include "APZTestCommon.h" #include "APZTestCommon.h"
#include "gfxPrefs.h"
#include "mozilla/layers/APZSampler.h" #include "mozilla/layers/APZSampler.h"
#include "mozilla/layers/APZUpdater.h" #include "mozilla/layers/APZUpdater.h"
@ -25,7 +25,6 @@ class APZCBasicTester : public APZCTesterBase {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
gfxPrefs::GetSingleton();
APZThreadUtils::SetThreadAssertionsEnabled(false); APZThreadUtils::SetThreadAssertionsEnabled(false);
APZThreadUtils::SetControllerThread(MessageLoop::current()); APZThreadUtils::SetControllerThread(MessageLoop::current());

Просмотреть файл

@ -14,14 +14,13 @@
#include "APZTestCommon.h" #include "APZTestCommon.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "mozilla/layers/APZSampler.h" #include "mozilla/layers/APZSampler.h"
#include "mozilla/layers/APZUpdater.h" #include "mozilla/layers/APZUpdater.h"
class APZCTreeManagerTester : public APZCTesterBase { class APZCTreeManagerTester : public APZCTesterBase {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
gfxPrefs::GetSingleton();
gfxPlatform::GetPlatform(); gfxPlatform::GetPlatform();
APZThreadUtils::SetThreadAssertionsEnabled(false); APZThreadUtils::SetThreadAssertionsEnabled(false);
APZThreadUtils::SetControllerThread(MessageLoop::current()); APZThreadUtils::SetControllerThread(MessageLoop::current());

Просмотреть файл

@ -13,7 +13,6 @@
*/ */
#include "APZTestCommon.h" #include "APZTestCommon.h"
#include "gfxPrefs.h"
/* The InputReceiver template parameter used in the helper functions below needs /* The InputReceiver template parameter used in the helper functions below needs
* to be a class that implements functions with the signatures: * to be a class that implements functions with the signatures:

Просмотреть файл

@ -6,7 +6,7 @@
#include "APZCBasicTester.h" #include "APZCBasicTester.h"
#include "APZTestCommon.h" #include "APZTestCommon.h"
#include "gfxPrefs.h"
#include "InputUtils.h" #include "InputUtils.h"
TEST_F(APZCBasicTester, Overzoom) { TEST_F(APZCBasicTester, Overzoom) {

Просмотреть файл

@ -6,7 +6,7 @@
#include "APZCTreeManagerTester.h" #include "APZCTreeManagerTester.h"
#include "APZTestCommon.h" #include "APZTestCommon.h"
#include "gfxPrefs.h"
#include "InputUtils.h" #include "InputUtils.h"
class APZHitTestingTester : public APZCTreeManagerTester { class APZHitTestingTester : public APZCTreeManagerTester {

Просмотреть файл

@ -6,7 +6,7 @@
#include "APZCTreeManagerTester.h" #include "APZCTreeManagerTester.h"
#include "APZTestCommon.h" #include "APZTestCommon.h"
#include "gfxPrefs.h"
#include "InputUtils.h" #include "InputUtils.h"
#include "mozilla/StaticPrefs.h" #include "mozilla/StaticPrefs.h"

Просмотреть файл

@ -8,7 +8,7 @@
#include "TouchActionHelper.h" #include "TouchActionHelper.h"
#include "gfxPlatform.h" // For gfxPlatform::UseTiling #include "gfxPlatform.h" // For gfxPlatform::UseTiling
#include "gfxPrefs.h"
#include "LayersLogging.h" // For Stringify #include "LayersLogging.h" // For Stringify
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/MouseEventBinding.h"

Просмотреть файл

@ -8,7 +8,7 @@
#include "ActiveElementManager.h" #include "ActiveElementManager.h"
#include "APZCCallbackHelper.h" #include "APZCCallbackHelper.h"
#include "gfxPrefs.h"
#include "LayersLogging.h" #include "LayersLogging.h"
#include "mozilla/BasicEvents.h" #include "mozilla/BasicEvents.h"
#include "mozilla/dom/MouseEventBinding.h" #include "mozilla/dom/MouseEventBinding.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "CheckerboardReportService.h" #include "CheckerboardReportService.h"
#include "gfxPrefs.h" // for gfxPrefs
#include "jsapi.h" // for JS_Now #include "jsapi.h" // for JS_Now
#include "MainThreadUtils.h" // for NS_IsMainThread #include "MainThreadUtils.h" // for NS_IsMainThread
#include "mozilla/Assertions.h" // for MOZ_ASSERT #include "mozilla/Assertions.h" // for MOZ_ASSERT

Просмотреть файл

@ -24,7 +24,6 @@
#include "YCbCrUtils.h" #include "YCbCrUtils.h"
#include <algorithm> #include <algorithm>
#include "ImageContainer.h" #include "ImageContainer.h"
#include "gfxPrefs.h"
namespace mozilla { namespace mozilla {
using namespace mozilla::gfx; using namespace mozilla::gfx;

Просмотреть файл

@ -23,7 +23,7 @@
#include "gfxImageSurface.h" // for gfxImageSurface #include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxMatrix.h" // for gfxMatrix #include "gfxMatrix.h" // for gfxMatrix
#include "gfxPlatform.h" // for gfxPlatform #include "gfxPlatform.h" // for gfxPlatform
#include "gfxPrefs.h" // for gfxPrefs
#include "gfxPoint.h" // for IntSize, gfxPoint #include "gfxPoint.h" // for IntSize, gfxPoint
#include "gfxRect.h" // for gfxRect #include "gfxRect.h" // for gfxRect
#include "gfxUtils.h" // for gfxUtils #include "gfxUtils.h" // for gfxUtils

Просмотреть файл

@ -13,7 +13,7 @@
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "gfxEnv.h" // for gfxEnv #include "gfxEnv.h" // for gfxEnv
#include "gfxRect.h" // for gfxRect #include "gfxRect.h" // for gfxRect
#include "gfxPrefs.h" // for gfxPrefs
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/2D.h" // for DrawTarget
#include "mozilla/gfx/DrawEventRecorder.h" #include "mozilla/gfx/DrawEventRecorder.h"

Просмотреть файл

@ -9,7 +9,7 @@
#include "gfxContext.h" // for gfxContext, etc #include "gfxContext.h" // for gfxContext, etc
#include "gfxPlatform.h" // for gfxPlatform #include "gfxPlatform.h" // for gfxPlatform
#include "gfxEnv.h" // for gfxEnv #include "gfxEnv.h" // for gfxEnv
#include "gfxPrefs.h" // for gfxPrefs
#include "gfxPoint.h" // for IntSize, gfxPoint #include "gfxPoint.h" // for IntSize, gfxPoint
#include "gfxUtils.h" // for gfxUtils #include "gfxUtils.h" // for gfxUtils
#include "ipc/ShadowLayers.h" // for ShadowLayerForwarder #include "ipc/ShadowLayers.h" // for ShadowLayerForwarder

Просмотреть файл

@ -25,7 +25,7 @@
#include "UnitTransforms.h" // for ViewAs #include "UnitTransforms.h" // for ViewAs
#include "apz/src/AsyncPanZoomController.h" // for AsyncPanZoomController #include "apz/src/AsyncPanZoomController.h" // for AsyncPanZoomController
#include "gfxEnv.h" // for gfxEnv #include "gfxEnv.h" // for gfxEnv
#include "gfxPrefs.h" // for gfxPrefs
#ifdef XP_MACOSX #ifdef XP_MACOSX
# include "gfxPlatformMac.h" # include "gfxPlatformMac.h"
#endif #endif

Просмотреть файл

@ -36,7 +36,7 @@
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include <limits> #include <limits>
#include "../opengl/CompositorOGL.h" #include "../opengl/CompositorOGL.h"
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "IPDLActor.h" #include "IPDLActor.h"

Просмотреть файл

@ -30,7 +30,6 @@
#include "mozilla/StaticPrefs.h" // for StaticPrefs #include "mozilla/StaticPrefs.h" // for StaticPrefs
#include "mozilla/dom/BrowserParent.h" #include "mozilla/dom/BrowserParent.h"
#include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/2D.h" // for DrawTarget
#include "mozilla/gfx/GPUChild.h" // for GfxPrefValue
#include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/Rect.h" // for IntSize #include "mozilla/gfx/Rect.h" // for IntSize
#include "mozilla/gfx/gfxVars.h" // for gfxVars #include "mozilla/gfx/gfxVars.h" // for gfxVars

Просмотреть файл

@ -6,7 +6,6 @@
#include "ISurfaceAllocator.h" #include "ISurfaceAllocator.h"
#include "gfxPrefs.h"
#include "mozilla/layers/ImageBridgeParent.h" // for ImageBridgeParent #include "mozilla/layers/ImageBridgeParent.h" // for ImageBridgeParent
#include "mozilla/layers/TextureHost.h" // for TextureHost #include "mozilla/layers/TextureHost.h" // for TextureHost
#include "mozilla/layers/TextureForwarder.h" #include "mozilla/layers/TextureForwarder.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "RenderTrace.h" // for RenderTraceScope #include "RenderTrace.h" // for RenderTraceScope
#include "gfx2DGlue.h" // for Moz2D transition helpers #include "gfx2DGlue.h" // for Moz2D transition helpers
#include "gfxPlatform.h" // for gfxImageFormat, gfxPlatform #include "gfxPlatform.h" // for gfxImageFormat, gfxPlatform
#include "gfxPrefs.h"
//#include "gfxSharedImageSurface.h" // for gfxSharedImageSurface //#include "gfxSharedImageSurface.h" // for gfxSharedImageSurface
#include "ipc/IPCMessageUtils.h" // for gfxContentType, null_t #include "ipc/IPCMessageUtils.h" // for gfxContentType, null_t
#include "IPDLActor.h" #include "IPDLActor.h"

Просмотреть файл

@ -7,7 +7,7 @@
#include "WebRenderLayerManager.h" #include "WebRenderLayerManager.h"
#include "BasicLayers.h" #include "BasicLayers.h"
#include "gfxPrefs.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#include "LayersLogging.h" #include "LayersLogging.h"
#include "mozilla/dom/BrowserChild.h" #include "mozilla/dom/BrowserChild.h"

Просмотреть файл

@ -3,7 +3,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/ * http://creativecommons.org/publicdomain/zero/1.0/
*/ */
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "TestLayers.h" #include "TestLayers.h"

Просмотреть файл

@ -1,86 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gtest/gtest.h"
#include "gfxPrefs.h"
#ifdef GFX_DECL_PREF
# error "This is not supposed to be defined outside of gfxPrefs.h"
#endif
// If the default values for any of these preferences change,
// just modify the test to match. We are only testing against
// a particular value to make sure we receive the correct
// result through this API.
TEST(GfxPrefs, Singleton)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
}
TEST(GfxPrefs, OnceValues)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
// Once boolean, default true
ASSERT_TRUE(StaticPrefs::WorkAroundDriverBugs());
// Once boolean, default false
ASSERT_FALSE(StaticPrefs::UseApitrace());
// Once uint32_t, default 5
ASSERT_TRUE(StaticPrefs::APZMaxVelocityQueueSize() == 5);
// Once float, default 0 (should be OK with ==)
ASSERT_TRUE(StaticPrefs::APZCurveFunctionX1() == 0.0f);
}
TEST(GfxPrefs, Set)
{
gfxPrefs::GetSingleton();
ASSERT_TRUE(gfxPrefs::SingletonExists());
// Once boolean, default false
ASSERT_FALSE(StaticPrefs::UseApitrace());
StaticPrefs::SetUseApitrace(true);
ASSERT_TRUE(StaticPrefs::UseApitrace());
StaticPrefs::SetUseApitrace(false);
ASSERT_FALSE(StaticPrefs::UseApitrace());
// Once float, default 0
ASSERT_TRUE(StaticPrefs::APZCurveFunctionX1() == 0.0f);
StaticPrefs::SetAPZCurveFunctionX1(1.75f);
ASSERT_TRUE(StaticPrefs::APZCurveFunctionX1() == 1.75f);
StaticPrefs::SetAPZCurveFunctionX1(0.0f);
ASSERT_TRUE(StaticPrefs::APZCurveFunctionX1() == 0.0f);
}
// Randomly test the function we use in nsExceptionHandler.cpp here:
extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
TEST(GfxPrefs, StringUtility)
{
char testBuffer[64];
double testVal[] = {
13.4,
3324243.42,
0.332424342,
864.0,
86400 * 100000000.0 * 10000000000.0 * 10000000000.0 * 100.0,
86400.0 * 366.0 * 100.0 + 14243.44332};
for (size_t i = 0; i < mozilla::ArrayLength(testVal); i++) {
ASSERT_TRUE(SimpleNoCLibDtoA(testVal[i], testBuffer, sizeof(testBuffer)));
ASSERT_TRUE(fabs(1.0 - atof(testBuffer) / testVal[i]) < 0.0001);
}
// We do not like negative numbers (random limitation)
ASSERT_FALSE(SimpleNoCLibDtoA(-864.0, testBuffer, sizeof(testBuffer)));
// It won't fit into 32:
ASSERT_FALSE(
SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer) / 2));
}

Просмотреть файл

@ -22,6 +22,7 @@ using mozilla::gfx::gfxConfig;
using mozilla::layers::BasicCompositor; using mozilla::layers::BasicCompositor;
using mozilla::layers::Compositor; using mozilla::layers::Compositor;
using mozilla::layers::CompositorOptions; using mozilla::layers::CompositorOptions;
using mozilla::layers::ISurfaceAllocator;
using mozilla::layers::LayersBackend; using mozilla::layers::LayersBackend;
using mozilla::layers::TestSurfaceAllocator; using mozilla::layers::TestSurfaceAllocator;
using mozilla::layers::TextureClient; using mozilla::layers::TextureClient;

Просмотреть файл

@ -6,7 +6,7 @@
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "MainThreadUtils.h" #include "MainThreadUtils.h"
#include "nsIThread.h" #include "nsIThread.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
@ -70,7 +70,6 @@ class VsyncTester : public ::testing::Test {
protected: protected:
explicit VsyncTester() { explicit VsyncTester() {
gfxPlatform::GetPlatform(); gfxPlatform::GetPlatform();
gfxPrefs::GetSingleton();
mVsyncSource = gfxPlatform::GetPlatform()->GetHardwareVsync(); mVsyncSource = gfxPlatform::GetPlatform()->GetHardwareVsync();
MOZ_RELEASE_ASSERT(mVsyncSource, "GFX: Vsync source not found."); MOZ_RELEASE_ASSERT(mVsyncSource, "GFX: Vsync source not found.");
} }

Просмотреть файл

@ -35,7 +35,6 @@ if not(CONFIG['OS_TARGET'] == 'WINNT' and CONFIG['CPU_ARCH'] == 'aarch64'):
if CONFIG['OS_TARGET'] != 'Android': if CONFIG['OS_TARGET'] != 'Android':
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'TestCompositor.cpp', 'TestCompositor.cpp',
'TestGfxPrefs.cpp',
'TestRect.cpp', 'TestRect.cpp',
'TestTextureCompatibility.cpp', 'TestTextureCompatibility.cpp',
] ]

Просмотреть файл

@ -24,7 +24,7 @@ class WrPrefRolloutWorkAroundTestCase(MarionetteTestCase):
''' '''
def test_wr_rollout_workaround_on_non_qualifying_hw(self): def test_wr_rollout_workaround_on_non_qualifying_hw(self):
# Override the gfxPref so that WR is not enabled, as it would be before a rollout. # Override the StaticPrefs so that WR is not enabled, as it would be before a rollout.
self.marionette.set_pref(pref=gfx_rollout_override, value=False) self.marionette.set_pref(pref=gfx_rollout_override, value=False)
# Set HW override so we behave as if we on non-qualifying hardware. # Set HW override so we behave as if we on non-qualifying hardware.
self.marionette.set_pref(pref=hw_qualified_override, value=False) self.marionette.set_pref(pref=hw_qualified_override, value=False)

Просмотреть файл

@ -17,7 +17,7 @@
#include "gfxASurface.h" #include "gfxASurface.h"
#include "gfxPattern.h" #include "gfxPattern.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "mozilla/gfx/PathHelpers.h" #include "mozilla/gfx/PathHelpers.h"

Просмотреть файл

@ -755,7 +755,7 @@ void gfxMacFontFamily::LocalizedName(nsACString& aLocalizedName) {
// It's unsafe to call HasOtherFamilyNames off the main thread because // It's unsafe to call HasOtherFamilyNames off the main thread because
// it entrains FindStyleVariations, which calls GetWeightOverride, which // it entrains FindStyleVariations, which calls GetWeightOverride, which
// retrieves prefs. And the pref names can change (via user overrides), // retrieves prefs. And the pref names can change (via user overrides),
// so we can't use gfxPrefs to access them. // so we can't use StaticPrefs to access them.
if (NS_IsMainThread() && !HasOtherFamilyNames()) { if (NS_IsMainThread() && !HasOtherFamilyNames()) {
aLocalizedName = mName; aLocalizedName = mName;
return; return;

Просмотреть файл

@ -32,7 +32,7 @@
#include "gfxCrashReporterUtils.h" #include "gfxCrashReporterUtils.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "gfxEnv.h" #include "gfxEnv.h"
#include "gfxTextRun.h" #include "gfxTextRun.h"
#include "gfxUserFontSet.h" #include "gfxUserFontSet.h"
@ -845,8 +845,6 @@ void gfxPlatform::Init() {
} }
gEverInitialized = true; gEverInitialized = true;
// Initialize the preferences by creating the singleton.
gfxPrefs::GetSingleton();
gfxVars::Initialize(); gfxVars::Initialize();
gfxConfig::Init(); gfxConfig::Init();
@ -1243,7 +1241,6 @@ void gfxPlatform::Shutdown() {
delete gGfxPlatformPrefsLock; delete gGfxPlatformPrefsLock;
gfxVars::Shutdown(); gfxVars::Shutdown();
gfxPrefs::DestroySingleton();
gfxFont::DestroySingletons(); gfxFont::DestroySingletons();
gfxConfig::Shutdown(); gfxConfig::Shutdown();
@ -2358,8 +2355,6 @@ void gfxPlatform::InitAcceleration() {
// explicit. // explicit.
MOZ_ASSERT(NS_IsMainThread(), "can only initialize prefs on the main thread"); MOZ_ASSERT(NS_IsMainThread(), "can only initialize prefs on the main thread");
gfxPrefs::GetSingleton();
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo(); nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString discardFailureId; nsCString discardFailureId;
int32_t status; int32_t status;
@ -3249,11 +3244,6 @@ bool gfxPlatform::AsyncPanZoomEnabled() {
#ifdef MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_ANDROID
return true; return true;
#else #else
if (!gfxPrefs::SingletonExists()) {
// Make sure the gfxPrefs has been initialized before reading from it.
MOZ_ASSERT(NS_IsMainThread());
gfxPrefs::GetSingleton();
}
return StaticPrefs::AsyncPanZoomEnabledDoNotUseDirectly(); return StaticPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
#endif #endif
} }

Просмотреть файл

@ -1,277 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxPrefs.h"
#include "MainThreadUtils.h"
#include "nsXULAppAPI.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/gfx/GPUChild.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "VRProcessManager.h"
#include "VRChild.h"
using namespace mozilla;
nsTArray<gfxPrefs::Pref*>* gfxPrefs::sGfxPrefList = nullptr;
gfxPrefs* gfxPrefs::sInstance = nullptr;
bool gfxPrefs::sInstanceHasBeenDestroyed = false;
gfxPrefs& gfxPrefs::CreateAndInitializeSingleton() {
MOZ_ASSERT(!sInstanceHasBeenDestroyed,
"Should never recreate a gfxPrefs instance!");
sGfxPrefList = new nsTArray<Pref*>();
sInstance = new gfxPrefs;
sInstance->Init();
MOZ_ASSERT(SingletonExists());
return *sInstance;
}
void gfxPrefs::DestroySingleton() {
if (sInstance) {
delete sInstance;
sInstance = nullptr;
sInstanceHasBeenDestroyed = true;
}
MOZ_ASSERT(!SingletonExists());
}
bool gfxPrefs::SingletonExists() { return sInstance != nullptr; }
gfxPrefs::gfxPrefs() {
// UI, content, and plugin processes use XPCOM and should have prefs
// ready by the time we initialize gfxPrefs.
MOZ_ASSERT_IF(XRE_IsContentProcess() || XRE_IsParentProcess() ||
XRE_GetProcessType() == GeckoProcessType_Plugin,
Preferences::IsServiceAvailable());
gfxPrefs::AssertMainThread();
}
void gfxPrefs::Init() {
}
gfxPrefs::~gfxPrefs() {
gfxPrefs::AssertMainThread();
delete sGfxPrefList;
sGfxPrefList = nullptr;
}
void gfxPrefs::AssertMainThread() {
MOZ_ASSERT(NS_IsMainThread(), "this code must be run on the main thread");
}
void gfxPrefs::Pref::OnChange() {
FireChangeCallback();
}
void gfxPrefs::Pref::FireChangeCallback() {
if (mChangeCallback) {
GfxPrefValue value;
GetLiveValue(&value);
mChangeCallback(value);
}
}
void gfxPrefs::Pref::SetChangeCallback(ChangeCallback aCallback) {
mChangeCallback = aCallback;
if (!IsParentProcess() && IsPrefsServiceAvailable()) {
// If we're in the parent process, we watch prefs by default so we can
// send changes over to the GPU process. Otherwise, we need to add or
// remove a watch for the pref now.
if (aCallback) {
WatchChanges(Name(), this);
} else {
UnwatchChanges(Name(), this);
}
}
// Fire the callback once to make initialization easier for the caller.
FireChangeCallback();
}
// On lightweight processes such as for GMP and GPU, XPCOM is not initialized,
// and therefore we don't have access to Preferences. When XPCOM is not
// available we rely on manual synchronization of gfxPrefs values over IPC.
/* static */
bool gfxPrefs::IsPrefsServiceAvailable() {
return Preferences::IsServiceAvailable();
}
/* static */
bool gfxPrefs::IsParentProcess() { return XRE_IsParentProcess(); }
void gfxPrefs::PrefAddVarCache(bool* aVariable, const nsACString& aPref,
bool aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddBoolVarCache(aVariable, aPref, aDefault);
}
void gfxPrefs::PrefAddVarCache(int32_t* aVariable, const nsACString& aPref,
int32_t aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddIntVarCache(aVariable, aPref, aDefault);
}
void gfxPrefs::PrefAddVarCache(uint32_t* aVariable, const nsACString& aPref,
uint32_t aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddUintVarCache(aVariable, aPref, aDefault);
}
void gfxPrefs::PrefAddVarCache(float* aVariable, const nsACString& aPref,
float aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddFloatVarCache(aVariable, aPref, aDefault);
}
void gfxPrefs::PrefAddVarCache(std::string* aVariable, const nsCString& aPref,
std::string aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetCString(aPref.get(), aVariable->c_str());
}
void gfxPrefs::PrefAddVarCache(AtomicBool* aVariable, const nsACString& aPref,
bool aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddAtomicBoolVarCache(aVariable, aPref, aDefault);
}
void gfxPrefs::PrefAddVarCache(AtomicInt32* aVariable, const nsACString& aPref,
int32_t aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddAtomicIntVarCache(aVariable, aPref, aDefault);
}
void gfxPrefs::PrefAddVarCache(AtomicUint32* aVariable, const nsACString& aPref,
uint32_t aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::AddAtomicUintVarCache(aVariable, aPref, aDefault);
}
bool gfxPrefs::PrefGet(const char* aPref, bool aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
return Preferences::GetBool(aPref, aDefault);
}
int32_t gfxPrefs::PrefGet(const char* aPref, int32_t aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
return Preferences::GetInt(aPref, aDefault);
}
uint32_t gfxPrefs::PrefGet(const char* aPref, uint32_t aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
return Preferences::GetUint(aPref, aDefault);
}
float gfxPrefs::PrefGet(const char* aPref, float aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
return Preferences::GetFloat(aPref, aDefault);
}
std::string gfxPrefs::PrefGet(const char* aPref, std::string aDefault) {
MOZ_ASSERT(IsPrefsServiceAvailable());
nsAutoCString result;
Preferences::GetCString(aPref, result);
if (result.IsEmpty()) {
return aDefault;
}
return result.get();
}
void gfxPrefs::PrefSet(const char* aPref, bool aValue) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetBool(aPref, aValue);
}
void gfxPrefs::PrefSet(const char* aPref, int32_t aValue) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetInt(aPref, aValue);
}
void gfxPrefs::PrefSet(const char* aPref, uint32_t aValue) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetUint(aPref, aValue);
}
void gfxPrefs::PrefSet(const char* aPref, float aValue) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetFloat(aPref, aValue);
}
void gfxPrefs::PrefSet(const char* aPref, std::string aValue) {
MOZ_ASSERT(IsPrefsServiceAvailable());
Preferences::SetCString(aPref, aValue.c_str());
}
static void OnGfxPrefChanged(const char* aPrefname, gfxPrefs::Pref* aPref) {
aPref->OnChange();
}
void gfxPrefs::WatchChanges(const char* aPrefname, Pref* aPref) {
MOZ_ASSERT(IsPrefsServiceAvailable());
nsCString name;
name.AssignLiteral(aPrefname, strlen(aPrefname));
Preferences::RegisterCallback(OnGfxPrefChanged, name, aPref);
}
void gfxPrefs::UnwatchChanges(const char* aPrefname, Pref* aPref) {
// The Preferences service can go offline before gfxPrefs is destroyed.
if (IsPrefsServiceAvailable()) {
Preferences::UnregisterCallback(OnGfxPrefChanged,
nsDependentCString(aPrefname), aPref);
}
}
void gfxPrefs::CopyPrefValue(const bool* aValue, GfxPrefValue* aOutValue) {
*aOutValue = *aValue;
}
void gfxPrefs::CopyPrefValue(const int32_t* aValue, GfxPrefValue* aOutValue) {
*aOutValue = *aValue;
}
void gfxPrefs::CopyPrefValue(const uint32_t* aValue, GfxPrefValue* aOutValue) {
*aOutValue = *aValue;
}
void gfxPrefs::CopyPrefValue(const float* aValue, GfxPrefValue* aOutValue) {
*aOutValue = *aValue;
}
void gfxPrefs::CopyPrefValue(const std::string* aValue,
GfxPrefValue* aOutValue) {
*aOutValue = nsCString(aValue->c_str());
}
void gfxPrefs::CopyPrefValue(const GfxPrefValue* aValue, bool* aOutValue) {
*aOutValue = aValue->get_bool();
}
void gfxPrefs::CopyPrefValue(const GfxPrefValue* aValue, int32_t* aOutValue) {
*aOutValue = aValue->get_int32_t();
}
void gfxPrefs::CopyPrefValue(const GfxPrefValue* aValue, uint32_t* aOutValue) {
*aOutValue = aValue->get_uint32_t();
}
void gfxPrefs::CopyPrefValue(const GfxPrefValue* aValue, float* aOutValue) {
*aOutValue = aValue->get_float();
}
void gfxPrefs::CopyPrefValue(const GfxPrefValue* aValue,
std::string* aOutValue) {
*aOutValue = aValue->get_nsCString().get();
}
bool gfxPrefs::OverrideBase_WebRender() { return gfx::gfxVars::UseWebRender(); }

Просмотреть файл

@ -1,370 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFX_PREFS_H
#define GFX_PREFS_H
#include <cmath> // for M_PI
#include <stdint.h>
#include <string>
#include "mozilla/Assertions.h"
#include "mozilla/Atomics.h"
#include "mozilla/gfx/LoggingConstants.h"
#include "nsTArray.h"
#include "nsString.h"
// First time gfxPrefs::GetSingleton() needs to be called on the main thread,
// before any of the methods accessing the values are used, but after
// the Preferences system has been initialized.
// The static methods to access the preference value are safe to call
// from any thread after that first call.
// To register a preference, you need to add a line in this file using
// the DECL_GFX_PREF macro.
//
// Update argument controls whether we read the preference value and save it
// or connect with a callback. See UpdatePolicy enum below.
// Pref is the string with the preference name.
// Name argument is the name of the static function to create.
// Type is the type of the preference - bool, int32_t, uint32_t.
// Default is the default value for the preference.
//
// For example this line in the .h:
// DECL_GFX_PREF(Once,"layers.dump",LayersDump,bool,false);
// means that you can call
// bool var = gfxPrefs::LayersDump();
// from any thread, but that you will only get the preference value of
// "layers.dump" as it was set at the start of the session (subject to
// note 2 below). If the value was not set, the default would be false.
//
// In another example, this line in the .h:
// DECL_GFX_PREF(Live,"gl.msaa-level",MSAALevel,uint32_t,2);
// means that every time you call
// uint32_t var = gfxPrefs::MSAALevel();
// from any thread, you will get the most up to date preference value of
// "gl.msaa-level". If the value is not set, the default would be 2.
// Note 1: Changing a preference from Live to Once is now as simple
// as changing the Update argument. If your code worked before, it will
// keep working, and behave as if the user never changes the preference.
// Things are a bit more complicated and perhaps even dangerous when
// going from Once to Live, or indeed setting a preference to be Live
// in the first place, so be careful. You need to be ready for the
// values changing mid execution, and if you're using those preferences
// in any setup and initialization, you may need to do extra work.
// Note 2: Prefs can be set by using the corresponding Set method. For
// example, if the accessor is Foo() then calling SetFoo(...) will update
// the preference and also change the return value of subsequent Foo() calls.
// This is true even for 'Once' prefs which otherwise do not change if the
// pref is updated after initialization. Changing gfxPrefs values in content
// processes will not affect the result in other processes. Changing gfxPrefs
// values in the GPU process is not supported at all.
#define DECL_GFX_PREF(Update, Prefname, Name, Type, Default) \
public: \
static Type Name() { \
MOZ_ASSERT(SingletonExists()); \
return GetSingleton().mPref##Name.mValue; \
} \
static void Set##Name(Type aVal) { \
MOZ_ASSERT(SingletonExists()); \
GetSingleton().mPref##Name.Set(UpdatePolicy::Update, \
Get##Name##PrefName(), aVal); \
} \
static const char* Get##Name##PrefName() { return Prefname; } \
static Type Get##Name##PrefDefault() { return Default; } \
static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) { \
MOZ_ASSERT(SingletonExists()); \
GetSingleton().mPref##Name.SetChangeCallback(aCallback); \
} \
\
private: \
PrefTemplate<UpdatePolicy::Update, Type, Get##Name##PrefDefault, \
Get##Name##PrefName> \
mPref##Name
// This declares an "override" pref, which is exposed as a "bool" pref by the
// API, but is internally stored as a tri-state int pref with three possible
// values:
// - A value of 0 means that it has been force-disabled, and is exposed as a
// false-valued bool.
// - A value of 1 means that it has been force-enabled, and is exposed as a
// true-valued bool.
// - A value of 2 (the default) means that it returns the provided BaseValue
// as a boolean. The BaseValue may be a constant expression or a function.
// If the prefs defined with this macro are listed in prefs files (e.g. all.js),
// then they must be listed with an int value (default to 2, but you can use 0
// or 1 if you want to force it on or off).
#define DECL_OVERRIDE_PREF(Update, Prefname, Name, BaseValue) \
public: \
static bool Name() { \
MOZ_ASSERT(SingletonExists()); \
int32_t val = GetSingleton().mPref##Name.mValue; \
return val == 2 ? !!(BaseValue) : !!val; \
} \
static void Set##Name(bool aVal) { \
MOZ_ASSERT(SingletonExists()); \
GetSingleton().mPref##Name.Set(UpdatePolicy::Update, \
Get##Name##PrefName(), aVal ? 1 : 0); \
} \
static const char* Get##Name##PrefName() { return Prefname; } \
static int32_t Get##Name##PrefDefault() { return 2; } \
static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) { \
MOZ_ASSERT(SingletonExists()); \
GetSingleton().mPref##Name.SetChangeCallback(aCallback); \
} \
\
private: \
PrefTemplate<UpdatePolicy::Update, int32_t, Get##Name##PrefDefault, \
Get##Name##PrefName> \
mPref##Name
namespace mozilla {
namespace gfx {
class GfxPrefValue; // defined in PGPU.ipdl
} // namespace gfx
} // namespace mozilla
class gfxPrefs;
class gfxPrefs final {
typedef mozilla::gfx::GfxPrefValue GfxPrefValue;
typedef mozilla::Atomic<bool, mozilla::Relaxed> AtomicBool;
typedef mozilla::Atomic<int32_t, mozilla::Relaxed> AtomicInt32;
typedef mozilla::Atomic<uint32_t, mozilla::Relaxed> AtomicUint32;
private:
// Enums for the update policy.
enum class UpdatePolicy {
Skip, // Set the value to default, skip any Preferences calls
Once, // Evaluate the preference once, unchanged during the session
Live // Evaluate the preference and set callback so it stays current/live
};
public:
class Pref {
public:
Pref() : mChangeCallback(nullptr) {
mIndex = sGfxPrefList->Length();
sGfxPrefList->AppendElement(this);
}
size_t Index() const { return mIndex; }
void OnChange();
typedef void (*ChangeCallback)(const GfxPrefValue&);
void SetChangeCallback(ChangeCallback aCallback);
virtual const char* Name() const = 0;
// Returns true if the value is default, false if changed.
virtual bool HasDefaultValue() const = 0;
// Returns the pref value as a discriminated union.
virtual void GetLiveValue(GfxPrefValue* aOutValue) const = 0;
// Returns the pref value as a discriminated union.
virtual void GetCachedValue(GfxPrefValue* aOutValue) const = 0;
// Change the cached value. GfxPrefValue must be a compatible type.
virtual void SetCachedValue(const GfxPrefValue& aOutValue) = 0;
protected:
void FireChangeCallback();
private:
size_t mIndex;
ChangeCallback mChangeCallback;
};
static const nsTArray<Pref*>& all() { return *sGfxPrefList; }
private:
// We split out a base class to reduce the number of virtual function
// instantiations that we do, which saves code size.
template <class T>
class TypedPref : public Pref {
public:
explicit TypedPref(T aValue) : mValue(aValue) {}
void GetCachedValue(GfxPrefValue* aOutValue) const override {
CopyPrefValue(&mValue, aOutValue);
}
void SetCachedValue(const GfxPrefValue& aOutValue) override {
T newValue;
CopyPrefValue(&aOutValue, &newValue);
if (mValue != newValue) {
mValue = newValue;
FireChangeCallback();
}
}
protected:
T GetLiveValueByName(const char* aPrefName) const {
if (IsPrefsServiceAvailable()) {
return PrefGet(aPrefName, mValue);
}
return mValue;
}
public:
T mValue;
};
// Since we cannot use const char*, use a function that returns it.
template <UpdatePolicy Update, class T, T Default(void),
const char* Prefname(void)>
class PrefTemplate final : public TypedPref<T> {
typedef TypedPref<T> BaseClass;
public:
PrefTemplate() : BaseClass(Default()) {
// If not using the Preferences service, values are synced over IPC, so
// there's no need to register us as a Preferences observer.
if (IsPrefsServiceAvailable()) {
Register(Update, Prefname());
}
// By default we only watch changes in the parent process, to communicate
// changes to the GPU process.
if (IsParentProcess() && Update == UpdatePolicy::Live) {
WatchChanges(Prefname(), this);
}
}
~PrefTemplate() {
if (IsParentProcess() && Update == UpdatePolicy::Live) {
UnwatchChanges(Prefname(), this);
}
}
void Register(UpdatePolicy aUpdate, const char* aPreference) {
AssertMainThread();
switch (aUpdate) {
case UpdatePolicy::Skip:
break;
case UpdatePolicy::Once:
this->mValue = PrefGet(aPreference, this->mValue);
break;
case UpdatePolicy::Live: {
nsCString pref;
pref.AssignLiteral(aPreference, strlen(aPreference));
PrefAddVarCache(&this->mValue, pref, this->mValue);
} break;
default:
MOZ_CRASH("Incomplete switch");
}
}
void Set(UpdatePolicy aUpdate, const char* aPref, T aValue) {
AssertMainThread();
PrefSet(aPref, aValue);
switch (aUpdate) {
case UpdatePolicy::Skip:
case UpdatePolicy::Live:
break;
case UpdatePolicy::Once:
this->mValue = PrefGet(aPref, this->mValue);
break;
default:
MOZ_CRASH("Incomplete switch");
}
}
const char* Name() const override { return Prefname(); }
void GetLiveValue(GfxPrefValue* aOutValue) const override {
T value = GetLiveValue();
CopyPrefValue(&value, aOutValue);
}
// When using the Preferences service, the change callback can be triggered
// *before* our cached value is updated, so we expose a method to grab the
// true live value.
T GetLiveValue() const { return BaseClass::GetLiveValueByName(Prefname()); }
bool HasDefaultValue() const override { return this->mValue == Default(); }
};
// clang-format off
// This is where DECL_GFX_PREF for each of the preferences should go. We
// will keep these in an alphabetical order to make it easier to see if a
// method accessing a pref already exists. Just add yours in the list.
// WARNING:
// Please make sure that you've added your new preference to the list above
// in alphabetical order.
// Please do not just append it to the end of the list.
// clang-format on
public:
// Manage the singleton:
static gfxPrefs& GetSingleton() {
return sInstance ? *sInstance : CreateAndInitializeSingleton();
}
static void DestroySingleton();
static bool SingletonExists();
private:
static gfxPrefs& CreateAndInitializeSingleton();
static gfxPrefs* sInstance;
static bool sInstanceHasBeenDestroyed;
static nsTArray<Pref*>* sGfxPrefList;
private:
// The constructor cannot access GetSingleton(), since sInstance (necessarily)
// has not been assigned yet. Follow-up initialization that needs
// GetSingleton() must be added to Init().
void Init();
static bool IsPrefsServiceAvailable();
static bool IsParentProcess();
// Creating these to avoid having to include Preferences.h in the .h
static void PrefAddVarCache(bool*, const nsACString&, bool);
static void PrefAddVarCache(int32_t*, const nsACString&, int32_t);
static void PrefAddVarCache(uint32_t*, const nsACString&, uint32_t);
static void PrefAddVarCache(float*, const nsACString&, float);
static void PrefAddVarCache(std::string*, const nsCString&, std::string);
static void PrefAddVarCache(AtomicBool*, const nsACString&, bool);
static void PrefAddVarCache(AtomicInt32*, const nsACString&, int32_t);
static void PrefAddVarCache(AtomicUint32*, const nsACString&, uint32_t);
static bool PrefGet(const char*, bool);
static int32_t PrefGet(const char*, int32_t);
static uint32_t PrefGet(const char*, uint32_t);
static float PrefGet(const char*, float);
static std::string PrefGet(const char*, std::string);
static void PrefSet(const char* aPref, bool aValue);
static void PrefSet(const char* aPref, int32_t aValue);
static void PrefSet(const char* aPref, uint32_t aValue);
static void PrefSet(const char* aPref, float aValue);
static void PrefSet(const char* aPref, std::string aValue);
static void WatchChanges(const char* aPrefname, Pref* aPref);
static void UnwatchChanges(const char* aPrefname, Pref* aPref);
// Creating these to avoid having to include PGPU.h in the .h
static void CopyPrefValue(const bool* aValue, GfxPrefValue* aOutValue);
static void CopyPrefValue(const int32_t* aValue, GfxPrefValue* aOutValue);
static void CopyPrefValue(const uint32_t* aValue, GfxPrefValue* aOutValue);
static void CopyPrefValue(const float* aValue, GfxPrefValue* aOutValue);
static void CopyPrefValue(const std::string* aValue, GfxPrefValue* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, bool* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, int32_t* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, uint32_t* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, float* aOutValue);
static void CopyPrefValue(const GfxPrefValue* aValue, std::string* aOutValue);
static void AssertMainThread();
// Some wrapper functions for the DECL_OVERRIDE_PREF prefs' base values, so
// that we don't to include all sorts of header files into this gfxPrefs.h
// file.
static bool OverrideBase_WebRender();
gfxPrefs();
~gfxPrefs();
gfxPrefs(const gfxPrefs&) = delete;
gfxPrefs& operator=(const gfxPrefs&) = delete;
};
#undef DECL_GFX_PREF /* Don't need it outside of this file */
#endif /* GFX_PREFS_H */

Просмотреть файл

@ -42,7 +42,6 @@ EXPORTS += [
'gfxPlatform.h', 'gfxPlatform.h',
'gfxPlatformFontList.h', 'gfxPlatformFontList.h',
'gfxPoint.h', 'gfxPoint.h',
'gfxPrefs.h',
'gfxQuad.h', 'gfxQuad.h',
'gfxQuaternion.h', 'gfxQuaternion.h',
'gfxRect.h', 'gfxRect.h',
@ -180,7 +179,6 @@ SOURCES += [
# gfxFontUtils.cpp and gfxPlatform.cpp include mac system header conflicting with point/size # gfxFontUtils.cpp and gfxPlatform.cpp include mac system header conflicting with point/size
'gfxFontUtils.cpp', 'gfxFontUtils.cpp',
'gfxPlatform.cpp', 'gfxPlatform.cpp',
'gfxPrefs.cpp',
'PrintTarget.cpp', 'PrintTarget.cpp',
'PrintTargetThebes.cpp', 'PrintTargetThebes.cpp',
] ]

Просмотреть файл

@ -8,7 +8,7 @@
#include "prlink.h" #include "prlink.h"
#include "prenv.h" #include "prenv.h"
#include "gfxPrefs.h"
#include "nsIGlobalObject.h" #include "nsIGlobalObject.h"
#include "nsRefPtrHashtable.h" #include "nsRefPtrHashtable.h"
#include "nsString.h" #include "nsString.h"

Просмотреть файл

@ -6,7 +6,7 @@
#include "VRDisplayLocal.h" #include "VRDisplayLocal.h"
#include "VRThread.h" #include "VRThread.h"
#include "gfxPrefs.h"
#include "gfxVR.h" #include "gfxVR.h"
#include "ipc/VRLayerParent.h" #include "ipc/VRLayerParent.h"
#include "mozilla/dom/GamepadBinding.h" // For GamepadMappingType #include "mozilla/dom/GamepadBinding.h" // For GamepadMappingType

Просмотреть файл

@ -128,7 +128,6 @@ void VRParent::ActorDestroy(ActorDestroyReason aWhy) {
#endif #endif
gfxVars::Shutdown(); gfxVars::Shutdown();
gfxConfig::Shutdown(); gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
CrashReporterClient::DestroySingleton(); CrashReporterClient::DestroySingleton();
// Only calling XRE_ShutdownChildProcess() at the child process // Only calling XRE_ShutdownChildProcess() at the child process
// instead of the main process. Otherwise, it will close all child processes // instead of the main process. Otherwise, it will close all child processes
@ -164,8 +163,6 @@ bool VRParent::Init(base::ProcessId aParentPid, const char* aParentBuildID,
// Init crash reporter support. // Init crash reporter support.
CrashReporterClient::InitSingleton(this); CrashReporterClient::InitSingleton(this);
// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
gfxConfig::Init(); gfxConfig::Init();
gfxVars::Initialize(); gfxVars::Initialize();
#if defined(XP_WIN) #if defined(XP_WIN)

Просмотреть файл

@ -5,7 +5,6 @@
#include "DecoderFactory.h" #include "DecoderFactory.h"
#include "gfxPrefs.h"
#include "nsMimeTypes.h" #include "nsMimeTypes.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"

Просмотреть файл

@ -8,7 +8,7 @@
#include <algorithm> #include <algorithm>
#include <ctime> #include <ctime>
#include "gfxPrefs.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
using std::max; using std::max;

Просмотреть файл

@ -23,7 +23,6 @@
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
#include "gfxPrefs.h"
#ifdef MOZ_ENABLE_SKIA #ifdef MOZ_ENABLE_SKIA
# include "mozilla/gfx/ConvolutionFilter.h" # include "mozilla/gfx/ConvolutionFilter.h"

Просмотреть файл

@ -5,7 +5,6 @@
#include "IDecodingTask.h" #include "IDecodingTask.h"
#include "gfxPrefs.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "Decoder.h" #include "Decoder.h"

Просмотреть файл

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "Image.h" #include "Image.h"
#include "gfxPrefs.h"
#include "Layers.h" // for LayerManager #include "Layers.h" // for LayerManager
#include "nsRefreshDriver.h" #include "nsRefreshDriver.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"

Просмотреть файл

@ -110,9 +110,6 @@ already_AddRefed<Image> ImageFactory::CreateImage(
nsIRequest* aRequest, ProgressTracker* aProgressTracker, nsIRequest* aRequest, ProgressTracker* aProgressTracker,
const nsCString& aMimeType, nsIURI* aURI, bool aIsMultiPart, const nsCString& aMimeType, nsIURI* aURI, bool aIsMultiPart,
uint32_t aInnerWindowId) { uint32_t aInnerWindowId) {
MOZ_ASSERT(gfxPrefs::SingletonExists(),
"Pref observers should have been initialized already");
// Compute the image's initialization flags. // Compute the image's initialization flags.
uint32_t imageFlags = ComputeImageFlags(aURI, aMimeType, aIsMultiPart); uint32_t imageFlags = ComputeImageFlags(aURI, aMimeType, aIsMultiPart);

Просмотреть файл

@ -13,7 +13,6 @@
#include "ShutdownTracker.h" #include "ShutdownTracker.h"
#include "SurfaceCache.h" #include "SurfaceCache.h"
#include "gfxPrefs.h"
#include "imgLoader.h" #include "imgLoader.h"
using namespace mozilla::image; using namespace mozilla::image;
@ -26,9 +25,6 @@ nsresult mozilla::image::EnsureModuleInitialized() {
return NS_OK; return NS_OK;
} }
// Make sure the preferences are initialized
gfxPrefs::GetSingleton();
mozilla::image::ShutdownTracker::Initialize(); mozilla::image::ShutdownTracker::Initialize();
mozilla::image::ImageFactory::Initialize(); mozilla::image::ImageFactory::Initialize();
mozilla::image::DecodePool::Initialize(); mozilla::image::DecodePool::Initialize();

Просмотреть файл

@ -13,7 +13,7 @@
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"

Просмотреть файл

@ -8,7 +8,7 @@
#include <cstdlib> #include <cstdlib>
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h"
#include "nsIDirectoryService.h" #include "nsIDirectoryService.h"
#include "nsIFile.h" #include "nsIFile.h"
@ -281,7 +281,6 @@ bool RowHasPixels(SourceSurface* aSurface, int32_t aRow,
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
already_AddRefed<Decoder> CreateTrivialDecoder() { already_AddRefed<Decoder> CreateTrivialDecoder() {
gfxPrefs::GetSingleton();
DecoderType decoderType = DecoderFactory::GetDecoderType("image/gif"); DecoderType decoderType = DecoderFactory::GetDecoderType("image/gif");
auto sourceBuffer = MakeNotNull<RefPtr<SourceBuffer>>(); auto sourceBuffer = MakeNotNull<RefPtr<SourceBuffer>>();
RefPtr<Decoder> decoder = DecoderFactory::CreateAnonymousDecoder( RefPtr<Decoder> decoder = DecoderFactory::CreateAnonymousDecoder(

Просмотреть файл

@ -20,7 +20,6 @@ using namespace mozilla::gfx;
using namespace mozilla::image; using namespace mozilla::image;
static already_AddRefed<Decoder> CreateTrivialBlendingDecoder() { static already_AddRefed<Decoder> CreateTrivialBlendingDecoder() {
gfxPrefs::GetSingleton();
DecoderType decoderType = DecoderFactory::GetDecoderType("image/gif"); DecoderType decoderType = DecoderFactory::GetDecoderType("image/gif");
DecoderFlags decoderFlags = DefaultDecoderFlags(); DecoderFlags decoderFlags = DefaultDecoderFlags();
SurfaceFlags surfaceFlags = DefaultSurfaceFlags(); SurfaceFlags surfaceFlags = DefaultSurfaceFlags();

Просмотреть файл

@ -39,7 +39,7 @@
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "nsJSUtils.h" #include "nsJSUtils.h"
#include "gfxPrefs.h"
#include "nsIXULRuntime.h" #include "nsIXULRuntime.h"
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
@ -1327,8 +1327,6 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp,
return 1; return 1;
} }
// Initialize graphics prefs on the main thread, if not already done
gfxPrefs::GetSingleton();
// Initialize e10s check on the main thread, if not already done // Initialize e10s check on the main thread, if not already done
BrowserTabsRemoteAutostart(); BrowserTabsRemoteAutostart();
#ifdef XP_WIN #ifdef XP_WIN

Просмотреть файл

@ -9,7 +9,7 @@
#include "AccessibleCaretLogger.h" #include "AccessibleCaretLogger.h"
#include "AccessibleCaretManager.h" #include "AccessibleCaretManager.h"
#include "Layers.h" #include "Layers.h"
#include "gfxPrefs.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h" #include "mozilla/PresShell.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "MobileViewportManager.h" #include "MobileViewportManager.h"
#include "gfxPrefs.h"
#include "LayersLogging.h" #include "LayersLogging.h"
#include "mozilla/PresShell.h" #include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h" #include "mozilla/dom/Document.h"

Просмотреть файл

@ -7,7 +7,6 @@
#include "TouchManager.h" #include "TouchManager.h"
#include "gfxPrefs.h"
#include "mozilla/dom/EventTarget.h" #include "mozilla/dom/EventTarget.h"
#include "mozilla/PresShell.h" #include "mozilla/PresShell.h"
#include "nsIFrame.h" #include "nsIFrame.h"

Просмотреть файл

@ -11,7 +11,7 @@
#include <string> #include <string>
#include "AccessibleCaretManager.h" #include "AccessibleCaretManager.h"
#include "gfxPrefs.h"
#include "mozilla/AccessibleCaretEventHub.h" #include "mozilla/AccessibleCaretEventHub.h"
#include "mozilla/BasicEvents.h" #include "mozilla/BasicEvents.h"
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"

Просмотреть файл

@ -66,7 +66,7 @@
#include "LayerUserData.h" #include "LayerUserData.h"
#include "ClientLayerManager.h" #include "ClientLayerManager.h"
#include "mozilla/dom/NotifyPaintEvent.h" #include "mozilla/dom/NotifyPaintEvent.h"
#include "gfxPrefs.h"
#include "nsIDOMChromeWindow.h" #include "nsIDOMChromeWindow.h"
#include "nsFrameLoader.h" #include "nsFrameLoader.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -339,10 +339,6 @@ bool nsPresContext::IsChromeOriginImage() const {
} }
void nsPresContext::GetDocumentColorPreferences() { void nsPresContext::GetDocumentColorPreferences() {
// Make sure the preferences are initialized. In the normal run,
// they would already be, because gfxPlatform would have been created,
// but in some reference tests, that is not the case.
gfxPrefs::GetSingleton();
PreferenceSheet::EnsureInitialized(); PreferenceSheet::EnsureInitialized();
} }

Просмотреть файл

@ -64,7 +64,7 @@
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#include "nsJSEnvironment.h" #include "nsJSEnvironment.h"
#include "mozilla/Telemetry.h" #include "mozilla/Telemetry.h"
#include "gfxPrefs.h"
#include "BackgroundChild.h" #include "BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/layout/VsyncChild.h" #include "mozilla/layout/VsyncChild.h"
@ -990,9 +990,6 @@ static void CreateVsyncRefreshTimer() {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
PodArrayZero(sJankLevels); PodArrayZero(sJankLevels);
// Sometimes, gfxPrefs is not initialized here. Make sure the gfxPrefs is
// ready.
gfxPrefs::GetSingleton();
if (gfxPlatform::IsInLayoutAsapMode()) { if (gfxPlatform::IsInLayoutAsapMode()) {
return; return;

Просмотреть файл

@ -18,7 +18,7 @@
#include "mozilla/EventStates.h" #include "mozilla/EventStates.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "Layers.h" #include "Layers.h"
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "mozilla/layers/RenderRootStateManager.h" #include "mozilla/layers/RenderRootStateManager.h"

Просмотреть файл

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ScrollAnimationBezierPhysics.h" #include "ScrollAnimationBezierPhysics.h"
#include "gfxPrefs.h"
using namespace mozilla; using namespace mozilla;

Просмотреть файл

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ScrollAnimationMSDPhysics.h" #include "ScrollAnimationMSDPhysics.h"
#include "gfxPrefs.h"
using namespace mozilla; using namespace mozilla;

Просмотреть файл

@ -7,7 +7,7 @@
#include "ScrollSnap.h" #include "ScrollSnap.h"
#include "FrameMetrics.h" #include "FrameMetrics.h"
#include "gfxPrefs.h"
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsLineLayout.h" #include "nsLineLayout.h"

Просмотреть файл

@ -10,7 +10,7 @@
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "gfxContext.h" #include "gfxContext.h"
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PathHelpers.h" #include "mozilla/gfx/PathHelpers.h"

Просмотреть файл

@ -16,7 +16,6 @@
#include "nsIPopupContainer.h" #include "nsIPopupContainer.h"
#include "nsDisplayList.h" #include "nsDisplayList.h"
#include "nsIAnonymousContentCreator.h" #include "nsIAnonymousContentCreator.h"
#include "gfxPrefs.h"
class nsPresContext; class nsPresContext;
class gfxContext; class gfxContext;

Просмотреть файл

@ -61,7 +61,6 @@
#include "nsIFrameInlines.h" #include "nsIFrameInlines.h"
#include "nsILayoutHistoryState.h" #include "nsILayoutHistoryState.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "mozilla/StaticPrefs.h" #include "mozilla/StaticPrefs.h"
#include "ScrollAnimationPhysics.h" #include "ScrollAnimationPhysics.h"
#include "ScrollAnimationBezierPhysics.h" #include "ScrollAnimationBezierPhysics.h"

Просмотреть файл

@ -9,7 +9,7 @@
#include "nsTextFrame.h" #include "nsTextFrame.h"
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "gfxPrefs.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/ComputedStyle.h" #include "mozilla/ComputedStyle.h"

Просмотреть файл

@ -6,7 +6,6 @@
#include "DisplayListChecker.h" #include "DisplayListChecker.h"
#include "gfxPrefs.h"
#include "nsDisplayList.h" #include "nsDisplayList.h"
namespace mozilla { namespace mozilla {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше