Skip to content

Commit

Permalink
Bug 1920718 - Annotate all global variable with runtime initializatio…
Browse files Browse the repository at this point in the history
…n 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
  • Loading branch information
serge-sans-paille committed Oct 30, 2024
1 parent 793bb2c commit 8a0a0f7
Show file tree
Hide file tree
Showing 290 changed files with 926 additions and 797 deletions.
2 changes: 1 addition & 1 deletion accessible/android/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using namespace mozilla;
using namespace mozilla::a11y;

static nsTHashMap<nsStringHashKey, nsString> sLocalizedStrings;
MOZ_RUNINIT static nsTHashMap<nsStringHashKey, nsString> sLocalizedStrings;

void a11y::PlatformInit() {
nsresult rv = NS_OK;
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ LocalAccessible* nsAccessibilityService::CreateAccessible(
# include "mozilla/Monitor.h"
# include "mozilla/Maybe.h"

static Maybe<Monitor> sAndroidMonitor;
MOZ_RUNINIT static Maybe<Monitor> sAndroidMonitor;

mozilla::Monitor& nsAccessibilityService::GetAndroidMonitor() {
if (!sAndroidMonitor.isSome()) {
Expand Down
4 changes: 2 additions & 2 deletions accessible/mac/MOXTextMarkerDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#define PREF_ACCESSIBILITY_MAC_DEBUG "accessibility.mac.debug"

static nsTHashMap<nsPtrHashKey<mozilla::a11y::Accessible>,
MOXTextMarkerDelegate*>
MOZ_RUNINIT static nsTHashMap<nsPtrHashKey<mozilla::a11y::Accessible>,
MOXTextMarkerDelegate*>
sDelegates;

@implementation MOXTextMarkerDelegate
Expand Down
2 changes: 1 addition & 1 deletion accessible/mac/mozAccessible.mm
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ - (NSString*)moxSubrole {
const nsString description;
};

static const RoleDescrMap sRoleDescrMap[] = {
MOZ_RUNINIT static const RoleDescrMap sRoleDescrMap[] = {
{@"AXApplicationAlert", u"alert"_ns},
{@"AXApplicationAlertDialog", u"alertDialog"_ns},
{@"AXApplicationDialog", u"dialog"_ns},
Expand Down
2 changes: 1 addition & 1 deletion accessible/windows/msaa/MsaaAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static const GUID IID_MsaaAccessible = {
0x4afc,
{0xa3, 0x2c, 0xd6, 0xb5, 0xc0, 0x10, 0x04, 0x6b}};

MsaaIdGenerator MsaaAccessible::sIDGen;
MOZ_RUNINIT MsaaIdGenerator MsaaAccessible::sIDGen;
ITypeInfo* MsaaAccessible::gTypeInfo = nullptr;

/* static */
Expand Down
2 changes: 1 addition & 1 deletion browser/app/nsBrowserApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static bool IsArg(const char* arg, const char* s) {
return false;
}

Bootstrap::UniquePtr gBootstrap;
MOZ_RUNINIT Bootstrap::UniquePtr gBootstrap;

static int do_main(int argc, char* argv[], char* envp[]) {
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
Expand Down
3 changes: 1 addition & 2 deletions browser/app/winlauncher/freestanding/SafeThreadLocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ class SafeThreadLocal final {
};

template <typename T>
MOZ_THREAD_LOCAL(T)
SafeThreadLocal<T>::sThreadLocal;
MOZ_GLOBINIT MOZ_THREAD_LOCAL(T) SafeThreadLocal<T>::sThreadLocal;

template <typename T>
T SafeThreadLocal<T>::sGlobal = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions browser/app/winlauncher/test/TestCrossProcessWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ static DynamicBlockList ConvertStaticBlocklistToDynamic(
return blockList;
}

const DynamicBlockList gFullList =
MOZ_RUNINIT const DynamicBlockList gFullList =
ConvertStaticBlocklistToDynamic(gWindowsDllBlocklist);
const DynamicBlockList gShortList =
MOZ_RUNINIT const DynamicBlockList gShortList =
ConvertStaticBlocklistToDynamic(kDllBlocklistShort);

static bool TestDependentModules() {
Expand Down
2 changes: 1 addition & 1 deletion caps/tests/gtest/TestPrincipalAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST_P(PrincipalAttributesTest, PrincipalAttributesTest) {
ASSERT_EQ(principal->GetIsIpAddress(), GetParam().expectIsIpAddress);
}

static const PrincipalAttributesParam kAttributes[] = {
MOZ_RUNINIT static const PrincipalAttributesParam kAttributes[] = {
{nsAutoCString("https://mozilla.com"), false},
{nsAutoCString("https://127.0.0.1"), true},
{nsAutoCString("https://[::1]"), true},
Expand Down
5 changes: 5 additions & 0 deletions docs/code-quality/coding-style/coding_style_cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ C/C++ practices
- One-argument constructors, that are not copy or move constructors,
should generally be marked explicit. Exceptions should be annotated
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
returns or takes as argument a single Unicode scalar value. (Don't
use UTF-32 strings, though.)
Expand Down
2 changes: 1 addition & 1 deletion docshell/shistory/nsSHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct ListHelper {
LinkedList<nsSHistory> mList;
};

static ListHelper gSHistoryList;
MOZ_RUNINIT static ListHelper gSHistoryList;
// Max viewers allowed total, across all SHistory objects - negative default
// means we will calculate how many viewers to cache based on total memory
int32_t nsSHistory::sHistoryMaxTotalViewers = -1;
Expand Down
27 changes: 16 additions & 11 deletions dom/base/CCGCScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@
/* Globally initialized constants
*/
namespace mozilla {
const TimeDuration kOneMinute = TimeDuration::FromSeconds(60.0f);
const TimeDuration kCCDelay = TimeDuration::FromSeconds(6);
const TimeDuration kCCSkippableDelay = TimeDuration::FromMilliseconds(250);
const TimeDuration kTimeBetweenForgetSkippableCycles =
MOZ_RUNINIT const TimeDuration kOneMinute = TimeDuration::FromSeconds(60.0f);
MOZ_RUNINIT const TimeDuration kCCDelay = TimeDuration::FromSeconds(6);
MOZ_RUNINIT const TimeDuration kCCSkippableDelay =
TimeDuration::FromMilliseconds(250);
MOZ_RUNINIT const TimeDuration kTimeBetweenForgetSkippableCycles =
TimeDuration::FromSeconds(2);
const TimeDuration kForgetSkippableSliceDuration =
MOZ_RUNINIT const TimeDuration kForgetSkippableSliceDuration =
TimeDuration::FromMilliseconds(2);
const TimeDuration kICCIntersliceDelay = TimeDuration::FromMilliseconds(250);
const TimeDuration kICCSliceBudget = TimeDuration::FromMilliseconds(3);
const TimeDuration kIdleICCSliceBudget = TimeDuration::FromMilliseconds(2);
const TimeDuration kMaxICCDuration = TimeDuration::FromSeconds(2);
MOZ_RUNINIT const TimeDuration kICCIntersliceDelay =
TimeDuration::FromMilliseconds(250);
MOZ_RUNINIT const TimeDuration kICCSliceBudget =
TimeDuration::FromMilliseconds(3);
MOZ_RUNINIT const TimeDuration kIdleICCSliceBudget =
TimeDuration::FromMilliseconds(2);
MOZ_RUNINIT const TimeDuration kMaxICCDuration = TimeDuration::FromSeconds(2);

const TimeDuration kCCForced = kOneMinute * 2;
const TimeDuration kMaxCCLockedoutTime = TimeDuration::FromSeconds(30);
MOZ_RUNINIT const TimeDuration kCCForced = kOneMinute * 2;
MOZ_RUNINIT const TimeDuration kMaxCCLockedoutTime =
TimeDuration::FromSeconds(30);
} // namespace mozilla

/*
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14785,7 +14785,7 @@ class PendingFullscreenChangeList {
};

/* static */
LinkedList<FullscreenChange> PendingFullscreenChangeList::sList;
MOZ_RUNINIT LinkedList<FullscreenChange> PendingFullscreenChangeList::sList;

size_t Document::CountFullscreenElements() const {
size_t count = 0;
Expand Down
2 changes: 1 addition & 1 deletion dom/base/FuzzingFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct ModifierKey final {
mLockable(aLockable) {}
};

static const ModifierKey kModifierKeys[] = {
MOZ_RUNINIT static const ModifierKey kModifierKeys[] = {
ModifierKey(MODIFIER_ALT, KEY_NAME_INDEX_Alt, false),
ModifierKey(MODIFIER_ALTGRAPH, KEY_NAME_INDEX_AltGraph, false),
ModifierKey(MODIFIER_CONTROL, KEY_NAME_INDEX_Control, false),
Expand Down
8 changes: 5 additions & 3 deletions dom/base/PlacesObservers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ struct ListenerCollection {
};

template <class T>
StaticAutoPtr<FlaggedArray<T>> ListenerCollection<T>::gListeners;
MOZ_GLOBINIT StaticAutoPtr<FlaggedArray<T>> ListenerCollection<T>::gListeners;
template <class T>
StaticAutoPtr<FlaggedArray<T>> ListenerCollection<T>::gListenersToRemove;
MOZ_GLOBINIT StaticAutoPtr<FlaggedArray<T>>
ListenerCollection<T>::gListenersToRemove;

using JSListeners = ListenerCollection<RefPtr<PlacesEventCallback>>;
using WeakJSListeners = ListenerCollection<WeakPtr<PlacesWeakCallbackWrapper>>;
Expand All @@ -66,7 +67,8 @@ using WeakNativeListeners =
// Even if NotifyListeners is called any timing, we mange the notifications with
// adding to this queue, then sending in sequence. This avoids sending nested
// 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) {
if (aEventType == PlacesEventType::None) {
Expand Down
4 changes: 2 additions & 2 deletions dom/base/PointerLockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ using mozilla::dom::Element;
using mozilla::dom::WindowContext;

// Reference to the pointer locked element.
static nsWeakPtr sLockedElement;
MOZ_RUNINIT static nsWeakPtr sLockedElement;

// Reference to the document which requested pointer lock.
static nsWeakPtr sLockedDoc;
MOZ_RUNINIT static nsWeakPtr sLockedDoc;

// Reference to the BrowserParent requested pointer lock.
static BrowserParent* sLockedRemoteTarget = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion dom/base/ScrollingMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace mozilla {
static TimeStamp gScrollingStartTime;
static TimeStamp gScrollingEndTime;
static uint32_t gScrollDistanceCSSPixels = 0;
static dom::InteractionData gScrollingInteraction = {};
MOZ_RUNINIT static dom::InteractionData gScrollingInteraction = {};

void ScrollingMetrics::OnScrollingInteractionEnded() {
// We are only interested in content process scrolling
Expand Down
2 changes: 1 addition & 1 deletion dom/base/fuzztest/FuzzStructuredClone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::ipc;

JS::PersistentRooted<JSObject*> global;
MOZ_RUNINIT JS::PersistentRooted<JSObject*> global;

static int FuzzingInitDomSC(int* argc, char*** argv) {
JSObject* simpleGlobal =
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ already_AddRefed<nsIRunnable> NativeInputRunnable::Create(

} // unnamed namespace

LinkedList<OldWindowSize> OldWindowSize::sList;
MOZ_RUNINIT LinkedList<OldWindowSize> OldWindowSize::sList;

NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils)
Expand Down
17 changes: 9 additions & 8 deletions dom/base/test/gtest/TestScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

using namespace mozilla;

static TimeDuration kOneSecond = TimeDuration::FromSeconds(1);
static TimeDuration kTenthSecond = TimeDuration::FromSeconds(0.1);
static TimeDuration kFrameDuration = TimeDuration::FromSeconds(1.0 / 60.0);
MOZ_RUNINIT static TimeDuration kOneSecond = TimeDuration::FromSeconds(1);
MOZ_RUNINIT static TimeDuration kTenthSecond = TimeDuration::FromSeconds(0.1);
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) {
sNow += aDuration;
Expand Down Expand Up @@ -328,10 +329,10 @@ static bool BasicScenario(CCGCScheduler& aScheduler, TestGC* aTestGC,
return true;
}

static CCGCScheduler scheduler;
static TestGC gc(scheduler);
static TestIdleCC ccIdle(scheduler);
static TestNonIdleCC ccNonIdle(scheduler);
MOZ_RUNINIT static CCGCScheduler scheduler;
MOZ_RUNINIT static TestGC gc(scheduler);
MOZ_RUNINIT static TestIdleCC ccIdle(scheduler);
MOZ_RUNINIT static TestNonIdleCC ccNonIdle(scheduler);

TEST(TestScheduler, Idle)
{
Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/Codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2618,7 +2618,7 @@ def switchToCondition(condition, specs):
specType = "const " + specType
arrays = fill(
"""
static ${specType} ${name}_specs[] = {
MOZ_GLOBINIT static ${specType} ${name}_specs[] = {
${specs}
};

Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/DOMJSProxyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct SetDOMProxyInformation {
}
};

SetDOMProxyInformation gSetDOMProxyInformation;
MOZ_RUNINIT SetDOMProxyInformation gSetDOMProxyInformation;

static inline void CheckExpandoObject(JSObject* proxy,
const JS::Value& expando) {
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ WebGLContextOptions::WebGLContextOptions() {
}

StaticMutex WebGLContext::sLruMutex;
std::list<WebGLContext*> WebGLContext::sLru;
MOZ_RUNINIT std::list<WebGLContext*> WebGLContext::sLru;

WebGLContext::LruPosition::LruPosition() {
StaticMutexAutoLock lock(sLruMutex);
Expand Down
5 changes: 3 additions & 2 deletions dom/canvas/WebGLFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ static inline auto FindPtrOrNull(C& container, const K2& key) {

//////////////////////////////////////////////////////////////////////////////////////////

std::map<EffectiveFormat, const CompressedFormatInfo> gCompressedFormatInfoMap;
std::map<EffectiveFormat, FormatInfo> gFormatInfoMap;
MOZ_RUNINIT std::map<EffectiveFormat, const CompressedFormatInfo>
gCompressedFormatInfoMap;
MOZ_RUNINIT std::map<EffectiveFormat, FormatInfo> gFormatInfoMap;

static inline const CompressedFormatInfo* GetCompressedFormatInfo(
EffectiveFormat format) {
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace mozilla {
namespace webgl {

/*static*/ const ImageInfo ImageInfo::kUndefined;
MOZ_RUNINIT /*static*/ const ImageInfo ImageInfo::kUndefined;

size_t ImageInfo::MemoryUsage() const {
if (!IsDefined()) return 0;
Expand Down
2 changes: 1 addition & 1 deletion dom/crypto/WebCryptoTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// Template taken from security/nss/lib/util/templates.c
// This (or SGN_EncodeDigestInfo) would ideally be exported
// 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_INLINE, offsetof(SGNDigestInfo, digestAlgorithm),
SEC_ASN1_GET(SECOID_AlgorithmIDTemplate)},
Expand Down
8 changes: 4 additions & 4 deletions dom/events/EventStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ static nsITimer* gUserInteractionTimer = nullptr;
static nsITimerCallback* gUserInteractionTimerCallback = nullptr;

static const double kCursorLoadingTimeout = 1000; // ms
static AutoWeakFrame gLastCursorSourceFrame;
MOZ_RUNINIT static AutoWeakFrame gLastCursorSourceFrame;
static TimeStamp gLastCursorUpdateTime;
static TimeStamp gTypingStartTime;
static TimeStamp gTypingEndTime;
static int32_t gTypingInteractionKeyPresses = 0;
static dom::InteractionData gTypingInteraction = {};
MOZ_RUNINIT static dom::InteractionData gTypingInteraction = {};

static inline int32_t RoundDown(double aDouble) {
return (aDouble > 0) ? static_cast<int32_t>(floor(aDouble))
Expand Down Expand Up @@ -559,14 +559,14 @@ bool EventStateManager::sNormalLMouseEventInProcess = false;
int16_t EventStateManager::sCurrentMouseBtn = MouseButton::eNotPressed;
EventStateManager* EventStateManager::sActiveESM = nullptr;
EventStateManager* EventStateManager::sCursorSettingManager = nullptr;
AutoWeakFrame EventStateManager::sLastDragOverFrame = nullptr;
MOZ_RUNINIT AutoWeakFrame EventStateManager::sLastDragOverFrame = nullptr;
LayoutDeviceIntPoint EventStateManager::sPreLockScreenPoint =
LayoutDeviceIntPoint(0, 0);
LayoutDeviceIntPoint EventStateManager::sLastRefPoint = kInvalidRefPoint;
CSSIntPoint EventStateManager::sLastScreenPoint = CSSIntPoint(0, 0);
LayoutDeviceIntPoint EventStateManager::sSynthCenteringPoint = kInvalidRefPoint;
CSSIntPoint EventStateManager::sLastClientPoint = CSSIntPoint(0, 0);
nsCOMPtr<nsIContent> EventStateManager::sDragOverContent = nullptr;
MOZ_RUNINIT nsCOMPtr<nsIContent> EventStateManager::sDragOverContent = nullptr;

EventStateManager::WheelPrefs* EventStateManager::WheelPrefs::sInstance =
nullptr;
Expand Down
4 changes: 2 additions & 2 deletions dom/events/IMEStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ nsIWidget* IMEStateManager::sActiveInputContextWidget = nullptr;
StaticRefPtr<IMEContentObserver> IMEStateManager::sActiveIMEContentObserver;
TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
InputContext::Origin IMEStateManager::sOrigin = InputContext::ORIGIN_MAIN;
InputContext IMEStateManager::sActiveChildInputContext;
MOZ_RUNINIT InputContext IMEStateManager::sActiveChildInputContext;
bool IMEStateManager::sInstalledMenuKeyboardListener = false;
bool IMEStateManager::sIsGettingNewIMEState = false;
bool IMEStateManager::sCleaningUpForStoppingIMEStateManagement = false;
bool IMEStateManager::sIsActive = false;
Maybe<IMEStateManager::PendingFocusedBrowserSwitchingData>
MOZ_RUNINIT Maybe<IMEStateManager::PendingFocusedBrowserSwitchingData>
IMEStateManager::sPendingFocusedBrowserSwitchingData;

class PseudoFocusChangeRunnable : public Runnable {
Expand Down
3 changes: 2 additions & 1 deletion dom/fetch/FetchParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ NS_IMETHODIMP FetchParent::FetchParentCSPEventListener::OnCSPViolationEvent(
return NS_OK;
}

nsTHashMap<nsIDHashKey, RefPtr<FetchParent>> FetchParent::sActorTable;
MOZ_RUNINIT nsTHashMap<nsIDHashKey, RefPtr<FetchParent>>
FetchParent::sActorTable;

/*static*/
RefPtr<FetchParent> FetchParent::GetActorByID(const nsID& aID) {
Expand Down
2 changes: 1 addition & 1 deletion dom/fetch/FetchUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ class JSStreamConsumer final : public nsIInputStreamCallback,
NS_IMPL_ISUPPORTS(JSStreamConsumer, nsIInputStreamCallback)

// static
const nsCString FetchUtil::WasmAltDataType;
MOZ_RUNINIT const nsCString FetchUtil::WasmAltDataType;

// static
void FetchUtil::InitWasmAltDataType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class TestFileSystemOriginInitialization : public FileSystemParentTest {
FileSystemQuotaClientFactory::SetCustomFactory(nullptr);
}

static inline RefPtr<MockFileSystemQuotaClient> sQuotaClient;
MOZ_RUNINIT static inline RefPtr<MockFileSystemQuotaClient> sQuotaClient;
};

TEST_F(TestFileSystemOriginInitialization, EmptyOriginDirectory) {
Expand Down
2 changes: 1 addition & 1 deletion dom/gamepad/windows/WindowsGamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class WindowsGamepadService;
// it will be created and destroyed by background thread and
// used by gMonitorThread
WindowsGamepadService* MOZ_NON_OWNING_REF gService = nullptr;
nsCOMPtr<nsIThread> gMonitorThread = nullptr;
MOZ_RUNINIT nsCOMPtr<nsIThread> gMonitorThread = nullptr;
static bool sIsShutdown = false;

class Gamepad {
Expand Down
Loading

0 comments on commit 8a0a0f7

Please sign in to comment.