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 |
| 13 namespace content { |
| 14 |
| 15 class MemoryMessageFilter; |
| 16 |
| 17 class MemoryPressureController { |
| 18 public: |
| 19 // These methods must be called on the IO thread. |
| 20 void OnMemoryMessageFilterAdded(MemoryMessageFilter* filter); |
| 21 void OnMemoryMessageFilterRemoved(MemoryMessageFilter* filter); |
| 22 |
| 23 // This method can be called from any thread. |
| 24 void SetPressureNotificationsSuppressedInAllProcesses(bool suppressed); |
| 25 |
| 26 // This method can be called from any thread. |
| 27 static MemoryPressureController* GetInstance(); |
| 28 |
| 29 protected: |
| 30 virtual ~MemoryPressureController(); |
| 31 |
| 32 private: |
| 33 friend struct base::DefaultSingletonTraits<MemoryPressureController>; |
| 34 |
| 35 MemoryPressureController(); |
| 36 |
| 37 // Set of all memory message filters in the browser process. Always accessed |
| 38 // on the IO thread. |
| 39 typedef std::set<scoped_refptr<MemoryMessageFilter>> MemoryMessageFilterSet; |
| 40 MemoryMessageFilterSet memory_message_filters_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(MemoryPressureController); |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CONTENT_BROWSER_MEMORY_MEMORY_PRESSURE_CONTROLLER_H_ |
OLD | NEW |