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

Side by Side Diff: chrome/browser/background/background_mode_optimizer.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_OPTIMIZER_H_
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_OPTIMIZER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "chrome/browser/lifetime/keep_alive_state_observer.h"
12
13 class Browser;
14
15 // BackgroundModeOptimizer is responsible for applying some optimizations to
16 // save resources (memory) when Chrome runs in background-only mode.
17 // It tries to restart the browser to release accumulated memory when it
18 // is considered non distruptive.
19 class BackgroundModeOptimizer : public KeepAliveStateObserver {
20 public:
21 // Creates a new BackgroundModeOptimizer. Can return null if optimizations
22 // are not supported.
23 static std::unique_ptr<BackgroundModeOptimizer> Create();
sky 2016/05/18 19:23:06 nit: constructor/destructor before other methods.
dgn 2016/06/20 17:45:18 Done.
24 ~BackgroundModeOptimizer() override;
25
26 // KeepAliveStateObserver implementation
27 void OnKeepAliveStateChanged(bool is_keeping_alive) override;
28 void OnKeepAliveRestartStateChanged(bool can_restart) override;
29
30 private:
31 BackgroundModeOptimizer();
32 void TryBrowserRestart();
sky 2016/05/18 19:23:06 nit: newline between 31/32 and a description for T
dgn 2016/06/20 17:45:18 Done.
33
34 DISALLOW_COPY_AND_ASSIGN(BackgroundModeOptimizer);
35 };
36
37 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698