summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 01:07:34 +0000
committerrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 01:07:34 +0000
commit185ba1b55c175cc2e1efeaaf869991dbe3bffce9 (patch)
tree691c98a5464db384fc6dd794ed9346d3f650f227
parentf4ba1c3c8df96c51d190bf81600f9999cae7e2ec (diff)
downloadchromium_src-185ba1b55c175cc2e1efeaaf869991dbe3bffce9.zip
chromium_src-185ba1b55c175cc2e1efeaaf869991dbe3bffce9.tar.gz
chromium_src-185ba1b55c175cc2e1efeaaf869991dbe3bffce9.tar.bz2
Merge 101207 - Putting checks for the existence of the browser process in the background_mode_manager constructor. Also checking for the browser process during shutdown.
BUG=90114 TEST=passes existing, does not crash on repro steps Review URL: http://codereview.chromium.org/7888034 TBR=rlp@chromium.org Review URL: http://codereview.chromium.org/7888066 git-svn-id: svn://svn.chromium.org/chrome/branches/874/src@101210 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/background/background_mode_manager.cc5
-rw-r--r--chrome/browser/ui/browser_list.cc6
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();