Chromium Code Reviews| Index: chrome/browser/sessions/session_restore_stats_collector.cc |
| diff --git a/chrome/browser/sessions/session_restore_stats_collector.cc b/chrome/browser/sessions/session_restore_stats_collector.cc |
| index b24d561c8280d65623a1a9e060884edccb256c7a..2c0e648845e914d796add9825244e7d734731f3d 100644 |
| --- a/chrome/browser/sessions/session_restore_stats_collector.cc |
| +++ b/chrome/browser/sessions/session_restore_stats_collector.cc |
| @@ -20,20 +20,24 @@ using content::WebContents; |
| // static |
| void SessionRestoreStatsCollector::TrackTabs( |
| const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, |
| - const base::TimeTicks& restore_started) { |
| + const base::TimeTicks& restore_started, |
| + bool active_only) { |
| if (!shared_collector_) |
| - shared_collector_ = new SessionRestoreStatsCollector(restore_started); |
| + shared_collector_ = |
| + new SessionRestoreStatsCollector(restore_started, active_only); |
| shared_collector_->AddTabs(tabs); |
| } |
| SessionRestoreStatsCollector::SessionRestoreStatsCollector( |
| - const base::TimeTicks& restore_started) |
| + const base::TimeTicks& restore_started, |
| + bool active_only) |
| : got_first_foreground_load_(false), |
| got_first_paint_(false), |
| restore_started_(restore_started), |
| tab_count_(0), |
| - max_parallel_tab_loads_(0) { |
| + max_parallel_tab_loads_(0), |
| + active_only_(active_only) { |
| this_retainer_ = this; |
| registrar_.Add( |
| this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, |
| @@ -163,7 +167,12 @@ void SessionRestoreStatsCollector::Observe( |
| void SessionRestoreStatsCollector::AddTabs( |
| const std::vector<SessionRestoreDelegate::RestoredTab>& tabs) { |
| + tab_count_ += tabs.size(); |
| for (auto& tab : tabs) { |
| + // If we are only restoring active tabs and the tab is not active, nothing |
| + // to do. |
| + if (active_only_ && !tab.is_active) |
|
sky
2015/04/03 22:04:46
Actually, one nit. Pass active_only to this functi
|
| + continue; |
| RegisterForNotifications(&tab.contents->GetController()); |
| if (tab.is_active) { |
| RenderWidgetHost* render_widget_host = |
| @@ -218,7 +227,6 @@ void SessionRestoreStatsCollector::RegisterForNotifications( |
| content::Source<NavigationController>(tab)); |
| registrar_.Add(this, content::NOTIFICATION_LOAD_START, |
| content::Source<NavigationController>(tab)); |
| - ++tab_count_; |
| tabs_tracked_.insert(tab); |
| } |