| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_MEMORY_MEMORY_COORDINATOR_CLIENT_H_ | 5 #ifndef BASE_MEMORY_MEMORY_COORDINATOR_CLIENT_H_ |
| 6 #define BASE_MEMORY_MEMORY_COORDINATOR_CLIENT_H_ | 6 #define BASE_MEMORY_MEMORY_COORDINATOR_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // any memory whose contents can be reproduced when transitioning out of | 36 // any memory whose contents can be reproduced when transitioning out of |
| 37 // the suspended state (e.g. parsed resource that can be reloaded from disk). | 37 // the suspended state (e.g. parsed resource that can be reloaded from disk). |
| 38 SUSPENDED = 2, | 38 SUSPENDED = 2, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // This is an interface for components which can respond to memory status | 41 // This is an interface for components which can respond to memory status |
| 42 // changes. An initial state is NORMAL. See MemoryCoordinatorClientRegistry for | 42 // changes. An initial state is NORMAL. See MemoryCoordinatorClientRegistry for |
| 43 // threading guarantees and ownership management. | 43 // threading guarantees and ownership management. |
| 44 class BASE_EXPORT MemoryCoordinatorClient { | 44 class BASE_EXPORT MemoryCoordinatorClient { |
| 45 public: | 45 public: |
| 46 virtual ~MemoryCoordinatorClient() {} | |
| 47 | |
| 48 // Called when memory state has changed. Any transition can occur except for | 46 // Called when memory state has changed. Any transition can occur except for |
| 49 // UNKNOWN. General guidelines are: | 47 // UNKNOWN. General guidelines are: |
| 50 // * NORMAL: Restore the default settings for memory allocation/usage if | 48 // * NORMAL: Restore the default settings for memory allocation/usage if |
| 51 // it has changed. | 49 // it has changed. |
| 52 // * THROTTLED: Use smaller limits for memory allocations and caches. | 50 // * THROTTLED: Use smaller limits for memory allocations and caches. |
| 53 // * SUSPENDED: Purge memory. | 51 // * SUSPENDED: Purge memory. |
| 54 virtual void OnMemoryStateChange(MemoryState state) = 0; | 52 virtual void OnMemoryStateChange(MemoryState state) = 0; |
| 53 |
| 54 protected: |
| 55 virtual ~MemoryCoordinatorClient() {} |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 } // namespace base | 58 } // namespace base |
| 58 | 59 |
| 59 #endif // BASE_MEMORY_MEMORY_COORDINATOR_CLIENT_H_ | 60 #endif // BASE_MEMORY_MEMORY_COORDINATOR_CLIENT_H_ |
| OLD | NEW |