From 486f00a8afec21d366a412437724195ae4365dd9 Mon Sep 17 00:00:00 2001 From: Nika Layzell Date: Fri, 17 Nov 2017 16:23:49 -0500 Subject: [PATCH] Bug 1419144 - Part 3: Move pref caches into nsGlobalWindowInner where they are used, r=smaug MozReview-Commit-ID: 1yftLoS3eo2 --- dom/base/nsGlobalWindow.cpp | 14 -------------- dom/base/nsGlobalWindowInner.cpp | 10 +++++++++- dom/base/nsGlobalWindowOuter.cpp | 2 -- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 90fb94e20cd4..b98f79cbc64c 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -295,7 +295,6 @@ static bool gMouseDown = false; static bool gDragServiceDisabled = false; static FILE *gDumpFile = nullptr; static uint32_t gSerialCounter = 0; -static bool gIdleObserversAPIFuzzTimeDisabled = false; #ifdef DEBUG_jst int32_t gTimeoutCnt = 0; @@ -786,19 +785,6 @@ nsPIDOMWindow::GetDocGroup() const return nullptr; } -static void -EnsurePrefCaches() -{ - static bool sFirstTime = true; - if (sFirstTime) { - TimeoutManager::Initialize(); - Preferences::AddBoolVarCache(&gIdleObserversAPIFuzzTimeDisabled, - "dom.idle-observers-api.fuzz_time.disabled", - false); - sFirstTime = false; - } -} - // Include the implementations for the inner and outer windows respectively. #include "nsGlobalWindowOuter.cpp" #include "nsGlobalWindowInner.cpp" diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 1782e4d9d56e..f1ddf1000d46 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -50,6 +50,7 @@ return; \ PR_END_MACRO +static bool gIdleObserversAPIFuzzTimeDisabled = false; nsGlobalWindowInner::InnerWindowByIdTable *nsGlobalWindowInner::sInnerWindowsById = nullptr; @@ -676,7 +677,14 @@ nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow) gRefCnt++; - EnsurePrefCaches(); + static bool sFirstTime = true; + if (sFirstTime) { + sFirstTime = false; + TimeoutManager::Initialize(); + Preferences::AddBoolVarCache(&gIdleObserversAPIFuzzTimeDisabled, + "dom.idle-observers-api.fuzz_time.disabled", + false); + } if (gDumpFile == nullptr) { nsAutoCString fname; diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index f881c7630215..9499f1a62fb4 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -692,8 +692,6 @@ nsGlobalWindowOuter::nsGlobalWindowOuter() gRefCnt++; - EnsurePrefCaches(); - if (gDumpFile == nullptr) { nsAutoCString fname; Preferences::GetCString("browser.dom.window.dump.file", fname);