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

Side by Side Diff: base/memory/discardable_memory.h

Issue 448173002: Re-land: base: Introduce an explicit call for reducing emulated discardable memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable EmulatedDiscardableMemoryDiscardedWhenWidgetsHidden with lsan Created 6 years, 4 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
« no previous file with comments | « no previous file | base/memory/discardable_memory_android.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 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_H_ 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // - Linux: http://lwn.net/Articles/452035/ 57 // - Linux: http://lwn.net/Articles/452035/
58 // - Mac: http://trac.webkit.org/browser/trunk/Source/WebCore/platform/mac/Pur geableBufferMac.cpp 58 // - Mac: http://trac.webkit.org/browser/trunk/Source/WebCore/platform/mac/Pur geableBufferMac.cpp
59 // the comment starting with "vm_object_purgable_control" at 59 // the comment starting with "vm_object_purgable_control" at
60 // http://www.opensource.apple.com/source/xnu/xnu-792.13.8/osfmk/vm/v m_object.c 60 // http://www.opensource.apple.com/source/xnu/xnu-792.13.8/osfmk/vm/v m_object.c
61 // 61 //
62 // Thread-safety: DiscardableMemory instances are not thread-safe. 62 // Thread-safety: DiscardableMemory instances are not thread-safe.
63 class BASE_EXPORT DiscardableMemory { 63 class BASE_EXPORT DiscardableMemory {
64 public: 64 public:
65 virtual ~DiscardableMemory() {} 65 virtual ~DiscardableMemory() {}
66 66
67 // Call this on a thread with a MessageLoop current to allow discardable
68 // memory implementations to respond to memory pressure signals.
69 static void RegisterMemoryPressureListeners();
70
71 // Call this to prevent discardable memory implementations from responding
72 // to memory pressure signals.
73 static void UnregisterMemoryPressureListeners();
74
75 // Gets the discardable memory type with a given name. 67 // Gets the discardable memory type with a given name.
76 static DiscardableMemoryType GetNamedType(const std::string& name); 68 static DiscardableMemoryType GetNamedType(const std::string& name);
77 69
78 // Gets the name of a discardable memory type. 70 // Gets the name of a discardable memory type.
79 static const char* GetTypeName(DiscardableMemoryType type); 71 static const char* GetTypeName(DiscardableMemoryType type);
80 72
81 // Gets system supported discardable memory types. Default preferred type 73 // Gets system supported discardable memory types. Default preferred type
82 // at the front of vector. 74 // at the front of vector.
83 static void GetSupportedTypes(std::vector<DiscardableMemoryType>* types); 75 static void GetSupportedTypes(std::vector<DiscardableMemoryType>* types);
84 76
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Testing utility calls. 118 // Testing utility calls.
127 119
128 // Purge all discardable memory in the system. This call has global effects 120 // Purge all discardable memory in the system. This call has global effects
129 // across all running processes, so it should only be used for testing! 121 // across all running processes, so it should only be used for testing!
130 static void PurgeForTesting(); 122 static void PurgeForTesting();
131 }; 123 };
132 124
133 } // namespace base 125 } // namespace base
134 126
135 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_ 127 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/discardable_memory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698