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

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

Issue 129963002: Re-land: base: Fix registering of memory pressure listeners used when emulating discardable memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Temporarily disable memory_pressure_listener DCHECK Created 6 years, 11 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 #include <sys/mman.h> 8 #include <sys/mman.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 private: 82 private:
83 vm_address_t buffer_; 83 vm_address_t buffer_;
84 const size_t size_; 84 const size_t size_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMac); 86 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMac);
87 }; 87 };
88 88
89 } // namespace 89 } // namespace
90 90
91 // static 91 // static
92 void DiscardableMemory::RegisterMemoryPressureListeners() {
93 internal::DiscardableMemoryEmulated::RegisterMemoryPressureListeners();
94 }
95
96 // static
97 void DiscardableMemory::UnregisterMemoryPressureListeners() {
98 internal::DiscardableMemoryEmulated::UnregisterMemoryPressureListeners();
99 }
100
101 // static
92 void DiscardableMemory::GetSupportedTypes( 102 void DiscardableMemory::GetSupportedTypes(
93 std::vector<DiscardableMemoryType>* types) { 103 std::vector<DiscardableMemoryType>* types) {
94 const DiscardableMemoryType supported_types[] = { 104 const DiscardableMemoryType supported_types[] = {
95 DISCARDABLE_MEMORY_TYPE_MAC, 105 DISCARDABLE_MEMORY_TYPE_MAC,
96 DISCARDABLE_MEMORY_TYPE_EMULATED 106 DISCARDABLE_MEMORY_TYPE_EMULATED
97 }; 107 };
98 types->assign(supported_types, supported_types + arraysize(supported_types)); 108 types->assign(supported_types, supported_types + arraysize(supported_types));
99 } 109 }
100 110
101 // static 111 // static
(...skipping 30 matching lines...) Expand all
132 } 142 }
133 143
134 // static 144 // static
135 void DiscardableMemory::PurgeForTesting() { 145 void DiscardableMemory::PurgeForTesting() {
136 int state = 0; 146 int state = 0;
137 vm_purgable_control(mach_task_self(), 0, VM_PURGABLE_PURGE_ALL, &state); 147 vm_purgable_control(mach_task_self(), 0, VM_PURGABLE_PURGE_ALL, &state);
138 internal::DiscardableMemoryEmulated::PurgeForTesting(); 148 internal::DiscardableMemoryEmulated::PurgeForTesting();
139 } 149 }
140 150
141 } // namespace base 151 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698