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

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

Issue 9791021: Session restore: Add UMA metrics for recording how many tabs were loaded in parallel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | 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.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 1cbd98969826f603c31cb4d4a526d121042e996f..4ae68764e9d71a9bfb77dd3710b845616ad5acfb 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -159,6 +159,9 @@ class TabLoader : public content::NotificationObserver,
// The time the restore process started.
base::TimeTicks restore_started_;
+ // Max number of tabs that were loaded in parallel (for metrics).
+ size_t max_parallel_tab_loads_;
+
DISALLOW_COPY_AND_ASSIGN(TabLoader);
};
@@ -167,7 +170,8 @@ TabLoader::TabLoader(base::TimeTicks restore_started)
loading_(false),
got_first_paint_(false),
tab_count_(0),
- restore_started_(restore_started) {
+ restore_started_(restore_started),
+ max_parallel_tab_loads_(0) {
}
TabLoader::~TabLoader() {
@@ -216,6 +220,8 @@ void TabLoader::LoadNextTab() {
NavigationController* tab = tabs_to_load_.front();
DCHECK(tab);
tabs_loading_.insert(tab);
+ if (tabs_loading_.size() > max_parallel_tab_loads_)
+ max_parallel_tab_loads_ = tabs_loading_.size();
tabs_to_load_.pop_front();
tab->LoadIfNecessary();
if (tab->GetWebContents()) {
@@ -404,6 +410,9 @@ void TabLoader::HandleTabClosedOrLoaded(NavigationController* tab) {
100,
base::Histogram::kUmaTargetedHistogramFlag);
counter_for_count->AddTime(time_to_load);
+
+ UMA_HISTOGRAM_COUNTS_100("SessionRestore.ParallelTabLoads",
sky 2012/03/27 17:04:34 Would it be better to do this in the destructor?
marja 2012/03/27 18:37:48 Hmm, why? The other "finished tab loading" -relate
sky 2012/03/27 20:10:10 I was assuming you only cared about the max number
+ max_parallel_tab_loads_);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698