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

Side by Side Diff: base/memory/discardable_memory_android.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 | « no previous file | base/memory/discardable_memory_linux.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 (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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // static 51 // static
52 bool DiscardableMemory::ReduceMemoryUsage() { 52 bool DiscardableMemory::ReduceMemoryUsage() {
53 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); 53 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage();
54 } 54 }
55 55
56 // static 56 // static
57 void DiscardableMemory::GetSupportedTypes( 57 void DiscardableMemory::GetSupportedTypes(
58 std::vector<DiscardableMemoryType>* types) { 58 std::vector<DiscardableMemoryType>* types) {
59 const DiscardableMemoryType supported_types[] = { 59 const DiscardableMemoryType supported_types[] = {
60 DISCARDABLE_MEMORY_TYPE_ASHMEM, 60 DISCARDABLE_MEMORY_TYPE_ASHMEM,
61 DISCARDABLE_MEMORY_TYPE_EMULATED, 61 DISCARDABLE_MEMORY_TYPE_SHMEM,
62 DISCARDABLE_MEMORY_TYPE_SHMEM 62 DISCARDABLE_MEMORY_TYPE_EMULATED
63 }; 63 };
64 types->assign(supported_types, supported_types + arraysize(supported_types)); 64 types->assign(supported_types, supported_types + arraysize(supported_types));
65 } 65 }
66 66
67 // static 67 // static
68 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( 68 scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
69 DiscardableMemoryType type, size_t size) { 69 DiscardableMemoryType type, size_t size) {
70 switch (type) { 70 switch (type) {
71 case DISCARDABLE_MEMORY_TYPE_ASHMEM: { 71 case DISCARDABLE_MEMORY_TYPE_ASHMEM: {
72 SharedState* const shared_state = g_shared_state.Pointer(); 72 SharedState* const shared_state = g_shared_state.Pointer();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 // static 107 // static
108 void DiscardableMemory::PurgeForTesting() { 108 void DiscardableMemory::PurgeForTesting() {
109 g_shared_state.Pointer()->manager.PurgeAll(); 109 g_shared_state.Pointer()->manager.PurgeAll();
110 internal::DiscardableMemoryEmulated::PurgeForTesting(); 110 internal::DiscardableMemoryEmulated::PurgeForTesting();
111 internal::DiscardableMemoryShmem::PurgeForTesting(); 111 internal::DiscardableMemoryShmem::PurgeForTesting();
112 } 112 }
113 113
114 } // namespace base 114 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/memory/discardable_memory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698