Skip to content

Commit dedd68d

Browse files
committed
Bug 1667276 - Pre: Disable the startup cache when running a background task. r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D95198
1 parent 742670f commit dedd68d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

startupcache/StartupCache.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include "GeckoProfiler.h"
3636
#include "nsAppRunner.h"
3737
#include "xpcpublic.h"
38+
#ifdef MOZ_BACKGROUNDTASKS
39+
# include "mozilla/BackgroundTasks.h"
40+
#endif
3841

3942
#if defined(XP_WIN)
4043
# include <windows.h>
@@ -115,6 +118,12 @@ StartupCache* StartupCache::GetSingletonNoInit() {
115118
}
116119

117120
StartupCache* StartupCache::GetSingleton() {
121+
#ifdef MOZ_BACKGROUNDTASKS
122+
if (BackgroundTasks::IsBackgroundTaskMode()) {
123+
return nullptr;
124+
}
125+
#endif
126+
118127
if (!gStartupCache) {
119128
if (!XRE_IsParentProcess()) {
120129
return nullptr;

startupcache/moz.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ XPIDL_SOURCES += [
3131
"nsIStartupCacheInfo.idl",
3232
]
3333

34+
if CONFIG["MOZ_BACKGROUNDTASKS"]:
35+
DEFINES["MOZ_BACKGROUNDTASKS"] = True
36+
3437
FINAL_LIBRARY = "xul"

0 commit comments

Comments
 (0)