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

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: cleanup, enable by default (that's just to verify the tests) 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/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 54df3f5641ce39e4442445d9eab7d90651824854..887c629b7b68bfb8583a89f0114c33cffb427560 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"
@@ -2014,11 +2018,19 @@ void ChromeBrowserMainParts::PostDestroyThreads() {
// not finish.
NOTREACHED();
#else
+
+ bool restart_in_background = false;
+
+#if BUILDFLAG(ENABLE_BACKGROUND)
+ restart_in_background = BackgroundModeManager::ShouldRestartInBackground();
sky 2016/07/06 16:55:33 Doesn't this only matter if restart_last_session_?
dgn 2016/07/22 15:18:09 Yes, made that explicit here.
+#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_last_session_,
+ restart_in_background);
master_prefs_.reset();
process_singleton_.reset();
device_event_log::Shutdown();

Powered by Google App Engine
This is Rietveld 408576698