| OLD | NEW |
| 1 | 1 |
| 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #ifndef CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ | 6 #ifndef CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ |
| 7 #define CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ | 7 #define CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Returns list of tab titles sorted from most interesting (don't kill) | 44 // Returns list of tab titles sorted from most interesting (don't kill) |
| 45 // to least interesting (OK to kill). | 45 // to least interesting (OK to kill). |
| 46 std::vector<string16> GetTabTitles(); | 46 std::vector<string16> GetTabTitles(); |
| 47 | 47 |
| 48 // Discards a tab to free the memory occupied by its renderer. | 48 // Discards a tab to free the memory occupied by its renderer. |
| 49 // Tab still exists in the tab-strip; clicking on it will reload it. | 49 // Tab still exists in the tab-strip; clicking on it will reload it. |
| 50 // Returns true if it successfully found a tab and discarded it. | 50 // Returns true if it successfully found a tab and discarded it. |
| 51 bool DiscardTab(); | 51 bool DiscardTab(); |
| 52 | 52 |
| 53 // Log memory statistics for the running processes, then discards a tab. |
| 54 // Tab discard happens sometime later, as collecting the statistics touches |
| 55 // multiple threads and takes time. |
| 56 void LogMemoryAndDiscardTab(); |
| 57 |
| 53 private: | 58 private: |
| 54 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, Comparator); | 59 FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, Comparator); |
| 55 | 60 |
| 56 struct TabStats { | 61 struct TabStats { |
| 57 TabStats(); | 62 TabStats(); |
| 58 ~TabStats(); | 63 ~TabStats(); |
| 59 bool is_pinned; | 64 bool is_pinned; |
| 60 bool is_selected; | 65 bool is_selected; |
| 61 base::TimeTicks last_selected; | 66 base::TimeTicks last_selected; |
| 62 base::ProcessHandle renderer_handle; | 67 base::ProcessHandle renderer_handle; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 130 |
| 126 // Number of times we have discarded a tab, for statistics. | 131 // Number of times we have discarded a tab, for statistics. |
| 127 int discard_count_; | 132 int discard_count_; |
| 128 | 133 |
| 129 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); | 134 DISALLOW_COPY_AND_ASSIGN(OomPriorityManager); |
| 130 }; | 135 }; |
| 131 | 136 |
| 132 } // namespace browser | 137 } // namespace browser |
| 133 | 138 |
| 134 #endif // CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ | 139 #endif // CHROME_BROWSER_OOM_PRIORITY_MANAGER_H_ |
| OLD | NEW |