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

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

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 | « no previous file | chrome/browser/background/background_mode_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/background/background_mode_manager.h
diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h
index 8bfabe87d6ee5fdc80119c82dcca6387d5fafd12..d17d8ada2f1adc7bf56cc2bc5ad4d5b0d1d162d1 100644
--- a/chrome/browser/background/background_mode_manager.h
+++ b/chrome/browser/background/background_mode_manager.h
@@ -26,6 +26,7 @@
#include "content/public/browser/notification_registrar.h"
#include "extensions/common/extension_id.h"
+class BackgroundModeOptimizer;
class BackgroundTrigger;
class Browser;
class PrefRegistrySimple;
@@ -79,6 +80,16 @@ class BackgroundModeManager
// Opens a new browser window if there isn't one for the active desktop.
static Browser* GetBrowserWindowForProfile(Profile* profile);
+ // Getter and setter for the flag indicating whether Chrome should start in
+ // background mode the next time.
+ static bool should_restart_in_background() {
+ return should_restart_in_background_;
+ }
+
+ static void set_should_restart_in_background(bool enable) {
+ should_restart_in_background_ = enable;
+ }
+
// Returns true if background mode is active.
virtual bool IsBackgroundModeActive();
@@ -314,7 +325,7 @@ class BackgroundModeManager
// and has a status bar icon.
void StartBackgroundMode();
- // Invoked to take Chrome out of KeepAlive mode - chrome stops running in
+ // Invoked to take Chrome out of KeepAlive mode - Chrome stops running in
// the background and removes its status bar icon.
void EndBackgroundMode();
@@ -389,6 +400,11 @@ class BackgroundModeManager
// if the profile isn't locked. Returns NULL otherwise.
BackgroundModeData* GetBackgroundModeDataForLastProfile() const;
+ // Set to true when the next restart should be done in background mode.
+ // Static because its value is read after the background mode manager is
+ // destroyed.
+ static bool should_restart_in_background_;
+
// Reference to the ProfileAttributesStorage. It is used to update the
// background app status of profiles when they open/close background apps.
ProfileAttributesStorage* profile_storage_;
@@ -431,6 +447,10 @@ class BackgroundModeManager
// chrome would immediately exit due to having no open windows.
std::unique_ptr<ScopedKeepAlive> keep_alive_for_startup_;
+ // Reference to the optimizer to use to reduce Chrome's footprint when in
+ // background mode. If null, optimizations are disabled.
+ std::unique_ptr<BackgroundModeOptimizer> optimizer_;
+
// Set to true when Chrome is running with the --keep-alive-for-test flag
// (used for testing background mode without having to install a background
// app).
« no previous file with comments | « no previous file | chrome/browser/background/background_mode_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698