From f8999644c114f91d4ea0eeea1d3edf8428a762c1 Mon Sep 17 00:00:00 2001 From: "mbelshe@google.com" Date: Tue, 27 Oct 2009 21:39:42 +0000 Subject: Log the PLT to the log file. This is a convenience for debugging. BUG=none TEST=none Review URL: http://codereview.chromium.org/330030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30252 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/render_view.cc | 21 +++++++++++++++++++++ chrome/renderer/render_view.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 2cc7ad1..b57d3ce 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -3420,6 +3420,8 @@ void RenderView::DumpLoadHistograms() const { if (navigation_state->load_histograms_recorded() || finish.is_null()) return; + LogNavigationState(navigation_state, main_frame->dataSource()); + Time request = navigation_state->request_time(); Time start = navigation_state->start_load_time(); Time commit = navigation_state->commit_load_time(); @@ -3568,6 +3570,25 @@ void RenderView::DumpLoadHistograms() const { navigation_state->set_load_histograms_recorded(true); } +void RenderView::LogNavigationState(const NavigationState* state, + const WebDataSource* ds) const { + // Because this function gets called on every page load, + // take extra care to optimize it away if logging is turned off. + if (logging::LOG_INFO < logging::GetMinLogLevel()) + return; + + DCHECK(state); + DCHECK(ds); + GURL url(ds->request().url()); + Time start = state->start_load_time(); + Time finish = state->finish_load_time(); + // TODO(mbelshe): should we log more stats? + LOG(INFO) << "PLT: " + << (finish - start).InMilliseconds() + << "ms " + << url.spec(); +} + void RenderView::focusAccessibilityObject( const WebAccessibilityObject& acc_obj) { #if defined(OS_WIN) diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 790bfd5..fc59c19 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -83,6 +83,7 @@ struct FileUploadData; } namespace WebKit { +class WebDataSource; class WebDragData; class WebMediaPlayer; class WebMediaPlayerClient; @@ -716,6 +717,10 @@ class RenderView : public RenderWidget, void DumpLoadHistograms() const; + // Logs the navigation state to the console. + void LogNavigationState(const NavigationState* state, + const WebKit::WebDataSource* ds) const; + // Scan the given frame for password forms and send them up to the browser. void SendPasswordForms(WebKit::WebFrame* frame); -- cgit v1.1