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

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

Issue 17106004: Add discardable memory emulation for non-android/mac platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix MemoryAfterUnlock test Created 7 years, 1 month 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 <sys/mman.h> 7 #include <sys/mman.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const int fd_; 128 const int fd_;
129 void* const memory_; 129 void* const memory_;
130 const size_t size_; 130 const size_t size_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAndroid); 132 DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAndroid);
133 }; 133 };
134 134
135 } // namespace 135 } // namespace
136 136
137 // static 137 // static
138 bool DiscardableMemory::Supported() { 138 bool DiscardableMemory::SupportedNatively() {
139 return true; 139 return true;
140 } 140 }
141 141
142 // static 142 // static
143 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemory( 143 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemory(
144 size_t size) { 144 size_t size) {
145 // Pinning & unpinning works with page granularity therefore align the size 145 // Pinning & unpinning works with page granularity therefore align the size
146 // upfront. 146 // upfront.
147 const size_t kPageSize = 4096; 147 const size_t kPageSize = 4096;
148 const size_t mask = ~(kPageSize - 1); 148 const size_t mask = ~(kPageSize - 1);
(...skipping 10 matching lines...) Expand all
159 bool DiscardableMemory::PurgeForTestingSupported() { 159 bool DiscardableMemory::PurgeForTestingSupported() {
160 return false; 160 return false;
161 } 161 }
162 162
163 // static 163 // static
164 void DiscardableMemory::PurgeForTesting() { 164 void DiscardableMemory::PurgeForTesting() {
165 NOTIMPLEMENTED(); 165 NOTIMPLEMENTED();
166 } 166 }
167 167
168 } // namespace base 168 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698