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

Side by Side 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, 2 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 | « chrome/browser/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 render_view_host()->PrintingDone(document_cookie, success); 1163 render_view_host()->PrintingDone(document_cookie, success);
1164 } 1164 }
1165 1165
1166 bool TabContents::IsActiveEntry(int32 page_id) { 1166 bool TabContents::IsActiveEntry(int32 page_id) {
1167 NavigationEntry* active_entry = controller_.GetActiveEntry(); 1167 NavigationEntry* active_entry = controller_.GetActiveEntry();
1168 return (active_entry != NULL && 1168 return (active_entry != NULL &&
1169 active_entry->site_instance() == GetSiteInstance() && 1169 active_entry->site_instance() == GetSiteInstance() &&
1170 active_entry->page_id() == page_id); 1170 active_entry->page_id() == page_id);
1171 } 1171 }
1172 1172
1173 void TabContents::LogNewTabTime(const std::string& event_name) {
1174 // Not all new tab pages get timed. In those cases, we don't have a
1175 // new_tab_start_time_.
1176 if (new_tab_start_time_.is_null())
1177 return;
1178
1179 base::TimeDelta duration = base::TimeTicks::Now() - new_tab_start_time_;
1180 if (event_name == "NewTab.ScriptStart") {
1181 UMA_HISTOGRAM_TIMES("NewTab.ScriptStart", duration);
1182 } else if (event_name == "NewTab.DOMContentLoaded") {
1183 UMA_HISTOGRAM_TIMES("NewTab.DOMContentLoaded", duration);
1184 } else if (event_name == "NewTab.Onload") {
1185 UMA_HISTOGRAM_TIMES("NewTab.Onload", duration);
1186 // The new tab page has finished loading; reset it.
1187 new_tab_start_time_ = base::TimeTicks();
1188 }
1189 }
1190
1173 // Notifies the RenderWidgetHost instance about the fact that the page is 1191 // Notifies the RenderWidgetHost instance about the fact that the page is
1174 // loading, or done loading and calls the base implementation. 1192 // loading, or done loading and calls the base implementation.
1175 void TabContents::SetIsLoading(bool is_loading, 1193 void TabContents::SetIsLoading(bool is_loading,
1176 LoadNotificationDetails* details) { 1194 LoadNotificationDetails* details) {
1177 if (is_loading == is_loading_) 1195 if (is_loading == is_loading_)
1178 return; 1196 return;
1179 1197
1180 if (!is_loading) { 1198 if (!is_loading) {
1181 load_state_ = net::LOAD_STATE_IDLE; 1199 load_state_ = net::LOAD_STATE_IDLE;
1182 load_state_host_.clear(); 1200 load_state_host_.clear();
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 2588
2571 default: 2589 default:
2572 NOTREACHED(); 2590 NOTREACHED();
2573 } 2591 }
2574 } 2592 }
2575 2593
2576 void TabContents::set_encoding(const std::string& encoding) { 2594 void TabContents::set_encoding(const std::string& encoding) {
2577 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 2595 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
2578 } 2596 }
2579 2597
OLDNEW
« 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