Chromium Code Reviews| Index: content/browser/memory/memory_coordinator_impl.h |
| diff --git a/content/browser/memory/memory_coordinator_impl.h b/content/browser/memory/memory_coordinator_impl.h |
| index f9792a8c67a7acca64f85fd57f6e6942d2f44f00..8c781030cd40254dcb37312cdfb453119c4bc64c 100644 |
| --- a/content/browser/memory/memory_coordinator_impl.h |
| +++ b/content/browser/memory/memory_coordinator_impl.h |
| @@ -47,11 +47,11 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator, |
| // MemoryCoordinator implementations: |
| void Start() override; |
| void OnChildAdded(int render_process_id) override; |
| - |
| - MemoryMonitor* memory_monitor() { return memory_monitor_.get(); } |
| - |
| base::MemoryState GetCurrentMemoryState() const override; |
| void SetCurrentMemoryStateForTesting(base::MemoryState memory_state) override; |
| + int64_t GetRemainingGlobalBudget() const override; |
| + |
| + MemoryMonitor* memory_monitor() { return memory_monitor_.get(); } |
| // NotificationObserver implementation: |
| void Observe(int type, |
| @@ -69,7 +69,10 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator, |
| // Calculates the next global state from the amount of free memory using |
| // a heuristic. |
| - MemoryState CalculateNextState(); |
| + MemoryState CalculateNextState(int free_memory_until_critical_mb); |
|
haraken
2016/11/05 12:52:21
int => int64_t ?
chrisha
2016/11/07 19:33:41
(Decided to move everything in the other direction
|
| + |
| + // Calculates the remaining global budget. |
| + int64_t CalculateRemainingGlobalBudget(int free_memory_until_critical_mb); |
| // Updates the global state and notifies state changes to clients (lives in |
| // the browser) and child processes (renderers) if necessary. |
| @@ -81,6 +84,9 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator, |
| // Notifies a state change to child processes. |
| void NotifyStateToChildren(); |
| + // Notifies a change in remaining global budget to children. |
| + void NotifyRemainingGlobalBudgetToChildren(); |
| + |
| // Schedules a task to update the global state. The task will be executed |
| // after |delay| has passed. |
| void ScheduleUpdateState(base::TimeDelta delay); |
| @@ -91,6 +97,7 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator, |
| base::Closure update_state_callback_; |
| base::MemoryState current_state_ = MemoryState::NORMAL; |
| base::TimeTicks last_state_change_; |
| + int64_t remaining_global_budget_mb_; |
| // Validates parameters defined below. |
| bool ValidateParameters(); |