Chromium Code Reviews| Index: base/memory/discardable_memory.h |
| diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h |
| index cbc2db630a86f6e5a7b5483723cd52f75fecf380..7ca5cb6e1e76a834ed512ee16a292df2a2e9696f 100644 |
| --- a/base/memory/discardable_memory.h |
| +++ b/base/memory/discardable_memory.h |
| @@ -5,6 +5,8 @@ |
| #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_ |
| #define BASE_MEMORY_DISCARDABLE_MEMORY_H_ |
| +#include <vector> |
| + |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| @@ -12,6 +14,13 @@ |
| namespace base { |
| +enum DiscardableMemoryType { |
| + DISCARDABLE_MEMORY_NONE, |
| + DISCARDABLE_MEMORY_ANDROID, |
|
reveman
2013/12/13 18:21:53
Follow up patches will replace this with DISCARDAB
|
| + DISCARDABLE_MEMORY_MAC, |
|
reveman
2013/12/13 18:21:53
We might want to rename this to DISCARDABLE_MEMORY
|
| + DISCARDABLE_MEMORY_EMULATED |
| +}; |
| + |
| enum LockDiscardableMemoryStatus { |
|
reveman
2013/12/16 21:05:51
How about we rename this to DiscardableMemoryLockS
Philippe
2013/12/17 14:28:21
SGTM
reveman
2013/12/18 08:12:38
Done.
|
| DISCARDABLE_MEMORY_FAILED = -1, |
| DISCARDABLE_MEMORY_PURGED = 0, |
| @@ -53,9 +62,15 @@ class BASE_EXPORT DiscardableMemory { |
| public: |
| virtual ~DiscardableMemory() {} |
| - // Check whether the system supports discardable memory natively. Returns |
| - // false if the support is emulated. |
| - static bool SupportedNatively(); |
| + // Get system supported discardable memory types. Preferred type at the front |
| + // of vector. |
| + static const std::vector<DiscardableMemoryType>& GetSupportedTypes(); |
| + |
| + // Set the current discardable memory type. |
| + static void SetType(DiscardableMemoryType type); |
| + |
| + // Get the current discardable memory type. |
| + static DiscardableMemoryType GetType(); |
| static scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size); |