Chromium Code Reviews| Index: base/memory/memory_coordinator_client.h |
| diff --git a/base/memory/memory_coordinator_client.h b/base/memory/memory_coordinator_client.h |
| index da7104a8d94395decb299f15e86aa79069ce2e32..6008243e5e6c88e9f5375349182341a4c3ad5f8e 100644 |
| --- a/base/memory/memory_coordinator_client.h |
| +++ b/base/memory/memory_coordinator_client.h |
| @@ -9,6 +9,14 @@ |
| namespace base { |
| +// OVERVIEW: |
| +// |
| +// MemoryCoordinatorClient is an interface which a component can implement to |
| +// respond to memory state changes. Unlike MemoryPressureListener, this is a |
| +// stateful mechanism and clients receive notifications only when memory states |
|
hajimehoshi
2016/09/26 07:08:13
s/receive/that receive/
bashi
2016/09/26 07:54:13
Done.
|
| +// are changed. State transitions are throttled to avoid thrashing; the exact |
| +// throttling period is platform dependent, but will be at least 5-10 seconds. |
| + |
| // MemoryState is an indicator that processes can use to guide their memory |
| // allocation policies. For example, a process that receives the suspended |
| // state can use that as as signal to drop memory caches. |
| @@ -24,12 +32,18 @@ enum class MemoryState { |
| }; |
| // This is an interface for components which can respond to memory status |
| -// changes. |
| +// changes. An initial state is NORMAL. See MemoryCoordinatorClientRegistry for |
| +// threading guarantees and ownership management. |
| class BASE_EXPORT MemoryCoordinatorClient { |
| public: |
| virtual ~MemoryCoordinatorClient() {} |
| - // Called when memory state has changed. |
| + // Called when memory state has changed. Any transition can occur except for |
| + // UNKNOWN. General guidelines are: |
| + // * NORMAL: Restore the default settings for memory allocation/usage if |
| + // it has changed. |
| + // * THROTTLED: Use smaller limits for memory allocations and caches. |
| + // * SUSPENDED: Purge memory. |
| virtual void OnMemoryStateChange(MemoryState state) = 0; |
| }; |