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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 242107: Add histograms that track how long it takes to open the new tab page. (Closed)
Patch Set: comments Created 11 years, 3 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/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index c59ea35bdda4e595c14853e70a032cd81de47ce9..6fd8877a636d80c2e1819b61ab493648505d48a3 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1170,6 +1170,24 @@ bool TabContents::IsActiveEntry(int32 page_id) {
active_entry->page_id() == page_id);
}
+void TabContents::LogNewTabTime(const std::string& event_name) {
+ // Not all new tab pages get timed. In those cases, we don't have a
+ // new_tab_start_time_.
+ if (new_tab_start_time_.is_null())
+ return;
+
+ base::TimeDelta duration = base::TimeTicks::Now() - new_tab_start_time_;
+ if (event_name == "NewTab.ScriptStart") {
+ UMA_HISTOGRAM_TIMES("NewTab.ScriptStart", duration);
+ } else if (event_name == "NewTab.DOMContentLoaded") {
+ UMA_HISTOGRAM_TIMES("NewTab.DOMContentLoaded", duration);
+ } else if (event_name == "NewTab.Onload") {
+ UMA_HISTOGRAM_TIMES("NewTab.Onload", duration);
+ // The new tab page has finished loading; reset it.
+ new_tab_start_time_ = base::TimeTicks();
+ }
+}
+
// Notifies the RenderWidgetHost instance about the fact that the page is
// loading, or done loading and calls the base implementation.
void TabContents::SetIsLoading(bool is_loading,
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698