OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_PRESSURE_CONTROLLER_H_ | |
6 #define CONTENT_BROWSER_MEMORY_MEMORY_PRESSURE_CONTROLLER_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/memory/singleton.h" | |
12 #include "content/common/content_export.h" | |
13 | |
14 namespace content { | |
15 | |
16 class MemoryMessageFilter; | |
17 | |
18 class CONTENT_EXPORT MemoryPressureController { | |
19 public: | |
20 // These methods must be called on the IO thread. | |
21 void OnMemoryMessageFilterAdded(MemoryMessageFilter* filter); | |
22 void OnMemoryMessageFilterRemoved(MemoryMessageFilter* filter); | |
23 | |
24 // This method can be called from any thread. | |
25 void SetPressureNotificationsSuppressedInAllProcesses(bool suppressed); | |
26 | |
27 // This method can be called from any thread. | |
28 static MemoryPressureController* GetInstance(); | |
29 | |
30 protected: | |
31 virtual ~MemoryPressureController(); | |
32 | |
33 private: | |
34 friend struct base::DefaultSingletonTraits<MemoryPressureController>; | |
35 | |
36 MemoryPressureController(); | |
37 | |
38 // Set of all memory message filters in the browser process. Always accessed | |
39 // on the IO thread. | |
40 typedef std::set<scoped_refptr<MemoryMessageFilter>> MemoryMessageFilterSet; | |
41 MemoryMessageFilterSet memory_message_filters_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(MemoryPressureController); | |
44 }; | |
45 | |
46 } // namespace content | |
47 | |
48 #endif // CONTENT_BROWSER_MEMORY_MEMORY_PRESSURE_CONTROLLER_H_ | |
OLD | NEW |