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 #include "chrome/browser/sessions/tab_loader.h" | 5 #include "chrome/browser/sessions/tab_loader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/memory_coordinator_client_registry.h" | 10 #include "base/memory/memory_coordinator_client_registry.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 // restore is halted due to memory pressure. Also, when multiple tabs are | 107 // restore is halted due to memory pressure. Also, when multiple tabs are |
108 // restored to a single window, the title may not appear, and the user will | 108 // restored to a single window, the title may not appear, and the user will |
109 // have no way of finding out which tabs corresponds to which page if the icon | 109 // have no way of finding out which tabs corresponds to which page if the icon |
110 // is a generic grey one. | 110 // is a generic grey one. |
111 for (auto& restored_tab : tabs) { | 111 for (auto& restored_tab : tabs) { |
112 if (!restored_tab.is_active()) { | 112 if (!restored_tab.is_active()) { |
113 tabs_to_load_.push_back(&restored_tab.contents()->GetController()); | 113 tabs_to_load_.push_back(&restored_tab.contents()->GetController()); |
114 favicon::ContentFaviconDriver* favicon_driver = | 114 favicon::ContentFaviconDriver* favicon_driver = |
115 favicon::ContentFaviconDriver::FromWebContents( | 115 favicon::ContentFaviconDriver::FromWebContents( |
116 restored_tab.contents()); | 116 restored_tab.contents()); |
117 // TODO(mastiz): This seems broken: one call cancels previous ones so this | |
118 // is unlikely to do any good. | |
pkotwicz
2017/02/22 02:37:53
This seems like this should be a crbug not a comme
mastiz
2017/02/23 21:55:53
Ditto.
| |
117 // |favicon_driver| might be null when testing. | 119 // |favicon_driver| might be null when testing. |
118 if (favicon_driver) | 120 if (favicon_driver) |
119 favicon_driver->FetchFavicon(favicon_driver->GetActiveURL()); | 121 favicon_driver->FetchFavicon(favicon_driver->GetActiveURL()); |
120 } else { | 122 } else { |
121 tabs_loading_.insert(&restored_tab.contents()->GetController()); | 123 tabs_loading_.insert(&restored_tab.contents()->GetController()); |
122 } | 124 } |
123 RegisterForNotifications(&restored_tab.contents()->GetController()); | 125 RegisterForNotifications(&restored_tab.contents()->GetController()); |
124 } | 126 } |
125 | 127 |
126 // When multiple profiles are using the same TabLoader, another profile might | 128 // When multiple profiles are using the same TabLoader, another profile might |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 // memory pressure. | 293 // memory pressure. |
292 stats_collector_->DeferTab(tab); | 294 stats_collector_->DeferTab(tab); |
293 } | 295 } |
294 // By calling |LoadNextTab| explicitly, we make sure that the | 296 // By calling |LoadNextTab| explicitly, we make sure that the |
295 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. | 297 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. |
296 LoadNextTab(); | 298 LoadNextTab(); |
297 } | 299 } |
298 | 300 |
299 // static | 301 // static |
300 TabLoader* TabLoader::shared_tab_loader_ = nullptr; | 302 TabLoader* TabLoader::shared_tab_loader_ = nullptr; |
OLD | NEW |