| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // static | 51 // static |
| 52 bool DiscardableMemory::ReduceMemoryUsage() { | 52 bool DiscardableMemory::ReduceMemoryUsage() { |
| 53 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); | 53 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // static | 56 // static |
| 57 void DiscardableMemory::GetSupportedTypes( | 57 void DiscardableMemory::GetSupportedTypes( |
| 58 std::vector<DiscardableMemoryType>* types) { | 58 std::vector<DiscardableMemoryType>* types) { |
| 59 const DiscardableMemoryType supported_types[] = { | 59 const DiscardableMemoryType supported_types[] = { |
| 60 DISCARDABLE_MEMORY_TYPE_ASHMEM, | 60 DISCARDABLE_MEMORY_TYPE_ASHMEM, |
| 61 DISCARDABLE_MEMORY_TYPE_SHMEM, | 61 DISCARDABLE_MEMORY_TYPE_EMULATED, |
| 62 DISCARDABLE_MEMORY_TYPE_EMULATED | 62 DISCARDABLE_MEMORY_TYPE_SHMEM |
| 63 }; | 63 }; |
| 64 types->assign(supported_types, supported_types + arraysize(supported_types)); | 64 types->assign(supported_types, supported_types + arraysize(supported_types)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( | 68 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( |
| 69 DiscardableMemoryType type, size_t size) { | 69 DiscardableMemoryType type, size_t size) { |
| 70 switch (type) { | 70 switch (type) { |
| 71 case DISCARDABLE_MEMORY_TYPE_ASHMEM: { | 71 case DISCARDABLE_MEMORY_TYPE_ASHMEM: { |
| 72 SharedState* const shared_state = g_shared_state.Pointer(); | 72 SharedState* const shared_state = g_shared_state.Pointer(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 // static | 107 // static |
| 108 void DiscardableMemory::PurgeForTesting() { | 108 void DiscardableMemory::PurgeForTesting() { |
| 109 g_shared_state.Pointer()->manager.PurgeAll(); | 109 g_shared_state.Pointer()->manager.PurgeAll(); |
| 110 internal::DiscardableMemoryEmulated::PurgeForTesting(); | 110 internal::DiscardableMemoryEmulated::PurgeForTesting(); |
| 111 internal::DiscardableMemoryShmem::PurgeForTesting(); | 111 internal::DiscardableMemoryShmem::PurgeForTesting(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace base | 114 } // namespace base |
| OLD | NEW |