Chromium Code Reviews| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 bool CanSuspendBackgroundedRenderer(int render_process_id) const; | 147 bool CanSuspendBackgroundedRenderer(int render_process_id) const; |
| 148 | 148 |
| 149 // Returns true if |first| is considered less desirable to be killed than | 149 // Returns true if |first| is considered less desirable to be killed than |
| 150 // |second|. | 150 // |second|. |
| 151 static bool CompareTabStats(const TabStats& first, const TabStats& second); | 151 static bool CompareTabStats(const TabStats& first, const TabStats& second); |
| 152 | 152 |
| 153 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as | 153 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as |
| 154 // the WebContents could be deleted if the user closed the tab. | 154 // the WebContents could be deleted if the user closed the tab. |
| 155 static int64_t IdFromWebContents(content::WebContents* web_contents); | 155 static int64_t IdFromWebContents(content::WebContents* web_contents); |
| 156 | 156 |
| 157 void StartSessionRestore() { is_during_session_restore_ = true; } | |
|
fmeawad
2017/06/09 21:02:54
nit: SessionRestoreStarted since we are not actual
ducbui
2017/06/10 00:40:16
I change the name to MarkSessionRestoreStarted() t
| |
| 158 | |
| 159 void EndSessionRestore() { is_during_session_restore_ = false; } | |
|
fmeawad
2017/06/09 21:02:54
ditto
ducbui
2017/06/10 00:40:16
Done.
| |
| 160 | |
| 161 bool IsDuringSessionRestore() const { return is_during_session_restore_; } | |
| 162 | |
| 157 private: | 163 private: |
| 158 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); | 164 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, PurgeBackgroundRenderer); |
| 159 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); | 165 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ActivateTabResetPurgeState); |
| 160 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); | 166 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ShouldPurgeAtDefaultTime); |
| 161 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); | 167 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DefaultTimeToPurgeInCorrectRange); |
| 162 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); | 168 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
| 163 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); | 169 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); |
| 164 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); | 170 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); |
| 165 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); | 171 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); |
| 166 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); | 172 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 // associated Browser objects are crawled. The first of these is considered to | 365 // associated Browser objects are crawled. The first of these is considered to |
| 360 // be the 'active' tab strip model. | 366 // be the 'active' tab strip model. |
| 361 // TODO(chrisha): Factor out tab-strip model enumeration to a helper class, | 367 // TODO(chrisha): Factor out tab-strip model enumeration to a helper class, |
| 362 // and make a delegate that centralizes all testing seams. | 368 // and make a delegate that centralizes all testing seams. |
| 363 using TestTabStripModel = std::pair<const TabStripModel*, bool>; | 369 using TestTabStripModel = std::pair<const TabStripModel*, bool>; |
| 364 std::vector<TestTabStripModel> test_tab_strip_models_; | 370 std::vector<TestTabStripModel> test_tab_strip_models_; |
| 365 | 371 |
| 366 // List of observers that will receive notifications on state changes. | 372 // List of observers that will receive notifications on state changes. |
| 367 base::ObserverList<TabManagerObserver> observers_; | 373 base::ObserverList<TabManagerObserver> observers_; |
| 368 | 374 |
| 375 bool is_during_session_restore_; | |
| 376 | |
| 369 // Weak pointer factory used for posting delayed tasks. | 377 // Weak pointer factory used for posting delayed tasks. |
| 370 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 378 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 371 | 379 |
| 372 DISALLOW_COPY_AND_ASSIGN(TabManager); | 380 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 373 }; | 381 }; |
| 374 | 382 |
| 375 } // namespace resource_coordinator | 383 } // namespace resource_coordinator |
| 376 | 384 |
| 377 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ | 385 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_MANAGER_H_ |
| OLD | NEW |