Bug 1920718 - Annotate all global variable with runtime initialization attributes r=glandium,application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh,geckoview-reviewers,win-reviewers,gstoll,m_kato

MOZ_RUNINIT => initialized at runtime
MOZ_CONSTINIT => initialized at compile time
MOZ_GLOBINIT => initialized either at runtime or compile time, depending on template parameter, macro parameter etc
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
This commit is contained in:
serge-sans-paille 2024-10-30 11:05:24 +00:00
parent 793bb2cd41
commit 8a0a0f7524
290 changed files with 922 additions and 793 deletions

View File

@ -19,7 +19,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::a11y; using namespace mozilla::a11y;
static nsTHashMap<nsStringHashKey, nsString> sLocalizedStrings; MOZ_RUNINIT static nsTHashMap<nsStringHashKey, nsString> sLocalizedStrings;
void a11y::PlatformInit() { void a11y::PlatformInit() {
nsresult rv = NS_OK; nsresult rv = NS_OK;

View File

@ -1498,7 +1498,7 @@ LocalAccessible* nsAccessibilityService::CreateAccessible(
# include "mozilla/Monitor.h" # include "mozilla/Monitor.h"
# include "mozilla/Maybe.h" # include "mozilla/Maybe.h"
static Maybe<Monitor> sAndroidMonitor; MOZ_RUNINIT static Maybe<Monitor> sAndroidMonitor;
mozilla::Monitor& nsAccessibilityService::GetAndroidMonitor() { mozilla::Monitor& nsAccessibilityService::GetAndroidMonitor() {
if (!sAndroidMonitor.isSome()) { if (!sAndroidMonitor.isSome()) {

View File

@ -18,8 +18,8 @@ using namespace mozilla::a11y;
#define PREF_ACCESSIBILITY_MAC_DEBUG "accessibility.mac.debug" #define PREF_ACCESSIBILITY_MAC_DEBUG "accessibility.mac.debug"
static nsTHashMap<nsPtrHashKey<mozilla::a11y::Accessible>, MOZ_RUNINIT static nsTHashMap<nsPtrHashKey<mozilla::a11y::Accessible>,
MOXTextMarkerDelegate*> MOXTextMarkerDelegate*>
sDelegates; sDelegates;
@implementation MOXTextMarkerDelegate @implementation MOXTextMarkerDelegate

View File

@ -411,7 +411,7 @@ struct RoleDescrMap {
const nsString description; const nsString description;
}; };
static const RoleDescrMap sRoleDescrMap[] = { MOZ_RUNINIT static const RoleDescrMap sRoleDescrMap[] = {
{@"AXApplicationAlert", u"alert"_ns}, {@"AXApplicationAlert", u"alert"_ns},
{@"AXApplicationAlertDialog", u"alertDialog"_ns}, {@"AXApplicationAlertDialog", u"alertDialog"_ns},
{@"AXApplicationDialog", u"dialog"_ns}, {@"AXApplicationDialog", u"dialog"_ns},

View File

@ -45,7 +45,7 @@ static const GUID IID_MsaaAccessible = {
0x4afc, 0x4afc,
{0xa3, 0x2c, 0xd6, 0xb5, 0xc0, 0x10, 0x04, 0x6b}}; {0xa3, 0x2c, 0xd6, 0xb5, 0xc0, 0x10, 0x04, 0x6b}};
MsaaIdGenerator MsaaAccessible::sIDGen; MOZ_RUNINIT MsaaIdGenerator MsaaAccessible::sIDGen;
ITypeInfo* MsaaAccessible::gTypeInfo = nullptr; ITypeInfo* MsaaAccessible::gTypeInfo = nullptr;
/* static */ /* static */

View File

@ -158,7 +158,7 @@ static bool IsArg(const char* arg, const char* s) {
return false; return false;
} }
Bootstrap::UniquePtr gBootstrap; MOZ_RUNINIT Bootstrap::UniquePtr gBootstrap;
static int do_main(int argc, char* argv[], char* envp[]) { static int do_main(int argc, char* argv[], char* envp[]) {
// Allow firefox.exe to launch XULRunner apps via -app <application.ini> // Allow firefox.exe to launch XULRunner apps via -app <application.ini>

View File

@ -78,8 +78,7 @@ class SafeThreadLocal final {
}; };
template <typename T> template <typename T>
MOZ_THREAD_LOCAL(T) MOZ_GLOBINIT MOZ_THREAD_LOCAL(T) SafeThreadLocal<T>::sThreadLocal;
SafeThreadLocal<T>::sThreadLocal;
template <typename T> template <typename T>
T SafeThreadLocal<T>::sGlobal = nullptr; T SafeThreadLocal<T>::sGlobal = nullptr;

View File

@ -289,9 +289,9 @@ static DynamicBlockList ConvertStaticBlocklistToDynamic(
return blockList; return blockList;
} }
const DynamicBlockList gFullList = MOZ_RUNINIT const DynamicBlockList gFullList =
ConvertStaticBlocklistToDynamic(gWindowsDllBlocklist); ConvertStaticBlocklistToDynamic(gWindowsDllBlocklist);
const DynamicBlockList gShortList = MOZ_RUNINIT const DynamicBlockList gShortList =
ConvertStaticBlocklistToDynamic(kDllBlocklistShort); ConvertStaticBlocklistToDynamic(kDllBlocklistShort);
static bool TestDependentModules() { static bool TestDependentModules() {

View File

@ -29,7 +29,7 @@ TEST_P(PrincipalAttributesTest, PrincipalAttributesTest) {
ASSERT_EQ(principal->GetIsIpAddress(), GetParam().expectIsIpAddress); ASSERT_EQ(principal->GetIsIpAddress(), GetParam().expectIsIpAddress);
} }
static const PrincipalAttributesParam kAttributes[] = { MOZ_RUNINIT static const PrincipalAttributesParam kAttributes[] = {
{nsAutoCString("https://mozilla.com"), false}, {nsAutoCString("https://mozilla.com"), false},
{nsAutoCString("https://127.0.0.1"), true}, {nsAutoCString("https://127.0.0.1"), true},
{nsAutoCString("https://[::1]"), true}, {nsAutoCString("https://[::1]"), true},

View File

@ -394,6 +394,11 @@ C/C++ practices
- One-argument constructors, that are not copy or move constructors, - One-argument constructors, that are not copy or move constructors,
should generally be marked explicit. Exceptions should be annotated should generally be marked explicit. Exceptions should be annotated
with ``MOZ_IMPLICIT``. with ``MOZ_IMPLICIT``.
- Global variables with runtimle initialization should be avoided. Flagging
them as ``constexpr`` or ``MOZ_CONSTINIT`` is a good way to make sure the
initialization happens at compile-time. If runtime initialization cannot be
avoided, use the attribute ``MOZ_RUNINIT`` to identify those and tell the
linter to ignore that variable.
- Use ``char32_t`` as the return type or argument type of a method that - Use ``char32_t`` as the return type or argument type of a method that
returns or takes as argument a single Unicode scalar value. (Don't returns or takes as argument a single Unicode scalar value. (Don't
use UTF-32 strings, though.) use UTF-32 strings, though.)

View File

@ -82,7 +82,7 @@ struct ListHelper {
LinkedList<nsSHistory> mList; LinkedList<nsSHistory> mList;
}; };
static ListHelper gSHistoryList; MOZ_RUNINIT static ListHelper gSHistoryList;
// Max viewers allowed total, across all SHistory objects - negative default // Max viewers allowed total, across all SHistory objects - negative default
// means we will calculate how many viewers to cache based on total memory // means we will calculate how many viewers to cache based on total memory
int32_t nsSHistory::sHistoryMaxTotalViewers = -1; int32_t nsSHistory::sHistoryMaxTotalViewers = -1;

View File

@ -15,20 +15,25 @@
/* Globally initialized constants /* Globally initialized constants
*/ */
namespace mozilla { namespace mozilla {
const TimeDuration kOneMinute = TimeDuration::FromSeconds(60.0f); MOZ_RUNINIT const TimeDuration kOneMinute = TimeDuration::FromSeconds(60.0f);
const TimeDuration kCCDelay = TimeDuration::FromSeconds(6); MOZ_RUNINIT const TimeDuration kCCDelay = TimeDuration::FromSeconds(6);
const TimeDuration kCCSkippableDelay = TimeDuration::FromMilliseconds(250); MOZ_RUNINIT const TimeDuration kCCSkippableDelay =
const TimeDuration kTimeBetweenForgetSkippableCycles = TimeDuration::FromMilliseconds(250);
MOZ_RUNINIT const TimeDuration kTimeBetweenForgetSkippableCycles =
TimeDuration::FromSeconds(2); TimeDuration::FromSeconds(2);
const TimeDuration kForgetSkippableSliceDuration = MOZ_RUNINIT const TimeDuration kForgetSkippableSliceDuration =
TimeDuration::FromMilliseconds(2); TimeDuration::FromMilliseconds(2);
const TimeDuration kICCIntersliceDelay = TimeDuration::FromMilliseconds(250); MOZ_RUNINIT const TimeDuration kICCIntersliceDelay =
const TimeDuration kICCSliceBudget = TimeDuration::FromMilliseconds(3); TimeDuration::FromMilliseconds(250);
const TimeDuration kIdleICCSliceBudget = TimeDuration::FromMilliseconds(2); MOZ_RUNINIT const TimeDuration kICCSliceBudget =
const TimeDuration kMaxICCDuration = TimeDuration::FromSeconds(2); TimeDuration::FromMilliseconds(3);
MOZ_RUNINIT const TimeDuration kIdleICCSliceBudget =
TimeDuration::FromMilliseconds(2);
MOZ_RUNINIT const TimeDuration kMaxICCDuration = TimeDuration::FromSeconds(2);
const TimeDuration kCCForced = kOneMinute * 2; MOZ_RUNINIT const TimeDuration kCCForced = kOneMinute * 2;
const TimeDuration kMaxCCLockedoutTime = TimeDuration::FromSeconds(30); MOZ_RUNINIT const TimeDuration kMaxCCLockedoutTime =
TimeDuration::FromSeconds(30);
} // namespace mozilla } // namespace mozilla
/* /*

View File

@ -14785,7 +14785,7 @@ class PendingFullscreenChangeList {
}; };
/* static */ /* static */
LinkedList<FullscreenChange> PendingFullscreenChangeList::sList; MOZ_RUNINIT LinkedList<FullscreenChange> PendingFullscreenChangeList::sList;
size_t Document::CountFullscreenElements() const { size_t Document::CountFullscreenElements() const {
size_t count = 0; size_t count = 0;

View File

@ -89,7 +89,7 @@ struct ModifierKey final {
mLockable(aLockable) {} mLockable(aLockable) {}
}; };
static const ModifierKey kModifierKeys[] = { MOZ_RUNINIT static const ModifierKey kModifierKeys[] = {
ModifierKey(MODIFIER_ALT, KEY_NAME_INDEX_Alt, false), ModifierKey(MODIFIER_ALT, KEY_NAME_INDEX_Alt, false),
ModifierKey(MODIFIER_ALTGRAPH, KEY_NAME_INDEX_AltGraph, false), ModifierKey(MODIFIER_ALTGRAPH, KEY_NAME_INDEX_AltGraph, false),
ModifierKey(MODIFIER_CONTROL, KEY_NAME_INDEX_Control, false), ModifierKey(MODIFIER_CONTROL, KEY_NAME_INDEX_Control, false),

View File

@ -54,9 +54,10 @@ struct ListenerCollection {
}; };
template <class T> template <class T>
StaticAutoPtr<FlaggedArray<T>> ListenerCollection<T>::gListeners; MOZ_GLOBINIT StaticAutoPtr<FlaggedArray<T>> ListenerCollection<T>::gListeners;
template <class T> template <class T>
StaticAutoPtr<FlaggedArray<T>> ListenerCollection<T>::gListenersToRemove; MOZ_GLOBINIT StaticAutoPtr<FlaggedArray<T>>
ListenerCollection<T>::gListenersToRemove;
using JSListeners = ListenerCollection<RefPtr<PlacesEventCallback>>; using JSListeners = ListenerCollection<RefPtr<PlacesEventCallback>>;
using WeakJSListeners = ListenerCollection<WeakPtr<PlacesWeakCallbackWrapper>>; using WeakJSListeners = ListenerCollection<WeakPtr<PlacesWeakCallbackWrapper>>;
@ -66,7 +67,8 @@ using WeakNativeListeners =
// Even if NotifyListeners is called any timing, we mange the notifications with // Even if NotifyListeners is called any timing, we mange the notifications with
// adding to this queue, then sending in sequence. This avoids sending nested // adding to this queue, then sending in sequence. This avoids sending nested
// notifications while previous ones are still being sent. // notifications while previous ones are still being sent.
static nsTArray<Sequence<OwningNonNull<PlacesEvent>>> gNotificationQueue; MOZ_RUNINIT static nsTArray<Sequence<OwningNonNull<PlacesEvent>>>
gNotificationQueue;
uint32_t GetEventTypeFlag(PlacesEventType aEventType) { uint32_t GetEventTypeFlag(PlacesEventType aEventType) {
if (aEventType == PlacesEventType::None) { if (aEventType == PlacesEventType::None) {

View File

@ -34,10 +34,10 @@ using mozilla::dom::Element;
using mozilla::dom::WindowContext; using mozilla::dom::WindowContext;
// Reference to the pointer locked element. // Reference to the pointer locked element.
static nsWeakPtr sLockedElement; MOZ_RUNINIT static nsWeakPtr sLockedElement;
// Reference to the document which requested pointer lock. // Reference to the document which requested pointer lock.
static nsWeakPtr sLockedDoc; MOZ_RUNINIT static nsWeakPtr sLockedDoc;
// Reference to the BrowserParent requested pointer lock. // Reference to the BrowserParent requested pointer lock.
static BrowserParent* sLockedRemoteTarget = nullptr; static BrowserParent* sLockedRemoteTarget = nullptr;

View File

@ -13,7 +13,7 @@ namespace mozilla {
static TimeStamp gScrollingStartTime; static TimeStamp gScrollingStartTime;
static TimeStamp gScrollingEndTime; static TimeStamp gScrollingEndTime;
static uint32_t gScrollDistanceCSSPixels = 0; static uint32_t gScrollDistanceCSSPixels = 0;
static dom::InteractionData gScrollingInteraction = {}; MOZ_RUNINIT static dom::InteractionData gScrollingInteraction = {};
void ScrollingMetrics::OnScrollingInteractionEnded() { void ScrollingMetrics::OnScrollingInteractionEnded() {
// We are only interested in content process scrolling // We are only interested in content process scrolling

View File

@ -22,7 +22,7 @@ using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::dom::ipc; using namespace mozilla::dom::ipc;
JS::PersistentRooted<JSObject*> global; MOZ_RUNINIT JS::PersistentRooted<JSObject*> global;
static int FuzzingInitDomSC(int* argc, char*** argv) { static int FuzzingInitDomSC(int* argc, char*** argv) {
JSObject* simpleGlobal = JSObject* simpleGlobal =

View File

@ -219,7 +219,7 @@ already_AddRefed<nsIRunnable> NativeInputRunnable::Create(
} // unnamed namespace } // unnamed namespace
LinkedList<OldWindowSize> OldWindowSize::sList; MOZ_RUNINIT LinkedList<OldWindowSize> OldWindowSize::sList;
NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils) NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils)

View File

@ -11,11 +11,12 @@
using namespace mozilla; using namespace mozilla;
static TimeDuration kOneSecond = TimeDuration::FromSeconds(1); MOZ_RUNINIT static TimeDuration kOneSecond = TimeDuration::FromSeconds(1);
static TimeDuration kTenthSecond = TimeDuration::FromSeconds(0.1); MOZ_RUNINIT static TimeDuration kTenthSecond = TimeDuration::FromSeconds(0.1);
static TimeDuration kFrameDuration = TimeDuration::FromSeconds(1.0 / 60.0); MOZ_RUNINIT static TimeDuration kFrameDuration =
TimeDuration::FromSeconds(1.0 / 60.0);
static mozilla::TimeStamp sNow = TimeStamp::Now(); MOZ_RUNINIT static mozilla::TimeStamp sNow = TimeStamp::Now();
static mozilla::TimeStamp AdvanceTime(TimeDuration aDuration) { static mozilla::TimeStamp AdvanceTime(TimeDuration aDuration) {
sNow += aDuration; sNow += aDuration;
@ -328,10 +329,10 @@ static bool BasicScenario(CCGCScheduler& aScheduler, TestGC* aTestGC,
return true; return true;
} }
static CCGCScheduler scheduler; MOZ_RUNINIT static CCGCScheduler scheduler;
static TestGC gc(scheduler); MOZ_RUNINIT static TestGC gc(scheduler);
static TestIdleCC ccIdle(scheduler); MOZ_RUNINIT static TestIdleCC ccIdle(scheduler);
static TestNonIdleCC ccNonIdle(scheduler); MOZ_RUNINIT static TestNonIdleCC ccNonIdle(scheduler);
TEST(TestScheduler, Idle) TEST(TestScheduler, Idle)
{ {

View File

@ -2618,7 +2618,7 @@ class PropertyDefiner:
specType = "const " + specType specType = "const " + specType
arrays = fill( arrays = fill(
""" """
static ${specType} ${name}_specs[] = { MOZ_GLOBINIT static ${specType} ${name}_specs[] = {
${specs} ${specs}
}; };

View File

@ -71,7 +71,7 @@ struct SetDOMProxyInformation {
} }
}; };
SetDOMProxyInformation gSetDOMProxyInformation; MOZ_RUNINIT SetDOMProxyInformation gSetDOMProxyInformation;
static inline void CheckExpandoObject(JSObject* proxy, static inline void CheckExpandoObject(JSObject* proxy,
const JS::Value& expando) { const JS::Value& expando) {

View File

@ -102,7 +102,7 @@ WebGLContextOptions::WebGLContextOptions() {
} }
StaticMutex WebGLContext::sLruMutex; StaticMutex WebGLContext::sLruMutex;
std::list<WebGLContext*> WebGLContext::sLru; MOZ_RUNINIT std::list<WebGLContext*> WebGLContext::sLru;
WebGLContext::LruPosition::LruPosition() { WebGLContext::LruPosition::LruPosition() {
StaticMutexAutoLock lock(sLruMutex); StaticMutexAutoLock lock(sLruMutex);

View File

@ -85,8 +85,9 @@ static inline auto FindPtrOrNull(C& container, const K2& key) {
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
std::map<EffectiveFormat, const CompressedFormatInfo> gCompressedFormatInfoMap; MOZ_RUNINIT std::map<EffectiveFormat, const CompressedFormatInfo>
std::map<EffectiveFormat, FormatInfo> gFormatInfoMap; gCompressedFormatInfoMap;
MOZ_RUNINIT std::map<EffectiveFormat, FormatInfo> gFormatInfoMap;
static inline const CompressedFormatInfo* GetCompressedFormatInfo( static inline const CompressedFormatInfo* GetCompressedFormatInfo(
EffectiveFormat format) { EffectiveFormat format) {

View File

@ -25,7 +25,7 @@
namespace mozilla { namespace mozilla {
namespace webgl { namespace webgl {
/*static*/ const ImageInfo ImageInfo::kUndefined; MOZ_RUNINIT /*static*/ const ImageInfo ImageInfo::kUndefined;
size_t ImageInfo::MemoryUsage() const { size_t ImageInfo::MemoryUsage() const {
if (!IsDefined()) return 0; if (!IsDefined()) return 0;

View File

@ -26,7 +26,7 @@
// Template taken from security/nss/lib/util/templates.c // Template taken from security/nss/lib/util/templates.c
// This (or SGN_EncodeDigestInfo) would ideally be exported // This (or SGN_EncodeDigestInfo) would ideally be exported
// by NSS and until that happens we have to keep our own copy. // by NSS and until that happens we have to keep our own copy.
const SEC_ASN1Template SGN_DigestInfoTemplate[] = { MOZ_GLOBINIT const SEC_ASN1Template SGN_DigestInfoTemplate[] = {
{SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SGNDigestInfo)}, {SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SGNDigestInfo)},
{SEC_ASN1_INLINE, offsetof(SGNDigestInfo, digestAlgorithm), {SEC_ASN1_INLINE, offsetof(SGNDigestInfo, digestAlgorithm),
SEC_ASN1_GET(SECOID_AlgorithmIDTemplate)}, SEC_ASN1_GET(SECOID_AlgorithmIDTemplate)},

View File

@ -142,12 +142,12 @@ static nsITimer* gUserInteractionTimer = nullptr;
static nsITimerCallback* gUserInteractionTimerCallback = nullptr; static nsITimerCallback* gUserInteractionTimerCallback = nullptr;
static const double kCursorLoadingTimeout = 1000; // ms static const double kCursorLoadingTimeout = 1000; // ms
static AutoWeakFrame gLastCursorSourceFrame; MOZ_RUNINIT static AutoWeakFrame gLastCursorSourceFrame;
static TimeStamp gLastCursorUpdateTime; static TimeStamp gLastCursorUpdateTime;
static TimeStamp gTypingStartTime; static TimeStamp gTypingStartTime;
static TimeStamp gTypingEndTime; static TimeStamp gTypingEndTime;
static int32_t gTypingInteractionKeyPresses = 0; static int32_t gTypingInteractionKeyPresses = 0;
static dom::InteractionData gTypingInteraction = {}; MOZ_RUNINIT static dom::InteractionData gTypingInteraction = {};
static inline int32_t RoundDown(double aDouble) { static inline int32_t RoundDown(double aDouble) {
return (aDouble > 0) ? static_cast<int32_t>(floor(aDouble)) return (aDouble > 0) ? static_cast<int32_t>(floor(aDouble))
@ -559,14 +559,14 @@ bool EventStateManager::sNormalLMouseEventInProcess = false;
int16_t EventStateManager::sCurrentMouseBtn = MouseButton::eNotPressed; int16_t EventStateManager::sCurrentMouseBtn = MouseButton::eNotPressed;
EventStateManager* EventStateManager::sActiveESM = nullptr; EventStateManager* EventStateManager::sActiveESM = nullptr;
EventStateManager* EventStateManager::sCursorSettingManager = nullptr; EventStateManager* EventStateManager::sCursorSettingManager = nullptr;
AutoWeakFrame EventStateManager::sLastDragOverFrame = nullptr; MOZ_RUNINIT AutoWeakFrame EventStateManager::sLastDragOverFrame = nullptr;
LayoutDeviceIntPoint EventStateManager::sPreLockScreenPoint = LayoutDeviceIntPoint EventStateManager::sPreLockScreenPoint =
LayoutDeviceIntPoint(0, 0); LayoutDeviceIntPoint(0, 0);
LayoutDeviceIntPoint EventStateManager::sLastRefPoint = kInvalidRefPoint; LayoutDeviceIntPoint EventStateManager::sLastRefPoint = kInvalidRefPoint;
CSSIntPoint EventStateManager::sLastScreenPoint = CSSIntPoint(0, 0); CSSIntPoint EventStateManager::sLastScreenPoint = CSSIntPoint(0, 0);
LayoutDeviceIntPoint EventStateManager::sSynthCenteringPoint = kInvalidRefPoint; LayoutDeviceIntPoint EventStateManager::sSynthCenteringPoint = kInvalidRefPoint;
CSSIntPoint EventStateManager::sLastClientPoint = CSSIntPoint(0, 0); CSSIntPoint EventStateManager::sLastClientPoint = CSSIntPoint(0, 0);
nsCOMPtr<nsIContent> EventStateManager::sDragOverContent = nullptr; MOZ_RUNINIT nsCOMPtr<nsIContent> EventStateManager::sDragOverContent = nullptr;
EventStateManager::WheelPrefs* EventStateManager::WheelPrefs::sInstance = EventStateManager::WheelPrefs* EventStateManager::WheelPrefs::sInstance =
nullptr; nullptr;

View File

@ -79,12 +79,12 @@ nsIWidget* IMEStateManager::sActiveInputContextWidget = nullptr;
StaticRefPtr<IMEContentObserver> IMEStateManager::sActiveIMEContentObserver; StaticRefPtr<IMEContentObserver> IMEStateManager::sActiveIMEContentObserver;
TextCompositionArray* IMEStateManager::sTextCompositions = nullptr; TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
InputContext::Origin IMEStateManager::sOrigin = InputContext::ORIGIN_MAIN; InputContext::Origin IMEStateManager::sOrigin = InputContext::ORIGIN_MAIN;
InputContext IMEStateManager::sActiveChildInputContext; MOZ_RUNINIT InputContext IMEStateManager::sActiveChildInputContext;
bool IMEStateManager::sInstalledMenuKeyboardListener = false; bool IMEStateManager::sInstalledMenuKeyboardListener = false;
bool IMEStateManager::sIsGettingNewIMEState = false; bool IMEStateManager::sIsGettingNewIMEState = false;
bool IMEStateManager::sCleaningUpForStoppingIMEStateManagement = false; bool IMEStateManager::sCleaningUpForStoppingIMEStateManagement = false;
bool IMEStateManager::sIsActive = false; bool IMEStateManager::sIsActive = false;
Maybe<IMEStateManager::PendingFocusedBrowserSwitchingData> MOZ_RUNINIT Maybe<IMEStateManager::PendingFocusedBrowserSwitchingData>
IMEStateManager::sPendingFocusedBrowserSwitchingData; IMEStateManager::sPendingFocusedBrowserSwitchingData;
class PseudoFocusChangeRunnable : public Runnable { class PseudoFocusChangeRunnable : public Runnable {

View File

@ -49,7 +49,8 @@ NS_IMETHODIMP FetchParent::FetchParentCSPEventListener::OnCSPViolationEvent(
return NS_OK; return NS_OK;
} }
nsTHashMap<nsIDHashKey, RefPtr<FetchParent>> FetchParent::sActorTable; MOZ_RUNINIT nsTHashMap<nsIDHashKey, RefPtr<FetchParent>>
FetchParent::sActorTable;
/*static*/ /*static*/
RefPtr<FetchParent> FetchParent::GetActorByID(const nsID& aID) { RefPtr<FetchParent> FetchParent::GetActorByID(const nsID& aID) {

View File

@ -655,7 +655,7 @@ class JSStreamConsumer final : public nsIInputStreamCallback,
NS_IMPL_ISUPPORTS(JSStreamConsumer, nsIInputStreamCallback) NS_IMPL_ISUPPORTS(JSStreamConsumer, nsIInputStreamCallback)
// static // static
const nsCString FetchUtil::WasmAltDataType; MOZ_RUNINIT const nsCString FetchUtil::WasmAltDataType;
// static // static
void FetchUtil::InitWasmAltDataType() { void FetchUtil::InitWasmAltDataType() {

View File

@ -111,7 +111,7 @@ class TestFileSystemOriginInitialization : public FileSystemParentTest {
FileSystemQuotaClientFactory::SetCustomFactory(nullptr); FileSystemQuotaClientFactory::SetCustomFactory(nullptr);
} }
static inline RefPtr<MockFileSystemQuotaClient> sQuotaClient; MOZ_RUNINIT static inline RefPtr<MockFileSystemQuotaClient> sQuotaClient;
}; };
TEST_F(TestFileSystemOriginInitialization, EmptyOriginDirectory) { TEST_F(TestFileSystemOriginInitialization, EmptyOriginDirectory) {

View File

@ -100,7 +100,7 @@ class WindowsGamepadService;
// it will be created and destroyed by background thread and // it will be created and destroyed by background thread and
// used by gMonitorThread // used by gMonitorThread
WindowsGamepadService* MOZ_NON_OWNING_REF gService = nullptr; WindowsGamepadService* MOZ_NON_OWNING_REF gService = nullptr;
nsCOMPtr<nsIThread> gMonitorThread = nullptr; MOZ_RUNINIT nsCOMPtr<nsIThread> gMonitorThread = nullptr;
static bool sIsShutdown = false; static bool sIsShutdown = false;
class Gamepad { class Gamepad {

View File

@ -255,7 +255,8 @@ class RequestingAccessKeyEventData {
static int32_t sBrowserParentCount; static int32_t sBrowserParentCount;
}; };
int32_t RequestingAccessKeyEventData::sBrowserParentCount = 0; int32_t RequestingAccessKeyEventData::sBrowserParentCount = 0;
Maybe<RequestingAccessKeyEventData::Data> RequestingAccessKeyEventData::sData; MOZ_RUNINIT Maybe<RequestingAccessKeyEventData::Data>
RequestingAccessKeyEventData::sData;
namespace dom { namespace dom {

View File

@ -369,7 +369,8 @@ namespace dom {
LazyLogModule gProcessLog("Process"); LazyLogModule gProcessLog("Process");
static std::map<RemoteDecodeIn, media::MediaCodecsSupported> sCodecsSupported; MOZ_RUNINIT static std::map<RemoteDecodeIn, media::MediaCodecsSupported>
sCodecsSupported;
/* static */ /* static */
uint32_t ContentParent::sMaxContentProcesses = 0; uint32_t ContentParent::sMaxContentProcesses = 0;

View File

@ -2802,7 +2802,7 @@ using PrivateDatastoreHashtable =
// event of an (unlikely) race where the private browsing windows are still // event of an (unlikely) race where the private browsing windows are still
// being torn down, will cause the Datastore to be discarded when the last // being torn down, will cause the Datastore to be discarded when the last
// window actually goes away. // window actually goes away.
UniquePtr<PrivateDatastoreHashtable> gPrivateDatastores; MOZ_RUNINIT UniquePtr<PrivateDatastoreHashtable> gPrivateDatastores;
using DatabaseArray = nsTArray<Database*>; using DatabaseArray = nsTArray<Database*>;

View File

@ -121,7 +121,7 @@ int sInCommunicationCount = 0;
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties"; const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
std::unordered_map<std::string, LABELS_MEDIA_AUDIO_BACKEND> MOZ_RUNINIT std::unordered_map<std::string, LABELS_MEDIA_AUDIO_BACKEND>
kTelemetryBackendLabel = { kTelemetryBackendLabel = {
{"audiounit", LABELS_MEDIA_AUDIO_BACKEND::audiounit}, {"audiounit", LABELS_MEDIA_AUDIO_BACKEND::audiounit},
{"audiounit-rust", LABELS_MEDIA_AUDIO_BACKEND::audiounit_rust}, {"audiounit-rust", LABELS_MEDIA_AUDIO_BACKEND::audiounit_rust},

View File

@ -130,7 +130,7 @@ class ProcessCrashMonitor final {
} }
static inline StaticMutex sMutex; static inline StaticMutex sMutex;
static inline UniquePtr<ProcessCrashMonitor> sCrashMonitor; static inline MOZ_RUNINIT UniquePtr<ProcessCrashMonitor> sCrashMonitor;
static inline Atomic<bool> sIsShutdown{false}; static inline Atomic<bool> sIsShutdown{false};
uint32_t mCrashNums; uint32_t mCrashNums;

View File

@ -12,7 +12,7 @@ using namespace mozilla;
using TracingPhase = mozilla::AsyncLogger::TracingPhase; using TracingPhase = mozilla::AsyncLogger::TracingPhase;
mozilla::AsyncLogger gAudioCallbackTraceLogger; MOZ_RUNINIT mozilla::AsyncLogger gAudioCallbackTraceLogger;
static std::atomic<int> gTracingStarted(0); static std::atomic<int> gTracingStarted(0);
void StartAudioCallbackTracing() { void StartAudioCallbackTracing() {

View File

@ -19,7 +19,7 @@ struct B64Test {
bool shouldPass; bool shouldPass;
}; };
const B64Test tests[] = { MOZ_RUNINIT const B64Test tests[] = {
{"AAAAADk4AU4AAAAAAAAAAA", {"AAAAADk4AU4AAAAAAAAAAA",
{0x0, 0x0, 0x0, 0x0, 0x39, 0x38, 0x1, 0x4e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x39, 0x38, 0x1, 0x4e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0}, 0x0, 0x0},

View File

@ -175,7 +175,7 @@ bool ChromiumCDMAdapter::Supports(int32_t aModuleVersion,
#ifdef XP_WIN #ifdef XP_WIN
static WindowsDllInterceptor sKernel32Intercept; MOZ_RUNINIT static WindowsDllInterceptor sKernel32Intercept;
typedef DWORD(WINAPI* QueryDosDeviceWFnPtr)(_In_opt_ LPCWSTR lpDeviceName, typedef DWORD(WINAPI* QueryDosDeviceWFnPtr)(_In_opt_ LPCWSTR lpDeviceName,
_Out_ LPWSTR lpTargetPath, _Out_ LPWSTR lpTargetPath,

View File

@ -40,12 +40,12 @@ using namespace mozilla;
static gfx::IntSize kImageSize(WIDTH, HEIGHT); static gfx::IntSize kImageSize(WIDTH, HEIGHT);
// Set codec to avc1.42001E - Base profile, constraint 0, level 30. // Set codec to avc1.42001E - Base profile, constraint 0, level 30.
const H264Specific kH264SpecificAnnexB(H264_PROFILE_BASE, MOZ_RUNINIT const H264Specific kH264SpecificAnnexB(H264_PROFILE_BASE,
H264_LEVEL::H264_LEVEL_3, H264_LEVEL::H264_LEVEL_3,
H264BitStreamFormat::ANNEXB); H264BitStreamFormat::ANNEXB);
const H264Specific kH264SpecificAVCC(H264_PROFILE_BASE, MOZ_RUNINIT const H264Specific kH264SpecificAVCC(H264_PROFILE_BASE,
H264_LEVEL::H264_LEVEL_3, H264_LEVEL::H264_LEVEL_3,
H264BitStreamFormat::AVC); H264BitStreamFormat::AVC);
class MediaDataEncoderTest : public testing::Test { class MediaDataEncoderTest : public testing::Test {
protected: protected:

View File

@ -90,11 +90,12 @@ DEFINE_PROPERTYKEY(EME_CONTENTDECRYPTIONMODULE_ORIGIN_ID, 0x1218a3e2, 0xcfb0,
} while (false) } while (false)
StaticMutex sFactoryMutex; StaticMutex sFactoryMutex;
static nsTHashMap<nsStringHashKey, ComPtr<IMFContentDecryptionModuleFactory>> MOZ_RUNINIT static nsTHashMap<nsStringHashKey,
ComPtr<IMFContentDecryptionModuleFactory>>
sFactoryMap; sFactoryMap;
static CopyableTArray<MFCDMCapabilitiesIPDL> sCapabilities; MOZ_RUNINIT static CopyableTArray<MFCDMCapabilitiesIPDL> sCapabilities;
StaticMutex sCapabilitesMutex; StaticMutex sCapabilitesMutex;
static ComPtr<IUnknown> sMediaEngineClassFactory; MOZ_RUNINIT static ComPtr<IUnknown> sMediaEngineClassFactory;
// RAIIized PROPVARIANT. See // RAIIized PROPVARIANT. See
// third_party/libwebrtc/modules/audio_device/win/core_audio_utility_win.h // third_party/libwebrtc/modules/audio_device/win/core_audio_utility_win.h

View File

@ -133,7 +133,8 @@ class MFCDMParent final : public PMFCDMParent {
const RefPtr<RemoteDecoderManagerParent> mManager; const RefPtr<RemoteDecoderManagerParent> mManager;
const RefPtr<nsISerialEventTarget> mManagerThread; const RefPtr<nsISerialEventTarget> mManagerThread;
static inline nsTHashMap<nsUint64HashKey, MFCDMParent*> sRegisteredCDMs; MOZ_RUNINIT static inline nsTHashMap<nsUint64HashKey, MFCDMParent*>
sRegisteredCDMs;
static inline uint64_t sNextId = 1; static inline uint64_t sNextId = 1;
const uint64_t mId; const uint64_t mId;

View File

@ -57,7 +57,7 @@ static EnumeratedArray<RemoteDecodeIn, StaticRefPtr<GenericNonExclusivePromise>,
// Only modified on the main-thread, read on any thread. While it could be read // Only modified on the main-thread, read on any thread. While it could be read
// on the main thread directly, for clarity we force access via the DataMutex // on the main thread directly, for clarity we force access via the DataMutex
// wrapper. // wrapper.
static StaticDataMutex<StaticRefPtr<nsIThread>> MOZ_RUNINIT static StaticDataMutex<StaticRefPtr<nsIThread>>
sRemoteDecoderManagerChildThread("sRemoteDecoderManagerChildThread"); sRemoteDecoderManagerChildThread("sRemoteDecoderManagerChildThread");
// Only accessed from sRemoteDecoderManagerChildThread // Only accessed from sRemoteDecoderManagerChildThread
@ -70,11 +70,9 @@ static StaticAutoPtr<nsTArray<RefPtr<Runnable>>> sRecreateTasks;
// Used for protecting codec support information collected from different remote // Used for protecting codec support information collected from different remote
// processes. // processes.
StaticMutex sProcessSupportedMutex; StaticMutex sProcessSupportedMutex;
#ifndef MOZ_DEBUG MOZ_GLOBINIT static EnumeratedArray<RemoteDecodeIn,
MOZ_CONSTINIT Maybe<media::MediaCodecsSupported>,
#endif size_t(RemoteDecodeIn::SENTINEL)>
static EnumeratedArray<RemoteDecodeIn, Maybe<media::MediaCodecsSupported>,
size_t(RemoteDecodeIn::SENTINEL)>
sProcessSupported MOZ_GUARDED_BY(sProcessSupportedMutex); sProcessSupported MOZ_GUARDED_BY(sProcessSupportedMutex);
class ShutdownObserver final : public nsIObserver { class ShutdownObserver final : public nsIObserver {

View File

@ -20,97 +20,98 @@ struct CurrentPlaybackPositionFixture {
class CurrentPlaybackPositionTest class CurrentPlaybackPositionTest
: public testing::TestWithParam<CurrentPlaybackPositionFixture> {}; : public testing::TestWithParam<CurrentPlaybackPositionFixture> {};
static const std::initializer_list<CurrentPlaybackPositionFixture> kFixtures = { MOZ_RUNINIT static const std::initializer_list<CurrentPlaybackPositionFixture>
// position must be positive kFixtures = {
{ // position must be positive
10.0, {
1.0, 10.0,
0.0, 1.0,
TimeDuration::FromSeconds(-1.0), 0.0,
0.0, TimeDuration::FromSeconds(-1.0),
}, 0.0,
// no time elapsed },
{ // no time elapsed
10.0, {
1.0, 10.0,
0.0, 1.0,
TimeDuration::FromSeconds(0.0), 0.0,
0.0, TimeDuration::FromSeconds(0.0),
}, 0.0,
{ },
10.0, {
1.0, 10.0,
0.0, 1.0,
TimeDuration::FromSeconds(3.0), 0.0,
3.0, TimeDuration::FromSeconds(3.0),
}, 3.0,
{ },
10.0, {
1.0, 10.0,
0.0, 1.0,
TimeDuration::FromSeconds(10.0), 0.0,
10.0, TimeDuration::FromSeconds(10.0),
}, 10.0,
// position is clamped to the duration },
{ // position is clamped to the duration
10.0, {
1.0, 10.0,
0.0, 1.0,
TimeDuration::FromSeconds(20.0), 0.0,
10.0, TimeDuration::FromSeconds(20.0),
}, 10.0,
{ },
10.0, {
1.0, 10.0,
5.0, 1.0,
TimeDuration::FromSeconds(-1.0), 5.0,
4.0, TimeDuration::FromSeconds(-1.0),
}, 4.0,
{ },
10.0, {
1.0, 10.0,
5.0, 1.0,
TimeDuration::FromSeconds(-6.0), 5.0,
0.0, TimeDuration::FromSeconds(-6.0),
}, 0.0,
{ },
10.0, {
1.0, 10.0,
5.0, 1.0,
TimeDuration::FromSeconds(6.0), 5.0,
10.0, TimeDuration::FromSeconds(6.0),
}, 10.0,
// expected: 5s + 2 * 2s },
{ // expected: 5s + 2 * 2s
10.0, {
2.0, 10.0,
5.0, 2.0,
TimeDuration::FromSeconds(2.0), 5.0,
9.0, TimeDuration::FromSeconds(2.0),
}, 9.0,
// expected: 5s + 0.5 * 2s },
{ // expected: 5s + 0.5 * 2s
10.0, {
0.5, 10.0,
5.0, 0.5,
TimeDuration::FromSeconds(2.0), 5.0,
6.0, TimeDuration::FromSeconds(2.0),
}, 6.0,
{ },
5.0, {
4.0, 5.0,
10.0, 4.0,
TimeDuration::FromSeconds(20.0), 10.0,
5.0, TimeDuration::FromSeconds(20.0),
}, 5.0,
// empty media (0s) },
{ // empty media (0s)
0.0, {
4.0, 0.0,
5.0, 4.0,
TimeDuration::FromSeconds(20.0), 5.0,
0.0, TimeDuration::FromSeconds(20.0),
}, 0.0,
},
}; };
TEST_P(CurrentPlaybackPositionTest, Run) { TEST_P(CurrentPlaybackPositionTest, Run) {

View File

@ -88,7 +88,8 @@ typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
namespace mozilla { namespace mozilla {
#ifdef MOZ_USE_HWDECODE #ifdef MOZ_USE_HWDECODE
nsTArray<AVCodecID> FFmpegVideoDecoder<LIBAV_VER>::mAcceleratedFormats; MOZ_RUNINIT nsTArray<AVCodecID>
FFmpegVideoDecoder<LIBAV_VER>::mAcceleratedFormats;
#endif #endif
using media::TimeUnit; using media::TimeUnit;

View File

@ -139,7 +139,7 @@ class MediaFoundationInitializer final {
// WMF from threads with the same COM compartment model. // WMF from threads with the same COM compartment model.
HRESULT MFShutdown(); HRESULT MFShutdown();
static inline UniquePtr<MediaFoundationInitializer> sInitializer; MOZ_RUNINIT static inline UniquePtr<MediaFoundationInitializer> sInitializer;
static inline StaticMutex sCreateMutex; static inline StaticMutex sCreateMutex;
static inline Atomic<bool> sIsShutdown{false}; static inline Atomic<bool> sIsShutdown{false};
const bool mHasInitialized; const bool mHasInitialized;

View File

@ -61,8 +61,9 @@ namespace mozilla {
using media::ShutdownBlockingTicket; using media::ShutdownBlockingTicket;
namespace camera { namespace camera {
std::map<uint32_t, const char*> sDeviceUniqueIDs; MOZ_RUNINIT std::map<uint32_t, const char*> sDeviceUniqueIDs;
std::map<uint32_t, webrtc::VideoCaptureCapability> sAllRequestedCapabilities; MOZ_RUNINIT std::map<uint32_t, webrtc::VideoCaptureCapability>
sAllRequestedCapabilities;
uint32_t ResolutionFeasibilityDistance(int32_t candidate, int32_t requested) { uint32_t ResolutionFeasibilityDistance(int32_t candidate, int32_t requested) {
// The purpose of this function is to find a smallest resolution // The purpose of this function is to find a smallest resolution

View File

@ -27,7 +27,7 @@ using namespace mozilla;
using namespace webrtc; using namespace webrtc;
using namespace videocapturemodule; using namespace videocapturemodule;
static NSArray* camera_presets = @[ MOZ_RUNINIT static NSArray* camera_presets = @[
AVCaptureSessionPreset352x288, AVCaptureSessionPreset640x480, AVCaptureSessionPreset352x288, AVCaptureSessionPreset640x480,
AVCaptureSessionPreset1280x720 AVCaptureSessionPreset1280x720
]; ];

View File

@ -4846,6 +4846,6 @@ std::unique_ptr<NrSocketProxyConfig> PeerConnectionImpl::GetProxyConfig()
net::WebrtcProxyConfig(id, alpn, loadInfoArgs, mForceProxy))); net::WebrtcProxyConfig(id, alpn, loadInfoArgs, mForceProxy)));
} }
std::map<uint64_t, PeerConnectionAutoTimer> MOZ_RUNINIT std::map<uint64_t, PeerConnectionAutoTimer>
PeerConnectionImpl::sCallDurationTimers; PeerConnectionImpl::sCallDurationTimers;
} // namespace mozilla } // namespace mozilla

View File

@ -67,7 +67,8 @@ class WebrtcContentParents {
static std::vector<RefPtr<WebrtcGlobalParent>> sContentParents; static std::vector<RefPtr<WebrtcGlobalParent>> sContentParents;
}; };
std::vector<RefPtr<WebrtcGlobalParent>> WebrtcContentParents::sContentParents; MOZ_RUNINIT std::vector<RefPtr<WebrtcGlobalParent>>
WebrtcContentParents::sContentParents;
WebrtcGlobalParent* WebrtcContentParents::Alloc() { WebrtcGlobalParent* WebrtcContentParents::Alloc() {
RefPtr<WebrtcGlobalParent> cp = new WebrtcGlobalParent; RefPtr<WebrtcGlobalParent> cp = new WebrtcGlobalParent;
@ -533,7 +534,7 @@ void WebrtcGlobalInformation::GetLogging(
} }
static bool sLastAECDebug = false; static bool sLastAECDebug = false;
static Maybe<nsCString> sAecDebugLogDir; MOZ_RUNINIT static Maybe<nsCString> sAecDebugLogDir;
void WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal, void WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal,
bool aEnable) { bool aEnable) {

View File

@ -17,7 +17,7 @@
namespace mozilla { namespace mozilla {
const std::string RsdparsaSdpAttributeList::kEmptyString = ""; MOZ_RUNINIT const std::string RsdparsaSdpAttributeList::kEmptyString = "";
RsdparsaSdpAttributeList::~RsdparsaSdpAttributeList() { RsdparsaSdpAttributeList::~RsdparsaSdpAttributeList() {
for (size_t i = 0; i < kNumAttributeTypes; ++i) { for (size_t i = 0; i < kNumAttributeTypes; ++i) {

View File

@ -18,7 +18,7 @@ namespace mozilla {
using InternalResults = SdpParser::InternalResults; using InternalResults = SdpParser::InternalResults;
/* static */ /* static */
const std::string SipccSdpAttributeList::kEmptyString = ""; MOZ_RUNINIT const std::string SipccSdpAttributeList::kEmptyString = "";
SipccSdpAttributeList::SipccSdpAttributeList( SipccSdpAttributeList::SipccSdpAttributeList(
const SipccSdpAttributeList* sessionLevel) const SipccSdpAttributeList* sessionLevel)

View File

@ -14,8 +14,8 @@
using namespace mozilla; using namespace mozilla;
static mozilla::UniquePtr<SdpParser::Results> sdpPtr; MOZ_RUNINIT static mozilla::UniquePtr<SdpParser::Results> sdpPtr;
static SipccSdpParser mParser; MOZ_RUNINIT static SipccSdpParser mParser;
int FuzzingInitSdpParser(int* argc, char*** argv) { return 0; } int FuzzingInitSdpParser(int* argc, char*** argv) { return 0; }

View File

@ -61,14 +61,14 @@ static unsigned int kDefaultTimeout = 7000;
// TODO: It would be nice to have a test STUN/TURN server that can run with // TODO: It would be nice to have a test STUN/TURN server that can run with
// gtest. // gtest.
const std::string kDefaultStunServerHostname((char*)""); MOZ_RUNINIT const std::string kDefaultStunServerHostname((char*)"");
const std::string kBogusStunServerHostname( MOZ_RUNINIT const std::string kBogusStunServerHostname(
(char*)"stun-server-nonexistent.invalid"); (char*)"stun-server-nonexistent.invalid");
const uint16_t kDefaultStunServerPort = 19305; const uint16_t kDefaultStunServerPort = 19305;
const std::string kBogusIceCandidate( MOZ_RUNINIT const std::string kBogusIceCandidate(
(char*)"candidate:0 2 UDP 2113601790 192.168.178.20 50769 typ"); (char*)"candidate:0 2 UDP 2113601790 192.168.178.20 50769 typ");
const std::string kUnreachableHostIceCandidate( MOZ_RUNINIT const std::string kUnreachableHostIceCandidate(
(char*)"candidate:0 1 UDP 2113601790 192.168.178.20 50769 typ host"); (char*)"candidate:0 1 UDP 2113601790 192.168.178.20 50769 typ host");
namespace { namespace {

View File

@ -19,7 +19,8 @@
using namespace mozilla; using namespace mozilla;
// update TestReadMultipleSizes if you change this // update TestReadMultipleSizes if you change this
const std::string kHelloMessage = "HELLO IS IT ME YOU'RE LOOKING FOR?"; MOZ_RUNINIT const std::string kHelloMessage =
"HELLO IS IT ME YOU'RE LOOKING FOR?";
class NrTcpSocketTest : public MtransportTest { class NrTcpSocketTest : public MtransportTest {
public: public:

View File

@ -66,7 +66,7 @@ extern "C" {
using namespace mozilla; using namespace mozilla;
static std::string kDummyTurnServer("192.0.2.1"); // From RFC 5737 MOZ_RUNINIT static std::string kDummyTurnServer("192.0.2.1"); // From RFC 5737
class TurnClient : public MtransportTest { class TurnClient : public MtransportTest {
public: public:

View File

@ -19,7 +19,7 @@
static const uint32_t kDefaultTestTimeout = 2000; static const uint32_t kDefaultTestTimeout = 2000;
static const char kReadData[] = "Hello, World!"; static const char kReadData[] = "Hello, World!";
static const size_t kReadDataLength = sizeof(kReadData) - 1; static const size_t kReadDataLength = sizeof(kReadData) - 1;
static const std::string kReadDataString = MOZ_RUNINIT static const std::string kReadDataString =
std::string(kReadData, kReadDataLength); std::string(kReadData, kReadDataLength);
static int kDataLargeOuterLoopCount = 128; static int kDataLargeOuterLoopCount = 128;
static int kDataLargeInnerLoopCount = 1024; static int kDataLargeInnerLoopCount = 1024;

View File

@ -54,7 +54,8 @@ class SendRunnable : public MIDIBackgroundRunnable {
StaticMutex midirMIDIPlatformService::gOwnerThreadMutex; StaticMutex midirMIDIPlatformService::gOwnerThreadMutex;
// static // static
nsCOMPtr<nsISerialEventTarget> midirMIDIPlatformService::gOwnerThread; MOZ_RUNINIT nsCOMPtr<nsISerialEventTarget>
midirMIDIPlatformService::gOwnerThread;
midirMIDIPlatformService::midirMIDIPlatformService() midirMIDIPlatformService::midirMIDIPlatformService()
: mImplementation(nullptr) { : mImplementation(nullptr) {

View File

@ -159,7 +159,7 @@ void PromiseDebugging::GetFullfillmentStack(GlobalObject& aGlobal,
} }
/*static */ /*static */
nsString PromiseDebugging::sIDPrefix; MOZ_RUNINIT nsString PromiseDebugging::sIDPrefix;
/* static */ /* static */
void PromiseDebugging::Init() { void PromiseDebugging::Init() {

View File

@ -423,6 +423,7 @@ void QuotaManagerDependencyFixture::EnsureQuotaManager() {
[&resolver]() { return resolver->IsDone(); }); [&resolver]() { return resolver->IsDone(); });
} }
nsCOMPtr<nsISerialEventTarget> QuotaManagerDependencyFixture::sBackgroundTarget; MOZ_RUNINIT nsCOMPtr<nsISerialEventTarget>
QuotaManagerDependencyFixture::sBackgroundTarget;
} // namespace mozilla::dom::quota::test } // namespace mozilla::dom::quota::test

View File

@ -266,7 +266,8 @@ class DOM_Quota_EncryptedStream : public ::testing::Test {
struct NSSInitContextDeleter { struct NSSInitContextDeleter {
void operator()(NSSInitContext* p) { NSS_ShutdownContext(p); } void operator()(NSSInitContext* p) { NSS_ShutdownContext(p); }
}; };
inline static std::unique_ptr<NSSInitContext, NSSInitContextDeleter> MOZ_RUNINIT inline static std::unique_ptr<NSSInitContext,
NSSInitContextDeleter>
sNssContext; sNssContext;
}; };

View File

@ -183,7 +183,8 @@ class TestStorageConnection : public QuotaManagerDependencyFixture {
struct NSSInitContextDeleter { struct NSSInitContextDeleter {
void operator()(NSSInitContext* p) { NSS_ShutdownContext(p); } void operator()(NSSInitContext* p) { NSS_ShutdownContext(p); }
}; };
inline static std::unique_ptr<NSSInitContext, NSSInitContextDeleter> MOZ_RUNINIT inline static std::unique_ptr<NSSInitContext,
NSSInitContextDeleter>
sNssContext; sNssContext;
}; };

View File

@ -15,8 +15,8 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
static nsCOMPtr<nsIPrincipal> selfURIPrincipal; MOZ_RUNINIT static nsCOMPtr<nsIPrincipal> selfURIPrincipal;
static nsCOMPtr<nsIURI> selfURI; MOZ_RUNINIT static nsCOMPtr<nsIURI> selfURI;
static int LVVMFuzzerInitTest(int* argc, char*** argv) { static int LVVMFuzzerInitTest(int* argc, char*** argv) {
nsresult ret; nsresult ret;

View File

@ -138,8 +138,8 @@ nsresult CreatePrincipalInfo(nsILineInputStream* aStream,
return NS_OK; return NS_OK;
} }
const IPCNavigationPreloadState gDefaultNavigationPreloadState(false, MOZ_RUNINIT const IPCNavigationPreloadState
"true"_ns); gDefaultNavigationPreloadState(false, "true"_ns);
} // namespace } // namespace

View File

@ -13,8 +13,8 @@
namespace mozilla::dom { namespace mozilla::dom {
static SVGAttrTearoffTable<SVGAnimatedTransformList, MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedTransformList,
DOMSVGAnimatedTransformList> DOMSVGAnimatedTransformList>
sSVGAnimatedTransformListTearoffTable; sSVGAnimatedTransformListTearoffTable;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedTransformList, NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedTransformList,

View File

@ -22,7 +22,7 @@
namespace mozilla::dom { namespace mozilla::dom {
static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGLength> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGLength>
sBaseSVGLengthTearOffTable, sAnimSVGLengthTearOffTable; sBaseSVGLengthTearOffTable, sAnimSVGLengthTearOffTable;
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to // We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to

View File

@ -37,7 +37,8 @@ class MOZ_RAII AutoChangePointNotifier {
DOMSVGPoint* const mValue; DOMSVGPoint* const mValue;
}; };
static SVGAttrTearoffTable<SVGPoint, DOMSVGPoint> sSVGTranslateTearOffTable; MOZ_CONSTINIT static SVGAttrTearoffTable<SVGPoint, DOMSVGPoint>
sSVGTranslateTearOffTable;
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to // We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
// clear our list's weak ref to us to be safe. (The other option would be to // clear our list's weak ref to us to be safe. (The other option would be to

View File

@ -11,7 +11,8 @@
namespace mozilla { namespace mozilla {
static SVGAttrTearoffTable<SVGAnimatedClassOrString, dom::DOMSVGAnimatedString> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedClassOrString,
dom::DOMSVGAnimatedString>
sSVGAnimatedClassOrStringTearoffTable; sSVGAnimatedClassOrStringTearoffTable;
already_AddRefed<dom::DOMSVGAnimatedString> already_AddRefed<dom::DOMSVGAnimatedString>

View File

@ -44,8 +44,8 @@ class MOZ_RAII AutoChangeEnumNotifier {
bool mDoSetAttr; bool mDoSetAttr;
}; };
static SVGAttrTearoffTable<SVGAnimatedEnumeration, MOZ_CONSTINIT static SVGAttrTearoffTable<
SVGAnimatedEnumeration::DOMAnimatedEnum> SVGAnimatedEnumeration, SVGAnimatedEnumeration::DOMAnimatedEnum>
sSVGAnimatedEnumTearoffTable; sSVGAnimatedEnumTearoffTable;
const SVGEnumMapping* SVGAnimatedEnumeration::GetMapping( const SVGEnumMapping* SVGAnimatedEnumeration::GetMapping(

View File

@ -45,8 +45,8 @@ class MOZ_RAII AutoChangeIntegerNotifier {
bool mDoSetAttr; bool mDoSetAttr;
}; };
static SVGAttrTearoffTable<SVGAnimatedInteger, MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedInteger,
SVGAnimatedInteger::DOMAnimatedInteger> SVGAnimatedInteger::DOMAnimatedInteger>
sSVGAnimatedIntegerTearoffTable; sSVGAnimatedIntegerTearoffTable;
nsresult SVGAnimatedInteger::SetBaseValueString(const nsAString& aValueAsString, nsresult SVGAnimatedInteger::SetBaseValueString(const nsAString& aValueAsString,

View File

@ -58,11 +58,11 @@ class MOZ_RAII AutoChangeIntegerPairNotifier {
bool mDoSetAttr; bool mDoSetAttr;
}; };
static SVGAttrTearoffTable<SVGAnimatedIntegerPair, MOZ_CONSTINIT static SVGAttrTearoffTable<
SVGAnimatedIntegerPair::DOMAnimatedInteger> SVGAnimatedIntegerPair, SVGAnimatedIntegerPair::DOMAnimatedInteger>
sSVGFirstAnimatedIntegerTearoffTable; sSVGFirstAnimatedIntegerTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedIntegerPair, MOZ_CONSTINIT static SVGAttrTearoffTable<
SVGAnimatedIntegerPair::DOMAnimatedInteger> SVGAnimatedIntegerPair, SVGAnimatedIntegerPair::DOMAnimatedInteger>
sSVGSecondAnimatedIntegerTearoffTable; sSVGSecondAnimatedIntegerTearoffTable;
/* Implementation */ /* Implementation */

View File

@ -68,7 +68,8 @@ class MOZ_RAII AutoChangeLengthNotifier {
bool mDoSetAttr; bool mDoSetAttr;
}; };
static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGAnimatedLength> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedLength,
DOMSVGAnimatedLength>
sSVGAnimatedLengthTearoffTable; sSVGAnimatedLengthTearoffTable;
/* Helper functions */ /* Helper functions */

View File

@ -42,8 +42,8 @@ class MOZ_RAII AutoChangeNumberNotifier {
SVGElement* const mSVGElement; SVGElement* const mSVGElement;
}; };
static SVGAttrTearoffTable<SVGAnimatedNumber, MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedNumber,
SVGAnimatedNumber::DOMAnimatedNumber> SVGAnimatedNumber::DOMAnimatedNumber>
sSVGAnimatedNumberTearoffTable; sSVGAnimatedNumberTearoffTable;
static bool GetValueFromString(const nsAString& aString, static bool GetValueFromString(const nsAString& aString,

View File

@ -54,11 +54,11 @@ class MOZ_RAII AutoChangeNumberPairNotifier {
bool mDoSetAttr; bool mDoSetAttr;
}; };
static SVGAttrTearoffTable<SVGAnimatedNumberPair, MOZ_CONSTINIT static SVGAttrTearoffTable<
SVGAnimatedNumberPair::DOMAnimatedNumber> SVGAnimatedNumberPair, SVGAnimatedNumberPair::DOMAnimatedNumber>
sSVGFirstAnimatedNumberTearoffTable; sSVGFirstAnimatedNumberTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedNumberPair, MOZ_CONSTINIT static SVGAttrTearoffTable<
SVGAnimatedNumberPair::DOMAnimatedNumber> SVGAnimatedNumberPair, SVGAnimatedNumberPair::DOMAnimatedNumber>
sSVGSecondAnimatedNumberTearoffTable; sSVGSecondAnimatedNumberTearoffTable;
static nsresult ParseNumberOptionalNumber(const nsAString& aValue, static nsresult ParseNumberOptionalNumber(const nsAString& aValue,

View File

@ -27,13 +27,14 @@ using namespace mozilla::dom::SVGMarkerElement_Binding;
namespace mozilla { namespace mozilla {
static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAnimatedEnumeration> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedOrient,
DOMSVGAnimatedEnumeration>
sSVGAnimatedEnumTearoffTable; sSVGAnimatedEnumTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAnimatedAngle> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAnimatedAngle>
sSVGAnimatedAngleTearoffTable; sSVGAnimatedAngleTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAngle> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAngle>
sBaseSVGAngleTearoffTable; sBaseSVGAngleTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAngle> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAngle>
sAnimSVGAngleTearoffTable; sAnimSVGAngleTearoffTable;
/* Helper functions */ /* Helper functions */

View File

@ -70,14 +70,14 @@ class MOZ_RAII AutoChangePreserveAspectRatioNotifier {
bool mDoSetAttr; bool mDoSetAttr;
}; };
static SVGAttrTearoffTable<SVGAnimatedPreserveAspectRatio, MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedPreserveAspectRatio,
DOMSVGAnimatedPreserveAspectRatio> DOMSVGAnimatedPreserveAspectRatio>
sSVGAnimatedPAspectRatioTearoffTable; sSVGAnimatedPAspectRatioTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedPreserveAspectRatio, MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedPreserveAspectRatio,
DOMSVGPreserveAspectRatio> DOMSVGPreserveAspectRatio>
sBaseSVGPAspectRatioTearoffTable; sBaseSVGPAspectRatioTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedPreserveAspectRatio, MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedPreserveAspectRatio,
DOMSVGPreserveAspectRatio> DOMSVGPreserveAspectRatio>
sAnimSVGPAspectRatioTearoffTable; sAnimSVGPAspectRatioTearoffTable;
already_AddRefed<DOMSVGPreserveAspectRatio> already_AddRefed<DOMSVGPreserveAspectRatio>

View File

@ -66,11 +66,11 @@ nsresult SVGViewBox::FromString(const nsAString& aStr, SVGViewBox* aViewBox) {
return NS_OK; return NS_OK;
} }
static SVGAttrTearoffTable<SVGAnimatedViewBox, SVGRect> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedViewBox, SVGRect>
sBaseSVGViewBoxTearoffTable; sBaseSVGViewBoxTearoffTable;
static SVGAttrTearoffTable<SVGAnimatedViewBox, SVGRect> MOZ_CONSTINIT static SVGAttrTearoffTable<SVGAnimatedViewBox, SVGRect>
sAnimSVGViewBoxTearoffTable; sAnimSVGViewBoxTearoffTable;
SVGAttrTearoffTable<SVGAnimatedViewBox, SVGAnimatedRect> MOZ_CONSTINIT SVGAttrTearoffTable<SVGAnimatedViewBox, SVGAnimatedRect>
SVGAnimatedViewBox::sSVGAnimatedRectTearoffTable; SVGAnimatedViewBox::sSVGAnimatedRectTearoffTable;
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -301,7 +301,7 @@ static void AssertParentProcessWithCallerLocation(GlobalObject& aGlobal) {
// IOUtils implementation // IOUtils implementation
/* static */ /* static */
IOUtils::StateMutex IOUtils::sState{"IOUtils::sState"}; MOZ_RUNINIT IOUtils::StateMutex IOUtils::sState{"IOUtils::sState"};
/* static */ /* static */
template <typename Fn> template <typename Fn>

View File

@ -90,8 +90,8 @@ nsresult PathUtils::InitFileWithPath(nsIFile* aFile, const nsAString& aPath) {
return aFile->InitWithPath(aPath); return aFile->InitWithPath(aPath);
} }
StaticDataMutex<Maybe<PathUtils::DirectoryCache>> PathUtils::sDirCache{ MOZ_RUNINIT StaticDataMutex<Maybe<PathUtils::DirectoryCache>>
"sDirCache"}; PathUtils::sDirCache{"sDirCache"};
/** /**
* Return the leaf name, including leading path separators in the case of * Return the leaf name, including leading path separators in the case of

View File

@ -29,8 +29,9 @@
using namespace mozilla; using namespace mozilla;
static const CLLocationAccuracy kHIGH_ACCURACY = kCLLocationAccuracyBest; MOZ_RUNINIT static const CLLocationAccuracy kHIGH_ACCURACY =
static const CLLocationAccuracy kDEFAULT_ACCURACY = kCLLocationAccuracyBest;
MOZ_RUNINIT static const CLLocationAccuracy kDEFAULT_ACCURACY =
kCLLocationAccuracyNearestTenMeters; kCLLocationAccuracyNearestTenMeters;
@interface LocationDelegate : NSObject <CLLocationManagerDelegate> { @interface LocationDelegate : NSObject <CLLocationManagerDelegate> {

View File

@ -135,25 +135,27 @@ HTMLEditor::InsertNodeIntoProperAncestorWithTransaction(
Text& aContentToInsert, const EditorDOMPoint& aPointToInsert, Text& aContentToInsert, const EditorDOMPoint& aPointToInsert,
SplitAtEdges aSplitAtEdges); SplitAtEdges aSplitAtEdges);
HTMLEditor::InitializeInsertingElement HTMLEditor::DoNothingForNewElement = MOZ_RUNINIT HTMLEditor::InitializeInsertingElement
[](HTMLEditor&, Element&, const EditorDOMPoint&) { return NS_OK; }; HTMLEditor::DoNothingForNewElement =
[](HTMLEditor&, Element&, const EditorDOMPoint&) { return NS_OK; };
HTMLEditor::InitializeInsertingElement HTMLEditor::InsertNewBRElement = MOZ_RUNINIT HTMLEditor::InitializeInsertingElement
[](HTMLEditor& aHTMLEditor, Element& aNewElement, const EditorDOMPoint&) HTMLEditor::InsertNewBRElement =
MOZ_CAN_RUN_SCRIPT_BOUNDARY { [](HTMLEditor& aHTMLEditor, Element& aNewElement, const EditorDOMPoint&)
MOZ_ASSERT(!aNewElement.IsInComposedDoc()); MOZ_CAN_RUN_SCRIPT_BOUNDARY {
Result<CreateElementResult, nsresult> createBRElementResult = MOZ_ASSERT(!aNewElement.IsInComposedDoc());
aHTMLEditor.InsertBRElement(WithTransaction::No, Result<CreateElementResult, nsresult> createBRElementResult =
EditorDOMPoint(&aNewElement, 0u)); aHTMLEditor.InsertBRElement(WithTransaction::No,
if (MOZ_UNLIKELY(createBRElementResult.isErr())) { EditorDOMPoint(&aNewElement, 0u));
NS_WARNING_ASSERTION( if (MOZ_UNLIKELY(createBRElementResult.isErr())) {
createBRElementResult.isOk(), NS_WARNING_ASSERTION(
"HTMLEditor::InsertBRElement(WithTransaction::No) failed"); createBRElementResult.isOk(),
return createBRElementResult.unwrapErr(); "HTMLEditor::InsertBRElement(WithTransaction::No) failed");
} return createBRElementResult.unwrapErr();
createBRElementResult.unwrap().IgnoreCaretPointSuggestion(); }
return NS_OK; createBRElementResult.unwrap().IgnoreCaretPointSuggestion();
}; return NS_OK;
};
// static // static
Result<CreateElementResult, nsresult> Result<CreateElementResult, nsresult>
@ -186,25 +188,27 @@ HTMLEditor::AppendNewElementWithBRToInsertingElement(
return createNewElementWithBRResult; return createNewElementWithBRResult;
} }
HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributes = MOZ_RUNINIT HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributes =
[](HTMLEditor&, const Element&, const Element&, int32_t, const nsAtom&, [](HTMLEditor&, const Element&, const Element&, int32_t, const nsAtom&,
nsString&) { return true; }; nsString&) { return true; };
HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributesExceptId = MOZ_RUNINIT HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributesExceptId =
[](HTMLEditor&, const Element&, const Element&, int32_t aNamespaceID, [](HTMLEditor&, const Element&, const Element&, int32_t aNamespaceID,
const nsAtom& aAttrName, nsString&) { const nsAtom& aAttrName, nsString&) {
return aNamespaceID != kNameSpaceID_None || &aAttrName != nsGkAtoms::id; return aNamespaceID != kNameSpaceID_None || &aAttrName != nsGkAtoms::id;
}; };
HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributesExceptDir = MOZ_RUNINIT HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributesExceptDir =
[](HTMLEditor&, const Element&, const Element&, int32_t aNamespaceID, [](HTMLEditor&, const Element&, const Element&, int32_t aNamespaceID,
const nsAtom& aAttrName, nsString&) { const nsAtom& aAttrName, nsString&) {
return aNamespaceID != kNameSpaceID_None || &aAttrName != nsGkAtoms::dir; return aNamespaceID != kNameSpaceID_None || &aAttrName != nsGkAtoms::dir;
}; };
HTMLEditor::AttributeFilter HTMLEditor::CopyAllAttributesExceptIdAndDir = MOZ_RUNINIT HTMLEditor::AttributeFilter
[](HTMLEditor&, const Element&, const Element&, int32_t aNamespaceID, HTMLEditor::CopyAllAttributesExceptIdAndDir =
const nsAtom& aAttrName, nsString&) { [](HTMLEditor&, const Element&, const Element&, int32_t aNamespaceID,
return !(aNamespaceID == kNameSpaceID_None && const nsAtom& aAttrName, nsString&) {
(&aAttrName == nsGkAtoms::id || &aAttrName == nsGkAtoms::dir)); return !(
}; aNamespaceID == kNameSpaceID_None &&
(&aAttrName == nsGkAtoms::id || &aAttrName == nsGkAtoms::dir));
};
HTMLEditor::HTMLEditor(const Document& aDocument) HTMLEditor::HTMLEditor(const Document& aDocument)
: EditorBase(EditorBase::EditorType::HTML), : EditorBase(EditorBase::EditorType::HTML),

View File

@ -30,8 +30,8 @@ using mozilla::dom::AutoJSAPI;
//***************************************************************************** //*****************************************************************************
static JS::PersistentRooted<JSObject*> autoconfigSystemSb; MOZ_RUNINIT static JS::PersistentRooted<JSObject*> autoconfigSystemSb;
static JS::PersistentRooted<JSObject*> autoconfigSb; MOZ_RUNINIT static JS::PersistentRooted<JSObject*> autoconfigSb;
bool sandboxEnabled; bool sandboxEnabled;
nsresult CentralizedAdminPrefManagerInit(bool aSandboxEnabled) { nsresult CentralizedAdminPrefManagerInit(bool aSandboxEnabled) {

View File

@ -77,10 +77,10 @@ uint32_t mozHunspellCallbacks::sCurrentFreshId = 0;
/* static */ /* static */
mozilla::StaticRWLock mozHunspellCallbacks::sFileMgrMapLock; mozilla::StaticRWLock mozHunspellCallbacks::sFileMgrMapLock;
/* static */ /* static */
std::map<uint32_t, std::unique_ptr<mozHunspellFileMgrHost>> MOZ_RUNINIT std::map<uint32_t, std::unique_ptr<mozHunspellFileMgrHost>>
mozHunspellCallbacks::sFileMgrMap; mozHunspellCallbacks::sFileMgrMap;
/* static */ /* static */
std::set<nsCString> mozHunspellCallbacks::sFileMgrAllowList; MOZ_RUNINIT std::set<nsCString> mozHunspellCallbacks::sFileMgrAllowList;
/* static */ /* static */
void mozHunspellCallbacks::AllowFile(const nsCString& aFilename) { void mozHunspellCallbacks::AllowFile(const nsCString& aFilename) {

View File

@ -21,10 +21,10 @@ static Atomic<DWRITE_PIXEL_GEOMETRY> sPixelGeometry;
static Atomic<DWRITE_RENDERING_MODE> sRenderingMode; static Atomic<DWRITE_RENDERING_MODE> sRenderingMode;
static Atomic<DWRITE_MEASURING_MODE> sMeasuringMode; static Atomic<DWRITE_MEASURING_MODE> sMeasuringMode;
static std::atomic<Float> sGDIGamma{1.4f}; static std::atomic<Float> sGDIGamma{1.4f};
StaticDataMutex<StaticRefPtr<IDWriteRenderingParams>> sStandardRenderingParams( MOZ_RUNINIT StaticDataMutex<StaticRefPtr<IDWriteRenderingParams>>
"StandardRenderingParams"); sStandardRenderingParams("StandardRenderingParams");
StaticDataMutex<StaticRefPtr<IDWriteRenderingParams>> sGDIRenderingParams( MOZ_RUNINIT StaticDataMutex<StaticRefPtr<IDWriteRenderingParams>>
"GDIRenderingParams"); sGDIRenderingParams("GDIRenderingParams");
static void ClearStandardRenderingParams() { static void ClearStandardRenderingParams() {
auto lockedParams = sStandardRenderingParams.Lock(); auto lockedParams = sStandardRenderingParams.Lock();

View File

@ -34,7 +34,7 @@ uint64_t DrawTargetD2D1::mVRAMUsageDT;
uint64_t DrawTargetD2D1::mVRAMUsageSS; uint64_t DrawTargetD2D1::mVRAMUsageSS;
StaticRefPtr<ID2D1Factory1> DrawTargetD2D1::mFactory; StaticRefPtr<ID2D1Factory1> DrawTargetD2D1::mFactory;
const D2D1_MATRIX_5X4_F kLuminanceMatrix = MOZ_RUNINIT const D2D1_MATRIX_5X4_F kLuminanceMatrix =
D2D1::Matrix5x4F(0, 0, 0, 0.2125f, 0, 0, 0, 0.7154f, 0, 0, 0, 0.0721f, 0, 0, D2D1::Matrix5x4F(0, 0, 0, 0.2125f, 0, 0, 0, 0.7154f, 0, 0, 0, 0.0721f, 0, 0,
0, 0, 0, 0, 0, 0); 0, 0, 0, 0, 0, 0);

View File

@ -19,7 +19,8 @@ namespace gfx {
static StaticMutex sFontFileStreamsMutex MOZ_UNANNOTATED; static StaticMutex sFontFileStreamsMutex MOZ_UNANNOTATED;
static uint64_t sNextFontFileKey = 0; static uint64_t sNextFontFileKey = 0;
static std::unordered_map<uint64_t, IDWriteFontFileStream*> sFontFileStreams; MOZ_RUNINIT static std::unordered_map<uint64_t, IDWriteFontFileStream*>
sFontFileStreams;
class DWriteFontFileLoader : public IDWriteFontFileLoader { class DWriteFontFileLoader : public IDWriteFontFileLoader {
public: public:

View File

@ -23,7 +23,8 @@ namespace mozilla {
namespace gfx { namespace gfx {
#define FONT_NAME_MAX 32 #define FONT_NAME_MAX 32
static StaticDataMutex<std::unordered_map<void*, nsAutoCStringN<FONT_NAME_MAX>>> MOZ_RUNINIT static StaticDataMutex<
std::unordered_map<void*, nsAutoCStringN<FONT_NAME_MAX>>>
sWeakFontDataMap("WeakFonts"); sWeakFontDataMap("WeakFonts");
void FontDataDeallocate(void*, void* info) { void FontDataDeallocate(void*, void* info) {

View File

@ -342,7 +342,7 @@ already_AddRefed<GLContext> GLContextProviderCGL::CreateHeadless(
return gl.forget(); return gl.forget();
} }
static RefPtr<GLContext> gGlobalContext; MOZ_RUNINIT static RefPtr<GLContext> gGlobalContext;
GLContext* GLContextProviderCGL::GetGlobalContext() { GLContext* GLContextProviderCGL::GetGlobalContext() {
static bool triedToCreateContext = false; static bool triedToCreateContext = false;

View File

@ -142,7 +142,7 @@ already_AddRefed<GLContext> GLContextProviderEAGL::CreateHeadless(
return CreateEAGLContext(desc, GetGlobalContextEAGL()).forget(); return CreateEAGLContext(desc, GetGlobalContextEAGL()).forget();
} }
static RefPtr<GLContext> gGlobalContext; MOZ_RUNINIT static RefPtr<GLContext> gGlobalContext;
GLContext* GLContextProviderEAGL::GetGlobalContext() { GLContext* GLContextProviderEAGL::GetGlobalContext() {
static bool triedToCreateContext = false; static bool triedToCreateContext = false;

View File

@ -106,7 +106,7 @@ class WaylandOffscreenGLSurface {
struct wl_egl_window* mEGLWindow = nullptr; struct wl_egl_window* mEGLWindow = nullptr;
}; };
static nsTHashMap<nsPtrHashKey<void>, WaylandOffscreenGLSurface*> MOZ_RUNINIT static nsTHashMap<nsPtrHashKey<void>, WaylandOffscreenGLSurface*>
sWaylandOffscreenGLSurfaces; sWaylandOffscreenGLSurfaces;
void DeleteWaylandOffscreenGLSurface(EGLSurface surface) { void DeleteWaylandOffscreenGLSurface(EGLSurface surface) {

View File

@ -51,7 +51,7 @@ namespace mozilla::gl {
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::widget; using namespace mozilla::widget;
GLXLibrary sGLXLibrary; MOZ_RUNINIT GLXLibrary sGLXLibrary;
static inline bool HasExtension(const char* aExtensions, static inline bool HasExtension(const char* aExtensions,
const char* aRequiredExtension) { const char* aRequiredExtension) {

View File

@ -30,7 +30,7 @@ namespace gl {
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::widget; using namespace mozilla::widget;
WGLLibrary sWGLLib; MOZ_RUNINIT WGLLibrary sWGLLib;
/* /*
ScopedWindow::~ScopedWindow() ScopedWindow::~ScopedWindow()

View File

@ -389,7 +389,7 @@ class AngleErrorReporting {
nsACString* mFailureId; nsACString* mFailureId;
}; };
AngleErrorReporting gAngleErrorReporter; MOZ_RUNINIT AngleErrorReporting gAngleErrorReporter;
static std::shared_ptr<EglDisplay> GetAndInitDisplayForAccelANGLE( static std::shared_ptr<EglDisplay> GetAndInitDisplayForAccelANGLE(
GLLibraryEGL& egl, nsACString* const out_failureId, GLLibraryEGL& egl, nsACString* const out_failureId,

View File

@ -23,7 +23,7 @@
namespace mozilla::gfx { namespace mozilla::gfx {
CanvasManagerParent::ManagerSet CanvasManagerParent::sManagers; MOZ_RUNINIT CanvasManagerParent::ManagerSet CanvasManagerParent::sManagers;
/* static */ void CanvasManagerParent::Init( /* static */ void CanvasManagerParent::Init(
Endpoint<PCanvasManagerParent>&& aEndpoint, Endpoint<PCanvasManagerParent>&& aEndpoint,

View File

@ -18,7 +18,7 @@ using namespace mozilla::dom;
namespace mozilla::gfx { namespace mozilla::gfx {
StaticMutex CanvasShutdownManager::sManagersMutex; StaticMutex CanvasShutdownManager::sManagersMutex;
std::set<CanvasShutdownManager*> CanvasShutdownManager::sManagers; MOZ_RUNINIT std::set<CanvasShutdownManager*> CanvasShutdownManager::sManagers;
// The owning thread will tell us to close when it is shutdown, either via // The owning thread will tell us to close when it is shutdown, either via
// CanvasShutdownManager::Shutdown for the main thread, or via a shutdown // CanvasShutdownManager::Shutdown for the main thread, or via a shutdown

View File

@ -20,7 +20,7 @@ using namespace mozilla::gl;
namespace mozilla::layers { namespace mozilla::layers {
static RefPtr<GLContext> sSnapshotContext; MOZ_RUNINIT static RefPtr<GLContext> sSnapshotContext;
nsresult GLImage::ReadIntoBuffer(uint8_t* aData, int32_t aStride, nsresult GLImage::ReadIntoBuffer(uint8_t* aData, int32_t aStride,
const gfx::IntSize& aSize, const gfx::IntSize& aSize,

View File

@ -19,7 +19,7 @@ namespace layers {
// stopped moving. Some input devices do not send move events in the // stopped moving. Some input devices do not send move events in the
// case where a pointer has stopped. We need to detect this case so that we can // case where a pointer has stopped. We need to detect this case so that we can
// accurately predict the velocity after the pointer starts moving again. // accurately predict the velocity after the pointer starts moving again.
static const TimeDuration kAssumePointerMoveStoppedTime = MOZ_RUNINIT static const TimeDuration kAssumePointerMoveStoppedTime =
TimeDuration::FromMilliseconds(40); TimeDuration::FromMilliseconds(40);
// The degree of the approximation. // The degree of the approximation.

View File

@ -21,7 +21,8 @@ namespace layers {
// delta can be really small, which can make the velocity computation very // delta can be really small, which can make the velocity computation very
// volatile. To avoid this we impose a minimum time delta below which we do // volatile. To avoid this we impose a minimum time delta below which we do
// not recompute the velocity. // not recompute the velocity.
const TimeDuration MIN_VELOCITY_SAMPLE_TIME = TimeDuration::FromMilliseconds(5); MOZ_RUNINIT const TimeDuration MIN_VELOCITY_SAMPLE_TIME =
TimeDuration::FromMilliseconds(5);
extern StaticAutoPtr<StyleComputedTimingFunction> gVelocityCurveFunction; extern StaticAutoPtr<StyleComputedTimingFunction> gVelocityCurveFunction;

View File

@ -9,7 +9,7 @@
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
ScrollableLayerGuid InputAPZContext::sGuid; MOZ_RUNINIT ScrollableLayerGuid InputAPZContext::sGuid;
uint64_t InputAPZContext::sBlockId = 0; uint64_t InputAPZContext::sBlockId = 0;
nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eSentinel; nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eSentinel;
bool InputAPZContext::sPendingLayerization = false; bool InputAPZContext::sPendingLayerization = false;

Some files were not shown because too many files have changed in this diff Show More