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_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); | 177 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); |
178 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); | 178 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); |
179 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); | 179 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); |
180 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); | 180 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); |
181 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs); | 181 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs); |
182 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); | 182 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); |
183 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); | 183 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); |
184 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, FastShutdownSingleTabProcess); | 184 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, FastShutdownSingleTabProcess); |
185 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, | 185 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, |
186 GetUnsortedTabStatsIsInVisibleWindow); | 186 GetUnsortedTabStatsIsInVisibleWindow); |
| 187 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, HistogramsSessionRestoreSwitchToTab); |
187 | 188 |
188 // Information about a Browser. | 189 // Information about a Browser. |
189 struct BrowserInfo { | 190 struct BrowserInfo { |
190 TabStripModel* tab_strip_model; | 191 TabStripModel* tab_strip_model; |
191 bool window_is_active; | 192 bool window_is_active; |
192 bool window_is_minimized; | 193 bool window_is_minimized; |
193 gfx::Rect window_bounds; | 194 gfx::Rect window_bounds; |
194 bool browser_is_app; | 195 bool browser_is_app; |
195 }; | 196 }; |
196 | 197 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // Returns true if tabs can be discarded only once. | 324 // Returns true if tabs can be discarded only once. |
324 bool CanOnlyDiscardOnce() const; | 325 bool CanOnlyDiscardOnce() const; |
325 | 326 |
326 // Returns a list of BrowserInfo sorted in z-order from top to bottom. The | 327 // Returns a list of BrowserInfo sorted in z-order from top to bottom. The |
327 // list is constructed from either |test_browser_info_list_| or BrowserList. | 328 // list is constructed from either |test_browser_info_list_| or BrowserList. |
328 std::vector<BrowserInfo> GetBrowserInfoList() const; | 329 std::vector<BrowserInfo> GetBrowserInfoList() const; |
329 | 330 |
330 void OnSessionRestoreStartedLoadingTabs(); | 331 void OnSessionRestoreStartedLoadingTabs(); |
331 void OnSessionRestoreFinishedLoadingTabs(); | 332 void OnSessionRestoreFinishedLoadingTabs(); |
332 | 333 |
| 334 // Records UMA histograms for the tab state when switching to a different tab |
| 335 // during session restore. |
| 336 void RecordSwitchToTab(content::WebContents* contents) const; |
| 337 |
333 // Timer to periodically update the stats of the renderers. | 338 // Timer to periodically update the stats of the renderers. |
334 base::RepeatingTimer update_timer_; | 339 base::RepeatingTimer update_timer_; |
335 | 340 |
336 // Timer to periodically report whether a tab has been discarded since the | 341 // Timer to periodically report whether a tab has been discarded since the |
337 // last time the timer has fired. | 342 // last time the timer has fired. |
338 base::RepeatingTimer recent_tab_discard_timer_; | 343 base::RepeatingTimer recent_tab_discard_timer_; |
339 | 344 |
340 // A listener to global memory pressure events. | 345 // A listener to global memory pressure events. |
341 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 346 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
342 | 347 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 404 |
400 // Weak pointer factory used for posting delayed tasks. | 405 // Weak pointer factory used for posting delayed tasks. |
401 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 406 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
402 | 407 |
403 DISALLOW_COPY_AND_ASSIGN(TabManager); | 408 DISALLOW_COPY_AND_ASSIGN(TabManager); |
404 }; | 409 }; |
405 | 410 |
406 } // namespace resource_coordinator | 411 } // namespace resource_coordinator |
407 | 412 |
408 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 413 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
OLD | NEW |