| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 bool CanSuspendBackgroundedRenderer(int render_process_id) const; | 149 bool CanSuspendBackgroundedRenderer(int render_process_id) const; |
| 150 | 150 |
| 151 // Returns true if |first| is considered less desirable to be killed than | 151 // Returns true if |first| is considered less desirable to be killed than |
| 152 // |second|. | 152 // |second|. |
| 153 static bool CompareTabStats(const TabStats& first, const TabStats& second); | 153 static bool CompareTabStats(const TabStats& first, const TabStats& second); |
| 154 | 154 |
| 155 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as | 155 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as |
| 156 // the WebContents could be deleted if the user closed the tab. | 156 // the WebContents could be deleted if the user closed the tab. |
| 157 static int64_t IdFromWebContents(content::WebContents* web_contents); | 157 static int64_t IdFromWebContents(content::WebContents* web_contents); |
| 158 | 158 |
| 159 void OnSessionRestoreStarted(); |
| 160 void OnSessionRestoreEnded(); |
| 161 |
| 162 bool IsInSessionRestore() const { return in_session_restore_; } |
| 163 |
| 159 private: | 164 private: |
| 160 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); | 165 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); |
| 161 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); | 166 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); |
| 162 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); | 167 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); |
| 163 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); | 168 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); |
| 164 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); | 169 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
| 165 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); | 170 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); |
| 166 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); | 171 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); |
| 167 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); | 172 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); |
| 168 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); | 173 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // be crawled as the authoritative source of tabs, otherwise the BrowserList | 381 // be crawled as the authoritative source of tabs, otherwise the BrowserList |
| 377 // and associated Browser objects are crawled. The list must be sorted in | 382 // and associated Browser objects are crawled. The list must be sorted in |
| 378 // z-order, from top to bottom. | 383 // z-order, from top to bottom. |
| 379 // TODO(chrisha): Factor out tab-strip model enumeration to a helper class, | 384 // TODO(chrisha): Factor out tab-strip model enumeration to a helper class, |
| 380 // and make a delegate that centralizes all testing seams. | 385 // and make a delegate that centralizes all testing seams. |
| 381 std::vector<BrowserInfo> test_browser_info_list_; | 386 std::vector<BrowserInfo> test_browser_info_list_; |
| 382 | 387 |
| 383 // List of observers that will receive notifications on state changes. | 388 // List of observers that will receive notifications on state changes. |
| 384 base::ObserverList<TabManagerObserver> observers_; | 389 base::ObserverList<TabManagerObserver> observers_; |
| 385 | 390 |
| 391 bool in_session_restore_; |
| 392 |
| 386 // Weak pointer factory used for posting delayed tasks. | 393 // Weak pointer factory used for posting delayed tasks. |
| 387 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 394 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 388 | 395 |
| 389 DISALLOW_COPY_AND_ASSIGN(TabManager); | 396 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 390 }; | 397 }; |
| 391 | 398 |
| 392 } // namespace resource_coordinator | 399 } // namespace resource_coordinator |
| 393 | 400 |
| 394 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 401 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
| OLD | NEW |