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

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

Issue 458343003: Revert of base: Introduce an explicit call for reducing emulated discardable memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
67 // Gets the discardable memory type with a given name. 75 // Gets the discardable memory type with a given name.
68 static DiscardableMemoryType GetNamedType(const std::string& name); 76 static DiscardableMemoryType GetNamedType(const std::string& name);
69 77
70 // Gets the name of a discardable memory type. 78 // Gets the name of a discardable memory type.
71 static const char* GetTypeName(DiscardableMemoryType type); 79 static const char* GetTypeName(DiscardableMemoryType type);
72 80
73 // Gets system supported discardable memory types. Default preferred type 81 // Gets system supported discardable memory types. Default preferred type
74 // at the front of vector. 82 // at the front of vector.
75 static void GetSupportedTypes(std::vector<DiscardableMemoryType>* types); 83 static void GetSupportedTypes(std::vector<DiscardableMemoryType>* types);
76 84
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Testing utility calls. 126 // Testing utility calls.
119 127
120 // Purge all discardable memory in the system. This call has global effects 128 // Purge all discardable memory in the system. This call has global effects
121 // across all running processes, so it should only be used for testing! 129 // across all running processes, so it should only be used for testing!
122 static void PurgeForTesting(); 130 static void PurgeForTesting();
123 }; 131 };
124 132
125 } // namespace base 133 } // namespace base
126 134
127 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_ 135 #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