diff options
-rw-r--r-- | chrome/browser/background/background_mode_manager.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/browser_list.cc | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index e6cd8a0d..045f086 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -12,6 +12,7 @@ #include "chrome/browser/background/background_application_list_model.h" #include "chrome/browser/background/background_mode_manager.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_shutdown.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/status_icons/status_icon.h" @@ -135,6 +136,10 @@ BackgroundModeManager::BackgroundModeManager(CommandLine* command_line) keep_alive_for_startup_(false), keep_alive_for_test_(false), current_command_id_(0) { + // We should never start up if there is no browser process or if we are + // currently quitting. + CHECK(g_browser_process != NULL); + CHECK(!browser_shutdown::IsTryingToQuit()); // If background mode is currently disabled, just exit - don't listen for any // notifications. if (IsBackgroundModePermanentlyDisabled(command_line)) diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index 37b5425..b1245da 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -571,6 +571,12 @@ void BrowserList::StartKeepAlive() { void BrowserList::EndKeepAlive() { DCHECK_GT(keep_alive_count_, 0); keep_alive_count_--; + + DCHECK(g_browser_process); + // Although we should have a browser process, if there is none, + // there is nothing to do. + if (!g_browser_process) return; + // Allow the app to shutdown again. if (!WillKeepAlive()) { g_browser_process->ReleaseModule(); |