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 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ |
6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Get debugd client instance. | 90 // Get debugd client instance. |
91 virtual chromeos::DebugDaemonClient* GetDebugDaemonClient(); | 91 virtual chromeos::DebugDaemonClient* GetDebugDaemonClient(); |
92 | 92 |
93 private: | 93 private: |
94 FRIEND_TEST_ALL_PREFIXES(TabManagerDelegateTest, CandidatesSorted); | 94 FRIEND_TEST_ALL_PREFIXES(TabManagerDelegateTest, CandidatesSorted); |
95 FRIEND_TEST_ALL_PREFIXES(TabManagerDelegateTest, KillMultipleProcesses); | 95 FRIEND_TEST_ALL_PREFIXES(TabManagerDelegateTest, KillMultipleProcesses); |
96 FRIEND_TEST_ALL_PREFIXES(TabManagerDelegateTest, SetOomScoreAdj); | 96 FRIEND_TEST_ALL_PREFIXES(TabManagerDelegateTest, SetOomScoreAdj); |
97 | 97 |
98 class Candidate; | 98 class Candidate; |
99 class FocusedProcess; | 99 class FocusedProcess; |
100 class UmaReporter; | |
101 | 100 |
102 friend std::ostream& operator<<(std::ostream& out, | 101 friend std::ostream& operator<<(std::ostream& out, |
103 const Candidate& candidate); | 102 const Candidate& candidate); |
104 | 103 |
105 // content::NotificationObserver: | 104 // content::NotificationObserver: |
106 void Observe(int type, | 105 void Observe(int type, |
107 const content::NotificationSource& source, | 106 const content::NotificationSource& source, |
108 const content::NotificationDetails& details) override; | 107 const content::NotificationDetails& details) override; |
109 | 108 |
110 // Pair to hold child process host id and ProcessHandle. | 109 // Pair to hold child process host id and ProcessHandle. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Holds the info of the newly focused tab or app. Its OOM score would be | 161 // Holds the info of the newly focused tab or app. Its OOM score would be |
163 // adjusted when |focus_process_score_adjust_timer_| is expired. | 162 // adjusted when |focus_process_score_adjust_timer_| is expired. |
164 std::unique_ptr<FocusedProcess> focused_process_; | 163 std::unique_ptr<FocusedProcess> focused_process_; |
165 | 164 |
166 // Map maintaining the process handle - oom_score mapping. | 165 // Map maintaining the process handle - oom_score mapping. |
167 ProcessScoreMap oom_score_map_; | 166 ProcessScoreMap oom_score_map_; |
168 | 167 |
169 // Util for getting system memory status. | 168 // Util for getting system memory status. |
170 std::unique_ptr<TabManagerDelegate::MemoryStat> mem_stat_; | 169 std::unique_ptr<TabManagerDelegate::MemoryStat> mem_stat_; |
171 | 170 |
172 // Reports UMA histograms. | |
173 std::unique_ptr<UmaReporter> uma_; | |
174 | |
175 // Weak pointer factory used for posting tasks to other threads. | 171 // Weak pointer factory used for posting tasks to other threads. |
176 base::WeakPtrFactory<TabManagerDelegate> weak_ptr_factory_; | 172 base::WeakPtrFactory<TabManagerDelegate> weak_ptr_factory_; |
177 | 173 |
178 DISALLOW_COPY_AND_ASSIGN(TabManagerDelegate); | 174 DISALLOW_COPY_AND_ASSIGN(TabManagerDelegate); |
179 }; | 175 }; |
180 | 176 |
181 // On ARC enabled machines, either a tab or an app could be a possible | 177 // On ARC enabled machines, either a tab or an app could be a possible |
182 // victim of low memory kill process. This is a helper class which holds a | 178 // victim of low memory kill process. This is a helper class which holds a |
183 // pointer to an app or a tab (but not both) to facilitate prioritizing the | 179 // pointer to an app or a tab (but not both) to facilitate prioritizing the |
184 // victims. | 180 // victims. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // reported if available memory is under the number. | 229 // reported if available memory is under the number. |
234 static int LowMemoryMarginKB(); | 230 static int LowMemoryMarginKB(); |
235 | 231 |
236 // Reads in an integer. | 232 // Reads in an integer. |
237 static int ReadIntFromFile(const char* file_name, int default_val); | 233 static int ReadIntFromFile(const char* file_name, int default_val); |
238 }; | 234 }; |
239 | 235 |
240 } // namespace memory | 236 } // namespace memory |
241 | 237 |
242 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ | 238 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ |
OLD | NEW |