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

Unified Diff: content/browser/memory/memory_state_updater.h

Issue 2718963002: Drop the global memory state from memory coordinator (Closed)
Patch Set: tweak Created 3 years, 10 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: content/browser/memory/memory_state_updater.h
diff --git a/content/browser/memory/memory_state_updater.h b/content/browser/memory/memory_state_updater.h
index 2c8998a853054ac2caec1969905220538e438e6b..331264ae7f79c065394e8b1529cd3d4a2619202e 100644
--- a/content/browser/memory/memory_state_updater.h
+++ b/content/browser/memory/memory_state_updater.h
@@ -13,6 +13,9 @@
namespace content {
+// TODO(bashi): Rename MemoryStateUpdater -> MemoryConditionObserver?
+// TODO(bashi): Update the comments.
+
// MemoryStateUpdater is an internal implementation of MemoryCoordinator
// which uses a heuristic to determine a single global memory state.
// In the current implementation browser process and renderer processes share
@@ -35,13 +38,9 @@ class CONTENT_EXPORT MemoryStateUpdater {
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
~MemoryStateUpdater();
- // Calculates the next global state from the amount of free memory using
- // a heuristic.
- base::MemoryState CalculateNextState();
-
- // Schedules a task to update the global state. The task will be executed
+ // Schedules a task to update memory condition. The task will be executed
// after |delay| has passed.
- void ScheduleUpdateState(base::TimeDelta delay);
+ void ScheduleUpdateCondition(base::TimeDelta delay);
private:
FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, CalculateNextState);
@@ -49,12 +48,16 @@ class CONTENT_EXPORT MemoryStateUpdater {
FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, SetMemoryStateForTesting);
FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, ForceSetGlobalState);
- // Periodically called to update the global state.
- void UpdateState();
+ // Calculates next memory condition from the amount of free memory using
+ // a heuristic.
+ MemoryCondition CalculateNextCondition();
+
+ // Periodically called to update the memory condition.
+ void UpdateCondition();
MemoryCoordinatorImpl* coordinator_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- base::CancelableClosure update_state_closure_;
+ base::CancelableClosure update_condition_closure_;
// Sets up parameters for the heuristic.
void InitializeParameters();
@@ -63,6 +66,7 @@ class CONTENT_EXPORT MemoryStateUpdater {
bool ValidateParameters();
// Parameters to control the heuristic.
+ // TODO(bashi): Rename these parameters.
// The median size of a renderer on the current platform. This is used to
// convert the amount of free memory to an expected number of new renderers

Powered by Google App Engine
This is Rietveld 408576698