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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore_stats_collector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/session_restore_delegate.h" 5 #include "chrome/browser/sessions/session_restore_delegate.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "chrome/browser/sessions/session_restore_stats_collector.h" 8 #include "chrome/browser/sessions/session_restore_stats_collector.h"
9 #include "chrome/browser/sessions/tab_loader.h" 9 #include "chrome/browser/sessions/tab_loader.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "components/favicon/content/content_favicon_driver.h"
11 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
12 13
13 namespace { 14 namespace {
14 15
15 bool IsInternalPage(const GURL& url) { 16 bool IsInternalPage(const GURL& url) {
16 // There are many chrome:// UI URLs, but only look for the ones that users 17 // There are many chrome:// UI URLs, but only look for the ones that users
17 // are likely to have open. Most of the benefit is from the NTP URL. 18 // are likely to have open. Most of the benefit is from the NTP URL.
18 const char* const kReloadableUrlPrefixes[] = { 19 const char* const kReloadableUrlPrefixes[] = {
19 chrome::kChromeUIDownloadsURL, 20 chrome::kChromeUIDownloadsURL,
20 chrome::kChromeUIHistoryURL, 21 chrome::kChromeUIHistoryURL,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (is_app_ != right.is_app_) 58 if (is_app_ != right.is_app_)
58 return is_app_; 59 return is_app_;
59 // TODO(georgesak): Add criterion based on recency. 60 // TODO(georgesak): Add criterion based on recency.
60 return false; 61 return false;
61 } 62 }
62 63
63 // static 64 // static
64 void SessionRestoreDelegate::RestoreTabs( 65 void SessionRestoreDelegate::RestoreTabs(
65 const std::vector<RestoredTab>& tabs, 66 const std::vector<RestoredTab>& tabs,
66 const base::TimeTicks& restore_started) { 67 const base::TimeTicks& restore_started) {
67 SessionRestoreStatsCollector::TrackTabs(tabs, restore_started); 68 // This experiment allows us to have comparative numbers for session restore
68 TabLoader::RestoreTabs(tabs, restore_started); 69 // metrics. It will be removed once those numbers are obtained.
70 // TODO(georgesak): Remove this experiment when stats are collected.
71 base::FieldTrial* trial =
72 base::FieldTrialList::Find("IntelligentSessionRestore");
73 if (!trial || trial->group_name() != "DontRestoreBackgroundTabs") {
74 SessionRestoreStatsCollector::TrackTabs(tabs, restore_started);
75 TabLoader::RestoreTabs(tabs, restore_started);
76 } else {
77 SessionRestoreStatsCollector::TrackActiveTabs(tabs, restore_started);
78 for (auto& restored_tab : tabs) {
79 if (!restored_tab.is_active()) {
80 favicon::ContentFaviconDriver* favicon_driver =
81 favicon::ContentFaviconDriver::FromWebContents(
82 restored_tab.contents());
83 favicon_driver->FetchFavicon(favicon_driver->GetActiveURL());
84 }
85 }
86 }
69 } 87 }
OLDNEW
« 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