OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 // MemoryPressureListener provides static APIs for handling memory pressure on | 5 // MemoryPressureListener provides static APIs for handling memory pressure on |
6 // platforms that have such signals (Android, ChromeOS, Mac and Windows). When | 6 // platforms that have such signals (Android, ChromeOS, Mac and Windows). When |
7 // such signals are received the app will try to discard buffers that aren't | 7 // such signals are received the app will try to discard buffers that aren't |
8 // deemed essential (individual modules will implement their own policy). | 8 // deemed essential (individual modules will implement their own policy). |
9 | 9 |
10 #ifndef COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_LISTENER_H_ | 10 #ifndef COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_LISTENER_H_ |
11 #define COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_LISTENER_H_ | 11 #define COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_LISTENER_H_ |
12 | 12 |
13 #include "base/base_export.h" | 13 #include "base/base_export.h" |
14 #include "base/basictypes.h" | |
15 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" |
| 16 #include "build/build_config.h" |
16 | 17 |
17 // ChromeOS and Linux operating systems will be added to this as they are | 18 // ChromeOS and Linux operating systems will be added to this as they are |
18 // implemented. | 19 // implemented. |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 #define MEMORY_PRESSURE_IS_POLLING | 21 #define MEMORY_PRESSURE_IS_POLLING |
21 #endif | 22 #endif |
22 | 23 |
23 namespace memory_pressure { | 24 namespace memory_pressure { |
24 | 25 |
25 // To start listening, create a new instance, passing a callback to a | 26 // To start listening, create a new instance, passing a callback to a |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void Notify(MemoryPressureLevel memory_pressure_level); | 84 void Notify(MemoryPressureLevel memory_pressure_level); |
84 | 85 |
85 MemoryPressureCallback callback_; | 86 MemoryPressureCallback callback_; |
86 | 87 |
87 DISALLOW_COPY_AND_ASSIGN(MemoryPressureListener); | 88 DISALLOW_COPY_AND_ASSIGN(MemoryPressureListener); |
88 }; | 89 }; |
89 | 90 |
90 } // namespace memory_pressure | 91 } // namespace memory_pressure |
91 | 92 |
92 #endif // COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_LISTENER_H_ | 93 #endif // COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_LISTENER_H_ |
OLD | NEW |