Skip to content

Commit

Permalink
Bug 1667276 - Pre: Disable the startup cache when running a backgroun…
Browse files Browse the repository at this point in the history
…d task. r=dthayer

Differential Revision: https://phabricator.services.mozilla.com/D95198
  • Loading branch information
Mossop committed Jan 27, 2021
1 parent 09e5216 commit b57ef60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions startupcache/StartupCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include "GeckoProfiler.h"
#include "nsAppRunner.h"
#include "xpcpublic.h"
#ifdef MOZ_BACKGROUNDTASKS
# include "mozilla/BackgroundTasks.h"
#endif

#if defined(XP_WIN)
# include <windows.h>
Expand Down Expand Up @@ -115,6 +118,12 @@ StartupCache* StartupCache::GetSingletonNoInit() {
}

StartupCache* StartupCache::GetSingleton() {
#ifdef MOZ_BACKGROUNDTASKS
if (BackgroundTasks::IsBackgroundTaskMode()) {
return nullptr;
}
#endif

if (!gStartupCache) {
if (!XRE_IsParentProcess()) {
return nullptr;
Expand Down
3 changes: 3 additions & 0 deletions startupcache/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ XPIDL_SOURCES += [
"nsIStartupCacheInfo.idl",
]

if CONFIG["MOZ_BACKGROUNDTASKS"]:
DEFINES["MOZ_BACKGROUNDTASKS"] = True

FINAL_LIBRARY = "xul"

0 comments on commit b57ef60

Please sign in to comment.