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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 1931503002: Add BackgroundModeOptimizer that can restart the browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PushKeepAlive
Patch Set: address comments. disable feature by default 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
« no previous file with comments | « chrome/browser/browser_shutdown.cc ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 0e43db3d18bfc0a510efad5e3f0f04a002d75c32..1f6d59e2df6ca8656be35523db5a7a964091d669 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -232,6 +232,10 @@
#include "components/nacl/browser/nacl_process_host.h"
#endif // !defined(DISABLE_NACL)
+#if BUILDFLAG(ENABLE_BACKGROUND)
+#include "chrome/browser/background/background_mode_manager.h"
+#endif // BUILDFLAG(ENABLE_BACKGROUND)
+
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/startup_helper.h"
#include "extensions/browser/extension_protocols.h"
@@ -2016,11 +2020,24 @@ void ChromeBrowserMainParts::PostDestroyThreads() {
// not finish.
NOTREACHED();
#else
+
+ int restart_flags = restart_last_session_
+ ? browser_shutdown::RESTART_LAST_SESSION
+ : browser_shutdown::NO_FLAGS;
+
+#if BUILDFLAG(ENABLE_BACKGROUND)
+ if (restart_flags) {
+ restart_flags |= BackgroundModeManager::should_restart_in_background()
+ ? browser_shutdown::RESTART_IN_BACKGROUND
+ : browser_shutdown::NO_FLAGS;
+ }
+#endif // BUILDFLAG(ENABLE_BACKGROUND)
+
browser_process_->PostDestroyThreads();
// browser_shutdown takes care of deleting browser_process, so we need to
// release it.
ignore_result(browser_process_.release());
- browser_shutdown::ShutdownPostThreadsStop(restart_last_session_);
+ browser_shutdown::ShutdownPostThreadsStop(restart_flags);
master_prefs_.reset();
process_singleton_.reset();
device_event_log::Shutdown();
« no previous file with comments | « chrome/browser/browser_shutdown.cc ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698