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

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

Issue 793443003: Re-land: base: Enable browser-wide discardable memory on Linux, CrOS and Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@free-list
Patch Set: Created 6 years 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
« no previous file with comments | « base/memory/discardable_memory_android.cc ('k') | base/memory/discardable_memory_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/discardable_memory_emulated.h" 8 #include "base/memory/discardable_memory_emulated.h"
9 #include "base/memory/discardable_memory_shmem.h" 9 #include "base/memory/discardable_memory_shmem.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 // static 13 // static
14 void DiscardableMemory::ReleaseFreeMemory() { 14 void DiscardableMemory::ReleaseFreeMemory() {
15 internal::DiscardableMemoryShmem::ReleaseFreeMemory(); 15 internal::DiscardableMemoryShmem::ReleaseFreeMemory();
16 } 16 }
17 17
18 // static 18 // static
19 bool DiscardableMemory::ReduceMemoryUsage() { 19 bool DiscardableMemory::ReduceMemoryUsage() {
20 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); 20 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage();
21 } 21 }
22 22
23 // static 23 // static
24 void DiscardableMemory::GetSupportedTypes( 24 void DiscardableMemory::GetSupportedTypes(
25 std::vector<DiscardableMemoryType>* types) { 25 std::vector<DiscardableMemoryType>* types) {
26 const DiscardableMemoryType supported_types[] = { 26 const DiscardableMemoryType supported_types[] = {
27 DISCARDABLE_MEMORY_TYPE_EMULATED, 27 DISCARDABLE_MEMORY_TYPE_SHMEM,
28 DISCARDABLE_MEMORY_TYPE_SHMEM 28 DISCARDABLE_MEMORY_TYPE_EMULATED
29 }; 29 };
30 types->assign(supported_types, supported_types + arraysize(supported_types)); 30 types->assign(supported_types, supported_types + arraysize(supported_types));
31 } 31 }
32 32
33 // static 33 // static
34 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( 34 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
35 DiscardableMemoryType type, size_t size) { 35 DiscardableMemoryType type, size_t size) {
36 switch (type) { 36 switch (type) {
37 case DISCARDABLE_MEMORY_TYPE_EMULATED: { 37 case DISCARDABLE_MEMORY_TYPE_EMULATED: {
38 scoped_ptr<internal::DiscardableMemoryEmulated> memory( 38 scoped_ptr<internal::DiscardableMemoryEmulated> memory(
(...skipping 22 matching lines...) Expand all
61 return nullptr; 61 return nullptr;
62 } 62 }
63 63
64 // static 64 // static
65 void DiscardableMemory::PurgeForTesting() { 65 void DiscardableMemory::PurgeForTesting() {
66 internal::DiscardableMemoryEmulated::PurgeForTesting(); 66 internal::DiscardableMemoryEmulated::PurgeForTesting();
67 internal::DiscardableMemoryShmem::PurgeForTesting(); 67 internal::DiscardableMemoryShmem::PurgeForTesting();
68 } 68 }
69 69
70 } // namespace base 70 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_android.cc ('k') | base/memory/discardable_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698