| 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_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Posts AdjustFocusedTabScore task to the file thread. | 123 // Posts AdjustFocusedTabScore task to the file thread. |
| 124 void OnFocusTabScoreAdjustmentTimeout(); | 124 void OnFocusTabScoreAdjustmentTimeout(); |
| 125 | 125 |
| 126 // Sets the score of the focused tab to the least value. | 126 // Sets the score of the focused tab to the least value. |
| 127 void AdjustFocusedTabScoreOnFileThread(); | 127 void AdjustFocusedTabScoreOnFileThread(); |
| 128 | 128 |
| 129 static bool CompareTabStats(TabStats first, TabStats second); | 129 static bool CompareTabStats(TabStats first, TabStats second); |
| 130 | 130 |
| 131 virtual void Observe(int type, | 131 virtual void Observe(int type, |
| 132 const content::NotificationSource& source, | 132 const content::NotificationSource& source, |
| 133 const content::NotificationDetails& details) OVERRIDE; | 133 const content::NotificationDetails& details) override; |
| 134 | 134 |
| 135 base::RepeatingTimer<OomPriorityManager> timer_; | 135 base::RepeatingTimer<OomPriorityManager> timer_; |
| 136 base::OneShotTimer<OomPriorityManager> focus_tab_score_adjust_timer_; | 136 base::OneShotTimer<OomPriorityManager> focus_tab_score_adjust_timer_; |
| 137 base::RepeatingTimer<OomPriorityManager> recent_tab_discard_timer_; | 137 base::RepeatingTimer<OomPriorityManager> recent_tab_discard_timer_; |
| 138 content::NotificationRegistrar registrar_; | 138 content::NotificationRegistrar registrar_; |
| 139 | 139 |
| 140 // This lock is for pid_to_oom_score_ and focus_tab_pid_. | 140 // This lock is for pid_to_oom_score_ and focus_tab_pid_. |
| 141 base::Lock pid_to_oom_score_lock_; | 141 base::Lock pid_to_oom_score_lock_; |
| 142 // map maintaining the process - oom_score mapping. | 142 // map maintaining the process - oom_score mapping. |
| 143 typedef base::hash_map<base::ProcessHandle, int> ProcessScoreMap; | 143 typedef base::hash_map<base::ProcessHandle, int> ProcessScoreMap; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 165 // Whether a tab discard event has occurred during the last time interval, | 165 // Whether a tab discard event has occurred during the last time interval, |
| 166 // used for statistics normalized by usage. | 166 // used for statistics normalized by usage. |
| 167 bool recent_tab_discard_; | 167 bool recent_tab_discard_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); | 169 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace chromeos | 172 } // namespace chromeos |
| 173 | 173 |
| 174 #endif // CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ | 174 #endif // CHROME_BROWSER_CHROMEOS_MEMORY_OOM_PRIORITY_MANAGER_H_ |
| OLD | NEW |