gecko-dev/modules/libpref/moz.build

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 строки
1.2 KiB
Plaintext
Исходник Обычный вид История

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files('**'):
BUG_COMPONENT = ('Core', 'Preferences: Backend')
if CONFIG['ENABLE_TESTS']:
DIRS += ['test/gtest']
XPCSHELL_TESTS_MANIFESTS += [
'test/unit/xpcshell.ini',
'test/unit_ipc/xpcshell.ini',
]
Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg --HG-- rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h
2014-08-08 08:52:04 +04:00
XPIDL_SOURCES += [
'nsIPrefBranch.idl',
'nsIPrefLocalizedString.idl',
'nsIPrefService.idl',
'nsIRelativeFilePref.idl',
]
XPIDL_MODULE = 'pref'
EXPORTS.mozilla += [
Bug 1436655 - Introduce a mechanism for VarCache prefs to be defined entirely in the binary. r=glandium Currently VarCache prefs are setup in two parts: - The vanilla pref part, installed via a data file such as all.js, or via an API call. - The VarCache variable part, setup by an Add*VarCache() call. Both parts are needed for the pref to actually operate as a proper VarCache pref. (There are various prefs for which we do one but not the other unless a certain condition is met.) This patch introduces a new way of doing things. There is a new file, modules/libpref/init/StaticPrefList.h, which defines prefs like this: > VARCACHE_PREF( > "layout.accessiblecaret.width", > layout_accessiblecaret_width, > float, 34.0 > ) This replaces both the existing parts. The preprocessor is used to generate multiple things from this single definition: - A global variable (the VarCache itself). - A getter for that global variable. - A call to an init function that unconditionally installs the pref in the prefs hash table at startup. C++ files can include the new StaticPrefs.h file to access the getter. Rust code cannot use the getter, but can access the global variable directly via structs.rs. This is similar to how things currently work for Rust code. Non-VarCache prefs can also be declared in StaticPrefList.h, using PREF instead of the VARCACHE_PREF. The new approach has the following advantages. + It eliminates the duplication (in all.js and the Add*VarCache() call) of the pref name and default value, preventing potential mismatches. (This is a real problem in practice!) + There is now a single initialization point for these VarCache prefs. + This avoids need to find a place to insert the Add*VarCache() calls, which are currently spread all over the place. + It also eliminates the common pattern whereby these calls are wrapped in a execute-once block protected by a static boolean (see bug 1346224). + It's no longer possible to have a VarCache pref for which only one of the pieces has been setup. + It encapsulates the VarCache global variable, so there is no need to declare it separately. + VarCache reads are done via a getter (e.g. StaticPrefs::foo_bar_baz()) instead of a raw global variable read. + This makes it clearer that you're reading a pref value, and easier to search for uses. + This prevents accidental writes to the global variable. + This prevents accidental mistyping of the pref name. + This provides a single chokepoint in the code for such accesses, which make adding checking and instrumentation feasible. + It subsumes MediaPrefs, and will allow that class to be removed. (gfxPrefs is a harder lift, unfortunately.) + Once all VarCache prefs are migrated to the new approach, the VarCache mechanism will be better encapsulated, with fewer details publicly visible. + (Future work) This will allow the pref names to be stored statically, saving memory in every process. The main downside of the new approach is that all of these prefs are in a single header that is included in quite a few places, so any changes to this header will cause a fair amount of recompilation. Another minor downside is that all VarCache prefs are defined and visible from start-up. For test-only prefs like network.predictor.doing-tests, having them show in about:config isn't particularly useful. The patch also moves three network VarCache prefs to the new mechanism as a basic demonstration. (And note the inconsistencies in the multiple initial values that were provided for network.auth.subresource-img-cross-origin-http-auth-allow!) There will be numerous follow-up bugs to convert the remaining VarCache prefs. MozReview-Commit-ID: 9ABNpOR16uW * * * [mq]: fixup MozReview-Commit-ID: 6ToT9dQjIAq
2018-03-26 01:39:40 +03:00
'init/StaticPrefList.h',
'nsRelativeFilePref.h',
Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg --HG-- rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h
2014-08-08 08:52:04 +04:00
'Preferences.h',
Bug 1436655 - Introduce a mechanism for VarCache prefs to be defined entirely in the binary. r=glandium Currently VarCache prefs are setup in two parts: - The vanilla pref part, installed via a data file such as all.js, or via an API call. - The VarCache variable part, setup by an Add*VarCache() call. Both parts are needed for the pref to actually operate as a proper VarCache pref. (There are various prefs for which we do one but not the other unless a certain condition is met.) This patch introduces a new way of doing things. There is a new file, modules/libpref/init/StaticPrefList.h, which defines prefs like this: > VARCACHE_PREF( > "layout.accessiblecaret.width", > layout_accessiblecaret_width, > float, 34.0 > ) This replaces both the existing parts. The preprocessor is used to generate multiple things from this single definition: - A global variable (the VarCache itself). - A getter for that global variable. - A call to an init function that unconditionally installs the pref in the prefs hash table at startup. C++ files can include the new StaticPrefs.h file to access the getter. Rust code cannot use the getter, but can access the global variable directly via structs.rs. This is similar to how things currently work for Rust code. Non-VarCache prefs can also be declared in StaticPrefList.h, using PREF instead of the VARCACHE_PREF. The new approach has the following advantages. + It eliminates the duplication (in all.js and the Add*VarCache() call) of the pref name and default value, preventing potential mismatches. (This is a real problem in practice!) + There is now a single initialization point for these VarCache prefs. + This avoids need to find a place to insert the Add*VarCache() calls, which are currently spread all over the place. + It also eliminates the common pattern whereby these calls are wrapped in a execute-once block protected by a static boolean (see bug 1346224). + It's no longer possible to have a VarCache pref for which only one of the pieces has been setup. + It encapsulates the VarCache global variable, so there is no need to declare it separately. + VarCache reads are done via a getter (e.g. StaticPrefs::foo_bar_baz()) instead of a raw global variable read. + This makes it clearer that you're reading a pref value, and easier to search for uses. + This prevents accidental writes to the global variable. + This prevents accidental mistyping of the pref name. + This provides a single chokepoint in the code for such accesses, which make adding checking and instrumentation feasible. + It subsumes MediaPrefs, and will allow that class to be removed. (gfxPrefs is a harder lift, unfortunately.) + Once all VarCache prefs are migrated to the new approach, the VarCache mechanism will be better encapsulated, with fewer details publicly visible. + (Future work) This will allow the pref names to be stored statically, saving memory in every process. The main downside of the new approach is that all of these prefs are in a single header that is included in quite a few places, so any changes to this header will cause a fair amount of recompilation. Another minor downside is that all VarCache prefs are defined and visible from start-up. For test-only prefs like network.predictor.doing-tests, having them show in about:config isn't particularly useful. The patch also moves three network VarCache prefs to the new mechanism as a basic demonstration. (And note the inconsistencies in the multiple initial values that were provided for network.auth.subresource-img-cross-origin-http-auth-allow!) There will be numerous follow-up bugs to convert the remaining VarCache prefs. MozReview-Commit-ID: 9ABNpOR16uW * * * [mq]: fixup MozReview-Commit-ID: 6ToT9dQjIAq
2018-03-26 01:39:40 +03:00
'StaticPrefs.h',
Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg --HG-- rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h
2014-08-08 08:52:04 +04:00
]
UNIFIED_SOURCES += [
'Preferences.cpp',
'SharedPrefMap.cpp',
Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg --HG-- rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h
2014-08-08 08:52:04 +04:00
]
XPCOM_MANIFESTS += [
'components.conf',
]
Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg --HG-- rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h
2014-08-08 08:52:04 +04:00
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
if CONFIG['MOZ_ENABLE_WEBRENDER']:
DEFINES['MOZ_ENABLE_WEBRENDER'] = True
FINAL_TARGET_PP_FILES += [
'greprefs.js',
]