mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1559563 - P1. Move StaticPrefs accessor back to header file. r=njn
This allows for the compiler to inline the code where appropriate. Differential Revision: https://phabricator.services.mozilla.com/D35124 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
139dde3db5
commit
b10113a9fc
@ -5439,18 +5439,6 @@ static StaticMutex sOncePrefMutex;
|
||||
#define PREF(name, cpp_type, value)
|
||||
#define VARCACHE_PREF(policy, name, id, cpp_type, default_value) \
|
||||
cpp_type StaticPrefs::sVarCache_##id(default_value); \
|
||||
StripAtomic<cpp_type> StaticPrefs::id() { \
|
||||
if (UpdatePolicy::policy != UpdatePolicy::Once) { \
|
||||
MOZ_DIAGNOSTIC_ASSERT( \
|
||||
UpdatePolicy::policy == UpdatePolicy::Skip || \
|
||||
IsAtomic<cpp_type>::value || NS_IsMainThread(), \
|
||||
"Non-atomic static pref '" name \
|
||||
"' being accessed on background thread by getter"); \
|
||||
return sVarCache_##id; \
|
||||
} \
|
||||
MaybeInitOncePrefs(); \
|
||||
return sVarCache_##id; \
|
||||
} \
|
||||
void StaticPrefs::Set##id(StripAtomic<cpp_type> aValue) { \
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread() && XRE_IsParentProcess(), \
|
||||
"pref '" name "' being set outside parent process"); \
|
||||
|
@ -103,7 +103,18 @@ class StaticPrefs {
|
||||
static cpp_type sVarCache_##id; \
|
||||
\
|
||||
public: \
|
||||
static StripAtomic<cpp_type> id(); \
|
||||
static StripAtomic<cpp_type> id() { \
|
||||
if (UpdatePolicy::policy != UpdatePolicy::Once) { \
|
||||
MOZ_DIAGNOSTIC_ASSERT( \
|
||||
UpdatePolicy::policy == UpdatePolicy::Skip || \
|
||||
IsAtomic<cpp_type>::value || NS_IsMainThread(), \
|
||||
"Non-atomic static pref '" str \
|
||||
"' being accessed on background thread by getter"); \
|
||||
return sVarCache_##id; \
|
||||
} \
|
||||
MaybeInitOncePrefs(); \
|
||||
return sVarCache_##id; \
|
||||
} \
|
||||
static void Set##id(StripAtomic<cpp_type> aValue); \
|
||||
static const char* Get##id##PrefName() { return str; } \
|
||||
static StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; }
|
||||
|
Loading…
Reference in New Issue
Block a user