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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // static | 21 // static |
22 bool DiscardableMemory::ReduceMemoryUsage() { | 22 bool DiscardableMemory::ReduceMemoryUsage() { |
23 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); | 23 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 void DiscardableMemory::GetSupportedTypes( | 27 void DiscardableMemory::GetSupportedTypes( |
28 std::vector<DiscardableMemoryType>* types) { | 28 std::vector<DiscardableMemoryType>* types) { |
29 const DiscardableMemoryType supported_types[] = { | 29 const DiscardableMemoryType supported_types[] = { |
30 DISCARDABLE_MEMORY_TYPE_MACH, | 30 DISCARDABLE_MEMORY_TYPE_MACH, |
31 DISCARDABLE_MEMORY_TYPE_EMULATED, | 31 DISCARDABLE_MEMORY_TYPE_SHMEM, |
32 DISCARDABLE_MEMORY_TYPE_SHMEM | 32 DISCARDABLE_MEMORY_TYPE_EMULATED |
33 }; | 33 }; |
34 types->assign(supported_types, supported_types + arraysize(supported_types)); | 34 types->assign(supported_types, supported_types + arraysize(supported_types)); |
35 } | 35 } |
36 | 36 |
37 // static | 37 // static |
38 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( | 38 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( |
39 DiscardableMemoryType type, size_t size) { | 39 DiscardableMemoryType type, size_t size) { |
40 switch (type) { | 40 switch (type) { |
41 case DISCARDABLE_MEMORY_TYPE_MACH: { | 41 case DISCARDABLE_MEMORY_TYPE_MACH: { |
42 scoped_ptr<internal::DiscardableMemoryMach> memory( | 42 scoped_ptr<internal::DiscardableMemoryMach> memory( |
(...skipping 30 matching lines...) Expand all Loading... |
73 } | 73 } |
74 | 74 |
75 // static | 75 // static |
76 void DiscardableMemory::PurgeForTesting() { | 76 void DiscardableMemory::PurgeForTesting() { |
77 internal::DiscardableMemoryMach::PurgeForTesting(); | 77 internal::DiscardableMemoryMach::PurgeForTesting(); |
78 internal::DiscardableMemoryEmulated::PurgeForTesting(); | 78 internal::DiscardableMemoryEmulated::PurgeForTesting(); |
79 internal::DiscardableMemoryShmem::PurgeForTesting(); | 79 internal::DiscardableMemoryShmem::PurgeForTesting(); |
80 } | 80 } |
81 | 81 |
82 } // namespace base | 82 } // namespace base |
OLD | NEW |