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_SESSIONS_TAB_LOADER_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
6 #define CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ | 6 #define CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 const content::NotificationSource& source, | 54 const content::NotificationSource& source, |
55 const content::NotificationDetails& details) override; | 55 const content::NotificationDetails& details) override; |
56 | 56 |
57 // TabLoaderCallback: | 57 // TabLoaderCallback: |
58 void SetTabLoadingEnabled(bool enable_tab_loading) override; | 58 void SetTabLoadingEnabled(bool enable_tab_loading) override; |
59 | 59 |
60 // Called to start restoring tabs. | 60 // Called to start restoring tabs. |
61 static void RestoreTabs(const std::vector<RestoredTab>& tabs, | 61 static void RestoreTabs(const std::vector<RestoredTab>& tabs, |
62 const base::TimeTicks& restore_started); | 62 const base::TimeTicks& restore_started); |
63 | 63 |
64 // Limit the number of loaded tabs. | |
65 // Value of 0 restores default behavior. In test mode command line flags and | |
66 // free memory size are not taken into account. | |
67 static void SetMaxLoadedTabCountForTest(size_t value); | |
sky
2017/03/02 19:12:05
I prefer keeping the public api clean. Instead of
Michael K. (Yandex Team)
2017/03/03 08:26:37
Done.
| |
68 | |
64 private: | 69 private: |
65 FRIEND_TEST_ALL_PREFIXES(TabLoaderTest, OnMemoryStateChange); | 70 FRIEND_TEST_ALL_PREFIXES(TabLoaderTest, OnMemoryStateChange); |
66 | 71 |
67 friend class base::RefCounted<TabLoader>; | 72 friend class base::RefCounted<TabLoader>; |
68 | 73 |
69 using TabsLoading = std::set<content::NavigationController*>; | 74 using TabsLoading = std::set<content::NavigationController*>; |
70 using TabsToLoad = std::list<content::NavigationController*>; | 75 using TabsToLoad = std::list<content::NavigationController*>; |
71 | 76 |
72 explicit TabLoader(base::TimeTicks restore_started); | 77 explicit TabLoader(base::TimeTicks restore_started); |
73 ~TabLoader() override; | 78 ~TabLoader() override; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 // True if the tab loading is enabled. | 142 // True if the tab loading is enabled. |
138 bool loading_enabled_; | 143 bool loading_enabled_; |
139 | 144 |
140 // The set of tabs we've initiated loading on. This does NOT include the | 145 // The set of tabs we've initiated loading on. This does NOT include the |
141 // selected tabs. | 146 // selected tabs. |
142 TabsLoading tabs_loading_; | 147 TabsLoading tabs_loading_; |
143 | 148 |
144 // The tabs we need to load. | 149 // The tabs we need to load. |
145 TabsToLoad tabs_to_load_; | 150 TabsToLoad tabs_to_load_; |
146 | 151 |
152 // The number of tabs started to load. | |
sky
2017/03/02 19:12:05
Document this value never decreases.
Michael K. (Yandex Team)
2017/03/03 08:26:37
Done.
| |
153 size_t started_to_load_count_; | |
154 | |
147 base::OneShotTimer force_load_timer_; | 155 base::OneShotTimer force_load_timer_; |
148 | 156 |
149 // The time the restore process started. | 157 // The time the restore process started. |
150 base::TimeTicks restore_started_; | 158 base::TimeTicks restore_started_; |
151 | 159 |
152 // For keeping TabLoader alive while it's loading even if no | 160 // For keeping TabLoader alive while it's loading even if no |
153 // SessionRestoreImpls reference it. | 161 // SessionRestoreImpls reference it. |
154 scoped_refptr<TabLoader> this_retainer_; | 162 scoped_refptr<TabLoader> this_retainer_; |
155 | 163 |
156 // The SessionRestoreStatsCollector associated with this TabLoader. This is | 164 // The SessionRestoreStatsCollector associated with this TabLoader. This is |
157 // explicitly referenced so that it can be notified of deferred tab loads due | 165 // explicitly referenced so that it can be notified of deferred tab loads due |
158 // to memory pressure. | 166 // to memory pressure. |
159 scoped_refptr<SessionRestoreStatsCollector> stats_collector_; | 167 scoped_refptr<SessionRestoreStatsCollector> stats_collector_; |
160 | 168 |
161 static TabLoader* shared_tab_loader_; | 169 static TabLoader* shared_tab_loader_; |
162 | 170 |
163 DISALLOW_COPY_AND_ASSIGN(TabLoader); | 171 DISALLOW_COPY_AND_ASSIGN(TabLoader); |
164 }; | 172 }; |
165 | 173 |
166 #endif // CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ | 174 #endif // CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
OLD | NEW |