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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « base/memory/discardable_memory.h ('k') | base/memory/discardable_memory_ashmem.h » ('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 26 matching lines...) Expand all
37 GetOptimalAshmemRegionSizeForAllocator()) {} 37 GetOptimalAshmemRegionSizeForAllocator()) {}
38 38
39 internal::DiscardableMemoryManager manager; 39 internal::DiscardableMemoryManager manager;
40 internal::DiscardableMemoryAshmemAllocator allocator; 40 internal::DiscardableMemoryAshmemAllocator allocator;
41 }; 41 };
42 LazyInstance<SharedState>::Leaky g_shared_state = LAZY_INSTANCE_INITIALIZER; 42 LazyInstance<SharedState>::Leaky g_shared_state = LAZY_INSTANCE_INITIALIZER;
43 43
44 } // namespace 44 } // namespace
45 45
46 // static 46 // static
47 void DiscardableMemory::ReleaseFreeMemory() {
48 internal::DiscardableMemoryShmem::ReleaseFreeMemory();
49 }
50
51 // static
52 bool DiscardableMemory::ReduceMemoryUsage() { 47 bool DiscardableMemory::ReduceMemoryUsage() {
53 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage(); 48 return internal::DiscardableMemoryEmulated::ReduceMemoryUsage();
54 } 49 }
55 50
56 // static 51 // static
57 void DiscardableMemory::GetSupportedTypes( 52 void DiscardableMemory::GetSupportedTypes(
58 std::vector<DiscardableMemoryType>* types) { 53 std::vector<DiscardableMemoryType>* types) {
59 const DiscardableMemoryType supported_types[] = { 54 const DiscardableMemoryType supported_types[] = {
60 DISCARDABLE_MEMORY_TYPE_ASHMEM, 55 DISCARDABLE_MEMORY_TYPE_ASHMEM,
61 DISCARDABLE_MEMORY_TYPE_EMULATED, 56 DISCARDABLE_MEMORY_TYPE_EMULATED,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 case DISCARDABLE_MEMORY_TYPE_NONE: 92 case DISCARDABLE_MEMORY_TYPE_NONE:
98 case DISCARDABLE_MEMORY_TYPE_MACH: 93 case DISCARDABLE_MEMORY_TYPE_MACH:
99 NOTREACHED(); 94 NOTREACHED();
100 return nullptr; 95 return nullptr;
101 } 96 }
102 97
103 NOTREACHED(); 98 NOTREACHED();
104 return nullptr; 99 return nullptr;
105 } 100 }
106 101
107 // static
108 void DiscardableMemory::PurgeForTesting() {
109 g_shared_state.Pointer()->manager.PurgeAll();
110 internal::DiscardableMemoryEmulated::PurgeForTesting();
111 internal::DiscardableMemoryShmem::PurgeForTesting();
112 }
113
114 } // namespace base 102 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory.h ('k') | base/memory/discardable_memory_ashmem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698