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 #include "base/memory/discardable_memory.h" | 5 #include "base/memory/discardable_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/discardable_memory_emulated.h" | 8 #include "base/memory/discardable_memory_emulated.h" |
9 #include "base/memory/discardable_memory_mach.h" | 9 #include "base/memory/discardable_memory_mach.h" |
10 #include "base/memory/discardable_memory_manager.h" | 10 #include "base/memory/discardable_memory_manager.h" |
11 #include "base/memory/discardable_memory_shmem.h" | 11 #include "base/memory/discardable_memory_shmem.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 | 15 |
16 // static | 16 // static |
17 void DiscardableMemory::ReleaseFreeMemory() { | |
18 internal::DiscardableMemoryShmem::ReleaseFreeMemory(); | |
19 } | |
20 | |
21 // static | |
22 bool DiscardableMemory::ReduceMemoryUsage() { | 17 bool DiscardableMemory::ReduceMemoryUsage() { |
23 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); | 18 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); |
24 } | 19 } |
25 | 20 |
26 // static | 21 // static |
27 void DiscardableMemory::GetSupportedTypes( | 22 void DiscardableMemory::GetSupportedTypes( |
28 std::vector<DiscardableMemoryType>* types) { | 23 std::vector<DiscardableMemoryType>* types) { |
29 const DiscardableMemoryType supported_types[] = { | 24 const DiscardableMemoryType supported_types[] = { |
30 DISCARDABLE_MEMORY_TYPE_MACH, | 25 DISCARDABLE_MEMORY_TYPE_MACH, |
31 DISCARDABLE_MEMORY_TYPE_EMULATED, | 26 DISCARDABLE_MEMORY_TYPE_EMULATED, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 case DISCARDABLE_MEMORY_TYPE_NONE: | 60 case DISCARDABLE_MEMORY_TYPE_NONE: |
66 case DISCARDABLE_MEMORY_TYPE_ASHMEM: | 61 case DISCARDABLE_MEMORY_TYPE_ASHMEM: |
67 NOTREACHED(); | 62 NOTREACHED(); |
68 return nullptr; | 63 return nullptr; |
69 } | 64 } |
70 | 65 |
71 NOTREACHED(); | 66 NOTREACHED(); |
72 return nullptr; | 67 return nullptr; |
73 } | 68 } |
74 | 69 |
75 // static | |
76 void DiscardableMemory::PurgeForTesting() { | |
77 internal::DiscardableMemoryMach::PurgeForTesting(); | |
78 internal::DiscardableMemoryEmulated::PurgeForTesting(); | |
79 internal::DiscardableMemoryShmem::PurgeForTesting(); | |
80 } | |
81 | |
82 } // namespace base | 70 } // namespace base |
OLD | NEW |