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

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: Addressing review. Created 7 years, 3 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 <sys/mman.h> 7 #include <sys/mman.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 12 matching lines...) Expand all
23 23
24 // Upper limit on the number of discardable memory to avoid hitting file 24 // Upper limit on the number of discardable memory to avoid hitting file
25 // descriptor limit. 25 // descriptor limit.
26 const int kDiscardableMemoryNumLimit = 128; 26 const int kDiscardableMemoryNumLimit = 128;
27 27
28 } 28 }
29 29
30 namespace base { 30 namespace base {
31 31
32 // static 32 // static
33 bool DiscardableMemory::Supported() { 33 bool DiscardableMemory::SupportedNatively() {
34 return true; 34 return true;
35 } 35 }
36 36
37 DiscardableMemory::~DiscardableMemory() { 37 DiscardableMemory::~DiscardableMemory() {
38 if (is_locked_) 38 if (is_locked_)
39 Unlock(); 39 Unlock();
40 // If fd_ is smaller than 0, initialization must have failed and 40 // If fd_ is smaller than 0, initialization must have failed and
41 // g_num_discardable_memory is not incremented by the caller. 41 // g_num_discardable_memory is not incremented by the caller.
42 if (fd_ < 0) 42 if (fd_ < 0)
43 return; 43 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 bool DiscardableMemory::PurgeForTestingSupported() { 155 bool DiscardableMemory::PurgeForTestingSupported() {
156 return false; 156 return false;
157 } 157 }
158 158
159 // static 159 // static
160 void DiscardableMemory::PurgeForTesting() { 160 void DiscardableMemory::PurgeForTesting() {
161 NOTIMPLEMENTED(); 161 NOTIMPLEMENTED();
162 } 162 }
163 163
164 } // namespace base 164 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698