| 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 <mach/mach.h> | 7 #include <mach/mach.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void DiscardableMemory::RegisterMemoryPressureListeners() { | 159 void DiscardableMemory::RegisterMemoryPressureListeners() { |
| 160 internal::DiscardableMemoryEmulated::RegisterMemoryPressureListeners(); | 160 internal::DiscardableMemoryEmulated::RegisterMemoryPressureListeners(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // static | 163 // static |
| 164 void DiscardableMemory::UnregisterMemoryPressureListeners() { | 164 void DiscardableMemory::UnregisterMemoryPressureListeners() { |
| 165 internal::DiscardableMemoryEmulated::UnregisterMemoryPressureListeners(); | 165 internal::DiscardableMemoryEmulated::UnregisterMemoryPressureListeners(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // static | 168 // static |
| 169 bool DiscardableMemory::ReduceMemoryUsage() { |
| 170 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); |
| 171 } |
| 172 |
| 173 // static |
| 169 void DiscardableMemory::GetSupportedTypes( | 174 void DiscardableMemory::GetSupportedTypes( |
| 170 std::vector<DiscardableMemoryType>* types) { | 175 std::vector<DiscardableMemoryType>* types) { |
| 171 const DiscardableMemoryType supported_types[] = { | 176 const DiscardableMemoryType supported_types[] = { |
| 172 DISCARDABLE_MEMORY_TYPE_MAC, | 177 DISCARDABLE_MEMORY_TYPE_MAC, |
| 173 DISCARDABLE_MEMORY_TYPE_EMULATED, | 178 DISCARDABLE_MEMORY_TYPE_EMULATED, |
| 174 DISCARDABLE_MEMORY_TYPE_MALLOC | 179 DISCARDABLE_MEMORY_TYPE_MALLOC |
| 175 }; | 180 }; |
| 176 types->assign(supported_types, supported_types + arraysize(supported_types)); | 181 types->assign(supported_types, supported_types + arraysize(supported_types)); |
| 177 } | 182 } |
| 178 | 183 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 218 } |
| 214 | 219 |
| 215 // static | 220 // static |
| 216 void DiscardableMemory::PurgeForTesting() { | 221 void DiscardableMemory::PurgeForTesting() { |
| 217 int state = 0; | 222 int state = 0; |
| 218 vm_purgable_control(mach_task_self(), 0, VM_PURGABLE_PURGE_ALL, &state); | 223 vm_purgable_control(mach_task_self(), 0, VM_PURGABLE_PURGE_ALL, &state); |
| 219 internal::DiscardableMemoryEmulated::PurgeForTesting(); | 224 internal::DiscardableMemoryEmulated::PurgeForTesting(); |
| 220 } | 225 } |
| 221 | 226 |
| 222 } // namespace base | 227 } // namespace base |
| OLD | NEW |