Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: chrome/browser/background/background_mode_manager.cc

Issue 1376063005: Cleanup: Pull some browser keep alive functions into its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/background/background_mode_manager.cc
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 5bd2c6c5fa8186d2801aa1bd30ec1263283e66fd..df6a1aada17ca85ff67348a769b2d80483aaf1f8 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/lifetime/browser_keep_alive.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -343,7 +344,7 @@ BackgroundModeManager::BackgroundModeManager(
// there are background apps) or exit if there are none.
if (command_line.HasSwitch(switches::kNoStartupWindow)) {
keep_alive_for_startup_ = true;
- chrome::IncrementKeepAliveCount();
+ browser_lifetime::IncrementKeepAliveCount();
} else {
// Otherwise, start with background mode suspended in case we're launching
// in a mode that doesn't open a browser window. It will be resumed when the
@@ -680,7 +681,7 @@ void BackgroundModeManager::ExecuteCommand(int command_id, int event_flags) {
// Background mode must already be enabled (as otherwise this menu would
// not be visible).
DCHECK(IsBackgroundModePrefEnabled());
- DCHECK(chrome::WillKeepAlive());
+ DCHECK(browser_lifetime::WillKeepAlive());
RecordMenuItemClick(MENU_ITEM_KEEP_RUNNING);
@@ -713,7 +714,7 @@ void BackgroundModeManager::DecrementKeepAliveCountForStartup() {
// keep-alive (which can shutdown Chrome) before the message loop has
// started.
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&chrome::DecrementKeepAliveCount));
+ FROM_HERE, base::Bind(&browser_lifetime::DecrementKeepAliveCount));
}
}
@@ -794,7 +795,7 @@ void BackgroundModeManager::UpdateKeepAliveAndTrayIcon() {
if (in_background_mode_ && !background_mode_suspended_) {
if (!keeping_alive_) {
keeping_alive_ = true;
- chrome::IncrementKeepAliveCount();
+ browser_lifetime::IncrementKeepAliveCount();
#if defined(OS_WIN)
browser_watcher::ExitFunnel::RecordSingleEvent(
@@ -808,7 +809,7 @@ void BackgroundModeManager::UpdateKeepAliveAndTrayIcon() {
RemoveStatusTrayIcon();
if (keeping_alive_) {
keeping_alive_ = false;
- chrome::DecrementKeepAliveCount();
+ browser_lifetime::DecrementKeepAliveCount();
#if defined(OS_WIN)
browser_watcher::ExitFunnel::RecordSingleEvent(
@@ -867,7 +868,7 @@ int BackgroundModeManager::GetBackgroundClientCount() const {
// clients.
for (const auto& it : background_mode_data_)
count += it.second->GetBackgroundClientCount();
- DCHECK(count >= 0);
+ DCHECK_GE(count, 0);
return count;
}

Powered by Google App Engine
This is Rietveld 408576698