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

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

Issue 1312163003: Add method for suppressing MemoryPressureListener notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address thestig's comments Created 5 years, 3 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/base.gyp ('k') | base/memory/memory_pressure_listener.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 // MemoryPressure provides static APIs for handling memory pressure on 5 // MemoryPressure provides static APIs for handling memory pressure on
6 // platforms that have such signals, such as Android and ChromeOS. 6 // platforms that have such signals, such as Android and ChromeOS.
7 // The app will try to discard buffers that aren't deemed essential (individual 7 // The app will try to discard buffers that aren't deemed essential (individual
8 // modules will implement their own policy). 8 // modules will implement their own policy).
9 9
10 #ifndef BASE_MEMORY_MEMORY_PRESSURE_LISTENER_H_ 10 #ifndef BASE_MEMORY_MEMORY_PRESSURE_LISTENER_H_
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 typedef base::Callback<void(MemoryPressureLevel)> MemoryPressureCallback; 66 typedef base::Callback<void(MemoryPressureLevel)> MemoryPressureCallback;
67 67
68 explicit MemoryPressureListener( 68 explicit MemoryPressureListener(
69 const MemoryPressureCallback& memory_pressure_callback); 69 const MemoryPressureCallback& memory_pressure_callback);
70 ~MemoryPressureListener(); 70 ~MemoryPressureListener();
71 71
72 // Intended for use by the platform specific implementation. 72 // Intended for use by the platform specific implementation.
73 static void NotifyMemoryPressure(MemoryPressureLevel memory_pressure_level); 73 static void NotifyMemoryPressure(MemoryPressureLevel memory_pressure_level);
74 74
75 // These methods should not be used anywhere else but in memory measurement
76 // code, where they are intended to maintain stable conditions across
77 // measurements.
78 static bool AreNotificationsSuppressed();
79 static void SetNotificationsSuppressed(bool suppressed);
80
75 private: 81 private:
76 void Notify(MemoryPressureLevel memory_pressure_level); 82 void Notify(MemoryPressureLevel memory_pressure_level);
77 83
78 MemoryPressureCallback callback_; 84 MemoryPressureCallback callback_;
79 85
80 DISALLOW_COPY_AND_ASSIGN(MemoryPressureListener); 86 DISALLOW_COPY_AND_ASSIGN(MemoryPressureListener);
81 }; 87 };
82 88
83 } // namespace base 89 } // namespace base
84 90
85 #endif // BASE_MEMORY_MEMORY_PRESSURE_LISTENER_H_ 91 #endif // BASE_MEMORY_MEMORY_PRESSURE_LISTENER_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/memory/memory_pressure_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698