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

Unified Diff: chrome/browser/browser_shutdown.cc

Issue 1931503002: Add BackgroundModeOptimizer that can restart the browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PushKeepAlive
Patch Set: Switch the flag to disabled by default Created 4 years, 7 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/browser_shutdown.cc
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index b81446a2df396e80890d92efd58908abc00cbeab..90ceca86154e980f6ed566d2e87b5517367323f4 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -69,6 +69,10 @@ namespace {
// Whether the browser is trying to quit (e.g., Quit chosen from menu).
bool g_trying_to_quit = false;
+// If restarting and this is true then add the kNoStartupWindow switch to the
+// command line.
+bool g_should_restart_in_background = false;
+
Time* g_shutdown_started = nullptr;
ShutdownType g_shutdown_type = NOT_VALID;
int g_shutdown_num_processes;
@@ -239,6 +243,8 @@ void ShutdownPostThreadsStop(bool restart_last_session) {
else
new_cl->AppendSwitch(it.first);
}
+ if (g_should_restart_in_background)
sky 2016/05/18 19:23:06 Having a global is error prone. Can you make this
dgn 2016/06/20 17:45:19 Done. It made it a static class member in Backgrou
+ new_cl->AppendSwitch(switches::kNoStartupWindow);
#if defined(OS_POSIX) || defined(OS_WIN)
upgrade_util::RelaunchChromeBrowser(*new_cl.get());
@@ -335,6 +341,10 @@ bool IsTryingToQuit() {
return g_trying_to_quit;
}
+void SetShouldRestartInBackground(bool should_restart_in_background) {
+ g_should_restart_in_background = should_restart_in_background;
+}
+
void StartShutdownTracing() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();

Powered by Google App Engine
This is Rietveld 408576698