Skip to content

Commit

Permalink
Bug 1563139 - Remove StaticPrefs.h. r=glandium
Browse files Browse the repository at this point in the history
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

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

--HG--
extra : moz-landing-system : lando
  • Loading branch information
nnethercote committed Jul 26, 2019
1 parent 329127d commit 18fae65
Show file tree
Hide file tree
Showing 386 changed files with 509 additions and 363 deletions.
2 changes: 2 additions & 0 deletions docshell/base/nsDefaultURIFixup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "mozilla/Unused.h"
#include "nsIObserverService.h"
#include "nsXULAppAPI.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_keyword.h"

// Used to check if external protocol schemes are usable
#include "nsCExternalHandlerService.h"
Expand Down
6 changes: 5 additions & 1 deletion docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
#include "mozilla/ResultExtensions.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_extensions.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/StartupTimeline.h"
#include "mozilla/StorageAccess.h"
#include "mozilla/Telemetry.h"
Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsDocShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
#include "mozilla/Move.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WeakPtr.h"
Expand Down
3 changes: 2 additions & 1 deletion dom/animation/KeyframeEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include "mozilla/PresShell.h"
#include "mozilla/PresShellInlines.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/TypeTraits.h"
#include "Layers.h" // For Layer
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetComputedStyle
Expand Down
2 changes: 1 addition & 1 deletion dom/animation/KeyframeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "mozilla/ServoBindingTypes.h"
#include "mozilla/ServoCSSParser.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/TimingParams.h"
#include "mozilla/dom/BaseKeyframeTypesBinding.h" // For FastBaseKeyframe etc.
#include "mozilla/dom/Document.h" // For Document::AreWebAnimationsImplicitKeyframesEnabled
Expand Down
3 changes: 3 additions & 0 deletions dom/base/ContentBlockingLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/RandomNum.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPrefs_telemetry.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
#include "mozilla/XorShift128PlusRNG.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/ContentBlockingLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "mozilla/AntiTrackingCommon.h"
#include "mozilla/JSONWriter.h"
#include "mozilla/Maybe.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/Tuple.h"
#include "mozilla/UniquePtr.h"
#include "nsIWebProgressListener.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/DocGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "mozilla/AbstractThread.h"
#include "mozilla/PerformanceUtils.h"
#include "mozilla/ThrottledEventQueue.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"
#include "nsIDocShell.h"
#include "nsDOMMutationObserver.h"
Expand Down
8 changes: 7 additions & 1 deletion dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
#include "mozilla/PresShell.h"
#include "mozilla/PresShellInlines.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_full_screen_api.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_plugins.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPrefs_security.h"
#include "mozilla/StorageAccess.h"
#include "mozilla/TextEditor.h"
#include "mozilla/URLExtraData.h"
Expand Down
3 changes: 2 additions & 1 deletion dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

#include "AnimationCommon.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/dom/Animation.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/BindContext.h"
Expand Down
4 changes: 3 additions & 1 deletion dom/base/Navigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "nsContentUtils.h"
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/Telemetry.h"
#include "BatteryManager.h"
#include "mozilla/dom/CredentialsContainer.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/PopupBlocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "mozilla/dom/PopupBlocker.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TimeStamp.h"
#include "nsXULPopupManager.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/RangeBoundary.h"
#include "mozilla/RangeUtils.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"

#include "nsCOMPtr.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/SelectionChangeEventDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "SelectionChangeEventDispatcher.h"

#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Document.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/StorageAccessPermissionRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "StorageAccessPermissionRequest.h"
#include "nsGlobalWindowInner.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include <cstdlib>

namespace mozilla {
Expand Down
1 change: 1 addition & 0 deletions dom/base/TextInputProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "mozilla/dom/Event.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Maybe.h"
#include "mozilla/StaticPrefs_test.h"
#include "mozilla/TextEventDispatcher.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TextInputProcessor.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/TimeoutManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "nsGlobalWindow.h"
#include "mozilla/Logging.h"
#include "mozilla/PerformanceCounter.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/Telemetry.h"
#include "mozilla/ThrottledEventQueue.h"
#include "mozilla/TimeStamp.h"
Expand Down
10 changes: 8 additions & 2 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
// is included in mozAutoDocUpdate.h.
#include "nsNPAPIPluginInstance.h"
#include "gfxDrawable.h"
#include "mozilla/StaticPrefs.h"
#include "ImageOps.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/AntiTrackingCommon.h"
Expand Down Expand Up @@ -97,7 +96,14 @@
#include "mozilla/ResultExtensions.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_full_screen_api.h"
#ifdef FUZZING
# include "mozilla/StaticPrefs_fuzzing.h"
#endif
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPrefs_test.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TextEvents.h"
#include "nsArrayUtils.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "mozilla/MiscEvents.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TextEventDispatcher.h"
#include "mozilla/TouchEvents.h"
Expand Down
1 change: 1 addition & 0 deletions dom/base/nsFrameLoaderOwner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/MozFrameLoaderOwnerBinding.h"
#include "mozilla/StaticPrefs_fission.h"

using namespace mozilla;
using namespace mozilla::dom;
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
#include "PostMessageEvent.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "PaintWorkletImpl.h"

// Interfaces Needed
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsGlobalWindowOuter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/ProcessHangMonitor.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/ThrottledEventQueue.h"
#include "AudioChannelService.h"
#include "nsAboutProtocolUtils.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsINode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "mozilla/dom/SVGUseElement.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/L10nOverlays.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_layout.h"
#include "nsAttrValueOrString.h"
#include "nsBindingManager.h"
#include "nsCCUncollectableMarker.h"
Expand Down
1 change: 1 addition & 0 deletions dom/base/nsImageLoadingContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "mozilla/net/UrlClassifierFeatureFactory.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_image.h"

#ifdef LoadImage
// Undefine LoadImage to prevent naming conflict with Windows.
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsJSEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/MainThreadIdlePeriod.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_javascript.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMExceptionBinding.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsJSUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "nsGlobalWindow.h"
#include "nsXBLPrototypeBinding.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/Element.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsJSUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "mozilla/Assertions.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Utf8.h" // mozilla::Utf8Unit

#include "GeckoProfiler.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_media.h"
#include "nsCOMPtr.h"
#include "nsRect.h"

Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsStyledElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsDOMCSSDeclaration.h"
#include "nsDOMCSSAttrDeclaration.h"
#include "nsServiceManagerUtils.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/BindingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Unused.h"
#include "mozilla/UseCounter.h"

Expand Down
10 changes: 8 additions & 2 deletions dom/bindings/Codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -14765,7 +14765,10 @@ def descriptorRequiresPreferences(desc):
iface = desc.interface
return iface.getExtendedAttribute("Pref") is not None

bindingHeaders["mozilla/StaticPrefs.h"] = (
# Bug 1568729: ideally we'd be smarter about this, and only include the
# required StaticPrefs_*.h file, rather than StaticPrefsAll.h, which
# includes all StaticPrefs_*.h files.
bindingHeaders["mozilla/StaticPrefsAll.h"] = (
any(descriptorRequiresPreferences(d) for d in descriptors) or
any(dictionaryHasPrefControlledMember(d) for d in dictionaries))
bindingHeaders["mozilla/dom/WebIDLPrefs.h"] = any(
Expand Down Expand Up @@ -18074,7 +18077,10 @@ def UnionConversions(config):
@staticmethod
def WebIDLPrefs(config):
prefs = set()
headers = set(["mozilla/dom/WebIDLPrefs.h", "mozilla/StaticPrefs.h"])
# Bug 1568729: ideally we'd be smarter about this, and only include the
# required StaticPrefs_*.h file, rather than StaticPrefsAll.h, which
# includes all StaticPrefs_*.h files.
headers = set(["mozilla/dom/WebIDLPrefs.h", "mozilla/StaticPrefsAll.h"])
for d in config.getDescriptors(hasInterfaceOrInterfacePrototypeObject=True):
for m in d.interface.members:
pref = PropertyDefiner.getStringAttr(m, "Pref")
Expand Down
2 changes: 1 addition & 1 deletion dom/cache/CacheStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Document.h"
#include "nsIGlobalObject.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Preferences.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/CanvasUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/BrowserChild.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "nsIPrincipal.h"

#include "nsGfxCIID.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGL2Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "WebGL2Context.h"

#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_webgl.h"
#include "GLContext.h"
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
#include "mozilla/ArrayUtils.h"
Expand Down
1 change: 1 addition & 0 deletions dom/canvas/WebGL2ContextSync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "GLContext.h"
#include "WebGLSync.h"
#include "mozilla/StaticPrefs_webgl.h"

namespace mozilla {

Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "mozilla/ProcessPriorityManager.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_webgl.h"
#include "mozilla/Telemetry.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLContextValidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "jsfriendapi.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_webgl.h"
#include "nsIObserverService.h"
#include "nsPrintfCString.h"
#include "WebGLActiveInfo.h"
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPrefs_webgl.h"
#include "WebGLContext.h"

namespace mozilla {
Expand Down
Loading

0 comments on commit 18fae65

Please sign in to comment.