OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_DISCARDABLE_MEMORY_H_ | 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_ |
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_H_ | 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 | 17 |
18 enum DiscardableMemoryType { | 18 enum DiscardableMemoryType { |
19 DISCARDABLE_MEMORY_TYPE_NONE, | 19 DISCARDABLE_MEMORY_TYPE_NONE, |
20 DISCARDABLE_MEMORY_TYPE_ANDROID, | 20 DISCARDABLE_MEMORY_TYPE_ANDROID, |
21 DISCARDABLE_MEMORY_TYPE_MAC, | 21 DISCARDABLE_MEMORY_TYPE_MAC, |
22 DISCARDABLE_MEMORY_TYPE_EMULATED | 22 DISCARDABLE_MEMORY_TYPE_EMULATED, |
| 23 DISCARDABLE_MEMORY_TYPE_MALLOC |
23 }; | 24 }; |
24 | 25 |
25 enum DiscardableMemoryLockStatus { | 26 enum DiscardableMemoryLockStatus { |
26 DISCARDABLE_MEMORY_LOCK_STATUS_FAILED, | 27 DISCARDABLE_MEMORY_LOCK_STATUS_FAILED, |
27 DISCARDABLE_MEMORY_LOCK_STATUS_PURGED, | 28 DISCARDABLE_MEMORY_LOCK_STATUS_PURGED, |
28 DISCARDABLE_MEMORY_LOCK_STATUS_SUCCESS | 29 DISCARDABLE_MEMORY_LOCK_STATUS_SUCCESS |
29 }; | 30 }; |
30 | 31 |
31 // Platform abstraction for discardable memory. DiscardableMemory is used to | 32 // Platform abstraction for discardable memory. DiscardableMemory is used to |
32 // cache large objects without worrying about blowing out memory, both on mobile | 33 // cache large objects without worrying about blowing out memory, both on mobile |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 static bool PurgeForTestingSupported(); | 120 static bool PurgeForTestingSupported(); |
120 | 121 |
121 // Purge all discardable memory in the system. This call has global effects | 122 // Purge all discardable memory in the system. This call has global effects |
122 // across all running processes, so it should only be used for testing! | 123 // across all running processes, so it should only be used for testing! |
123 static void PurgeForTesting(); | 124 static void PurgeForTesting(); |
124 }; | 125 }; |
125 | 126 |
126 } // namespace base | 127 } // namespace base |
127 | 128 |
128 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_ | 129 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_ |
OLD | NEW |