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

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

Issue 1137033004: [Session restore] Add DontRestoreBackgroundTabs group to collect stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change experiment name to the new/correct one. Created 5 years, 7 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 | « no previous file | chrome/browser/sessions/session_restore_stats_collector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore_delegate.cc
diff --git a/chrome/browser/sessions/session_restore_delegate.cc b/chrome/browser/sessions/session_restore_delegate.cc
index 28b2966f818c6a42ba26c4b1c9d1017cd44b0ec6..9d5c3122709459dff1f353967f51ca45e44af392 100644
--- a/chrome/browser/sessions/session_restore_delegate.cc
+++ b/chrome/browser/sessions/session_restore_delegate.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/sessions/session_restore_stats_collector.h"
#include "chrome/browser/sessions/tab_loader.h"
#include "chrome/common/url_constants.h"
+#include "components/favicon/content/content_favicon_driver.h"
#include "content/public/browser/web_contents.h"
namespace {
@@ -64,6 +65,23 @@ bool SessionRestoreDelegate::RestoredTab::operator<(
void SessionRestoreDelegate::RestoreTabs(
const std::vector<RestoredTab>& tabs,
const base::TimeTicks& restore_started) {
- SessionRestoreStatsCollector::TrackTabs(tabs, restore_started);
- TabLoader::RestoreTabs(tabs, restore_started);
+ // This experiment allows us to have comparative numbers for session restore
+ // metrics. It will be removed once those numbers are obtained.
+ // TODO(georgesak): Remove this experiment when stats are collected.
+ base::FieldTrial* trial =
+ base::FieldTrialList::Find("IntelligentSessionRestore");
+ if (!trial || trial->group_name() != "DontRestoreBackgroundTabs") {
+ SessionRestoreStatsCollector::TrackTabs(tabs, restore_started);
+ TabLoader::RestoreTabs(tabs, restore_started);
+ } else {
+ SessionRestoreStatsCollector::TrackActiveTabs(tabs, restore_started);
+ for (auto& restored_tab : tabs) {
+ if (!restored_tab.is_active()) {
+ favicon::ContentFaviconDriver* favicon_driver =
+ favicon::ContentFaviconDriver::FromWebContents(
+ restored_tab.contents());
+ favicon_driver->FetchFavicon(favicon_driver->GetActiveURL());
+ }
+ }
+ }
}
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore_stats_collector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698