| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ | 6 #define CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 // Called by the memory pressure listener when the memory pressure rises. | 123 // Called by the memory pressure listener when the memory pressure rises. |
| 124 void OnMemoryPressure( | 124 void OnMemoryPressure( |
| 125 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); | 125 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 126 | 126 |
| 127 // Returns true if |first| is considered less desirable to be killed than | 127 // Returns true if |first| is considered less desirable to be killed than |
| 128 // |second|. | 128 // |second|. |
| 129 static bool CompareTabStats(TabStats first, TabStats second); | 129 static bool CompareTabStats(TabStats first, TabStats second); |
| 130 | 130 |
| 131 // Timer to periodically update the stats of the renderers. | 131 // Timer to periodically update the stats of the renderers. |
| 132 base::RepeatingTimer<OomPriorityManager> update_timer_; | 132 base::RepeatingTimer update_timer_; |
| 133 | 133 |
| 134 // Timer to periodically report whether a tab has been discarded since the | 134 // Timer to periodically report whether a tab has been discarded since the |
| 135 // last time the timer has fired. | 135 // last time the timer has fired. |
| 136 base::RepeatingTimer<OomPriorityManager> recent_tab_discard_timer_; | 136 base::RepeatingTimer recent_tab_discard_timer_; |
| 137 | 137 |
| 138 // A listener to global memory pressure events. | 138 // A listener to global memory pressure events. |
| 139 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 139 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 140 | 140 |
| 141 // Wall-clock time when the priority manager started running. | 141 // Wall-clock time when the priority manager started running. |
| 142 base::TimeTicks start_time_; | 142 base::TimeTicks start_time_; |
| 143 | 143 |
| 144 // Wall-clock time of last tab discard during this browsing session, or 0 if | 144 // Wall-clock time of last tab discard during this browsing session, or 0 if |
| 145 // no discard has happened yet. | 145 // no discard has happened yet. |
| 146 base::TimeTicks last_discard_time_; | 146 base::TimeTicks last_discard_time_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 162 #if defined(OS_CHROMEOS) | 162 #if defined(OS_CHROMEOS) |
| 163 scoped_ptr<OomPriorityManagerDelegate> delegate_; | 163 scoped_ptr<OomPriorityManagerDelegate> delegate_; |
| 164 #endif | 164 #endif |
| 165 | 165 |
| 166 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); | 166 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace memory | 169 } // namespace memory |
| 170 | 170 |
| 171 #endif // CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ | 171 #endif // CHROME_BROWSER_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| OLD | NEW |