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

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: Fix metrics by keeping right number of tabs restored. Created 5 years, 9 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..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);
}
« 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