Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2642)

Unified Diff: chrome/browser/sessions/session_restore_stats_collector.cc

Issue 1059343002: Add experiment to disable loading of background tabs during session restore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment about |active_tabs|. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_restore_stats_collector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..26e1b647ee09e8d989be3e015b2ee682c6fd30ea 100644
--- a/chrome/browser/sessions/session_restore_stats_collector.cc
+++ b/chrome/browser/sessions/session_restore_stats_collector.cc
@@ -20,11 +20,12 @@ 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_->AddTabs(tabs);
+ shared_collector_->AddTabs(tabs, active_only);
}
SessionRestoreStatsCollector::SessionRestoreStatsCollector(
@@ -162,8 +163,14 @@ void SessionRestoreStatsCollector::Observe(
}
void SessionRestoreStatsCollector::AddTabs(
- const std::vector<SessionRestoreDelegate::RestoredTab>& tabs) {
+ const std::vector<SessionRestoreDelegate::RestoredTab>& tabs,
+ bool active_only) {
+ 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)
+ continue;
RegisterForNotifications(&tab.contents->GetController());
if (tab.is_active) {
RenderWidgetHost* render_widget_host =
@@ -218,7 +225,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);
}
« no previous file with comments | « chrome/browser/sessions/session_restore_stats_collector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698