Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_ | |
| OLD | NEW |