Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: base/memory/discardable_memory_mac.cc

Issue 448173002: Re-land: base: Introduce an explicit call for reducing emulated discardable memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 mac::ScopedMachVM memory_; 153 mac::ScopedMachVM memory_;
154 const size_t bytes_; 154 const size_t bytes_;
155 bool is_locked_; 155 bool is_locked_;
156 156
157 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMac); 157 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMac);
158 }; 158 };
159 159
160 } // namespace 160 } // namespace
161 161
162 // static 162 // static
163 void DiscardableMemory::RegisterMemoryPressureListeners() {
164 internal::DiscardableMemoryEmulated::RegisterMemoryPressureListeners();
165 }
166
167 // static
168 void DiscardableMemory::UnregisterMemoryPressureListeners() {
169 internal::DiscardableMemoryEmulated::UnregisterMemoryPressureListeners();
170 }
171
172 // static
173 bool DiscardableMemory::ReduceMemoryUsage() { 163 bool DiscardableMemory::ReduceMemoryUsage() {
174 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); 164 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage();
175 } 165 }
176 166
177 // static 167 // static
178 void DiscardableMemory::GetSupportedTypes( 168 void DiscardableMemory::GetSupportedTypes(
179 std::vector<DiscardableMemoryType>* types) { 169 std::vector<DiscardableMemoryType>* types) {
180 const DiscardableMemoryType supported_types[] = { 170 const DiscardableMemoryType supported_types[] = {
181 DISCARDABLE_MEMORY_TYPE_MAC, 171 DISCARDABLE_MEMORY_TYPE_MAC,
182 DISCARDABLE_MEMORY_TYPE_EMULATED, 172 DISCARDABLE_MEMORY_TYPE_EMULATED,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 212 }
223 213
224 // static 214 // static
225 void DiscardableMemory::PurgeForTesting() { 215 void DiscardableMemory::PurgeForTesting() {
226 int state = 0; 216 int state = 0;
227 vm_purgable_control(mach_task_self(), 0, VM_PURGABLE_PURGE_ALL, &state); 217 vm_purgable_control(mach_task_self(), 0, VM_PURGABLE_PURGE_ALL, &state);
228 internal::DiscardableMemoryEmulated::PurgeForTesting(); 218 internal::DiscardableMemoryEmulated::PurgeForTesting();
229 } 219 }
230 220
231 } // namespace base 221 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698