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

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

Issue 1931503002: Add BackgroundModeOptimizer that can restart the browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PushKeepAlive
Patch Set: fix BrowserListTest.AttemptRestart Created 4 years, 5 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 daf22d28894c0dfb35777c083284576b4abc0204..b3547abe45fba1616bd2c991ba3c770887caeb12 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -23,6 +23,7 @@
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/background/background_application_list_model.h"
+#include "chrome/browser/background/background_mode_optimizer.h"
#include "chrome/browser/background/background_trigger.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
@@ -92,6 +93,8 @@ void RecordMenuItemClick(MenuItem item) {
}
} // namespace
+bool BackgroundModeManager::should_restart_in_background_ = false;
sky 2016/07/22 16:57:52 in general we prefix statics like this with // sta
dgn 2016/07/25 17:32:28 Ah! on variables too, okay. Done.
+
BackgroundModeManager::BackgroundModeData::BackgroundModeData(
Profile* profile,
CommandIdHandlerVector* command_id_handler_vector)
@@ -287,6 +290,8 @@ BackgroundModeManager::BackgroundModeManager(
CHECK(g_browser_process != NULL);
CHECK(!browser_shutdown::IsTryingToQuit());
+ BackgroundModeManager::should_restart_in_background_ = false;
sky 2016/07/22 16:57:52 It isn't obvious why you need this here. Please ad
dgn 2016/07/25 17:32:28 Not needed. Removed.
+
// Add self as an observer for the ProfileAttributesStorage so we know when
// profiles are deleted and their names change.
profile_storage_->AddObserver(this);
@@ -318,6 +323,7 @@ BackgroundModeManager::BackgroundModeManager(
// in a mode that doesn't open a browser window. It will be resumed when the
// first browser window is opened.
SuspendBackgroundMode();
+ optimizer_ = BackgroundModeOptimizer::Create();
}
// If the -keep-alive-for-test flag is passed, then always keep chrome running
@@ -671,6 +677,7 @@ void BackgroundModeManager::ExecuteCommand(int command_id, int event_flags) {
// BackgroundModeManager, private
void BackgroundModeManager::ReleaseStartupKeepAliveCallback() {
keep_alive_for_startup_.reset();
+ optimizer_ = BackgroundModeOptimizer::Create();
}
void BackgroundModeManager::ReleaseStartupKeepAlive() {

Powered by Google App Engine
This is Rietveld 408576698