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

Side by Side Diff: base/memory/discardable_memory_android.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_android.h" 5 #include "base/memory/discardable_memory_android.h"
6 6
7 #include <sys/mman.h> 7 #include <sys/mman.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (failed) 115 if (failed)
116 DLOG(ERROR) << "Failed to unpin memory."; 116 DLOG(ERROR) << "Failed to unpin memory.";
117 // This allows us to catch accesses to unlocked memory. 117 // This allows us to catch accesses to unlocked memory.
118 DCHECK_EQ(0, mprotect(address, size, PROT_NONE)); 118 DCHECK_EQ(0, mprotect(address, size, PROT_NONE));
119 return !failed; 119 return !failed;
120 } 120 }
121 121
122 } // namespace internal 122 } // namespace internal
123 123
124 // static 124 // static
125 void DiscardableMemory::RegisterMemoryPressureListeners() {
126 internal::DiscardableMemoryEmulated::RegisterMemoryPressureListeners();
127 }
128
129 // static
130 void DiscardableMemory::UnregisterMemoryPressureListeners() {
131 internal::DiscardableMemoryEmulated::UnregisterMemoryPressureListeners();
132 }
133
134 // static
125 void DiscardableMemory::GetSupportedTypes( 135 void DiscardableMemory::GetSupportedTypes(
126 std::vector<DiscardableMemoryType>* types) { 136 std::vector<DiscardableMemoryType>* types) {
127 const DiscardableMemoryType supported_types[] = { 137 const DiscardableMemoryType supported_types[] = {
128 DISCARDABLE_MEMORY_TYPE_ANDROID, 138 DISCARDABLE_MEMORY_TYPE_ANDROID,
129 DISCARDABLE_MEMORY_TYPE_EMULATED 139 DISCARDABLE_MEMORY_TYPE_EMULATED
130 }; 140 };
131 types->assign(supported_types, supported_types + arraysize(supported_types)); 141 types->assign(supported_types, supported_types + arraysize(supported_types));
132 } 142 }
133 143
134 // static 144 // static
(...skipping 24 matching lines...) Expand all
159 bool DiscardableMemory::PurgeForTestingSupported() { 169 bool DiscardableMemory::PurgeForTestingSupported() {
160 return false; 170 return false;
161 } 171 }
162 172
163 // static 173 // static
164 void DiscardableMemory::PurgeForTesting() { 174 void DiscardableMemory::PurgeForTesting() {
165 NOTIMPLEMENTED(); 175 NOTIMPLEMENTED();
166 } 176 }
167 177
168 } // namespace base 178 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698