| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/page_load_histograms.h" | 5 #include "chrome/renderer/page_load_histograms.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
| 12 #include "chrome/common/extensions/url_pattern.h" | 12 #include "chrome/common/extensions/url_pattern.h" |
| 13 #include "chrome/renderer/chrome_content_renderer_client.h" | 13 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 14 #include "chrome/renderer/prerender/prerender_helper.h" | 14 #include "chrome/renderer/prerender/prerender_helper.h" |
| 15 #include "chrome/renderer/renderer_histogram_snapshots.h" | 15 #include "chrome/renderer/renderer_histogram_snapshots.h" |
| 16 #include "content/public/renderer/document_state.h" | 16 #include "content/public/renderer/document_state.h" |
| 17 #include "content/public/renderer/render_view.h" | 17 #include "content/public/renderer/render_view.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 24 #include "webkit/glue/weburlresponse_extradata_impl.h" |
| 24 | 25 |
| 25 using WebKit::WebDataSource; | 26 using WebKit::WebDataSource; |
| 26 using WebKit::WebFrame; | 27 using WebKit::WebFrame; |
| 27 using WebKit::WebPerformance; | 28 using WebKit::WebPerformance; |
| 28 using WebKit::WebString; | 29 using WebKit::WebString; |
| 29 using base::Time; | 30 using base::Time; |
| 30 using base::TimeDelta; | 31 using base::TimeDelta; |
| 31 using content::DocumentState; | 32 using content::DocumentState; |
| 32 | 33 |
| 33 const size_t kPLTCount = 100; | 34 const size_t kPLTCount = 100; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (!frame || frame->parent()) | 134 if (!frame || frame->parent()) |
| 134 return; | 135 return; |
| 135 | 136 |
| 136 // Only dump for supported schemes. | 137 // Only dump for supported schemes. |
| 137 URLPattern::SchemeMasks scheme_type = | 138 URLPattern::SchemeMasks scheme_type = |
| 138 GetSupportedSchemeType(frame->document().url()); | 139 GetSupportedSchemeType(frame->document().url()); |
| 139 if (scheme_type == 0) | 140 if (scheme_type == 0) |
| 140 return; | 141 return; |
| 141 | 142 |
| 142 // Ignore multipart requests. | 143 // Ignore multipart requests. |
| 143 if (frame->dataSource()->response().isMultipartPayload()) | 144 webkit_glue::WebURLResponseExtraDataImpl* extra_data = |
| 145 static_cast<webkit_glue::WebURLResponseExtraDataImpl*>( |
| 146 frame->dataSource()->response().extraData()); |
| 147 if (extra_data && extra_data->is_multipart_payload()) |
| 144 return; | 148 return; |
| 145 | 149 |
| 146 DocumentState* document_state = | 150 DocumentState* document_state = |
| 147 DocumentState::FromDataSource(frame->dataSource()); | 151 DocumentState::FromDataSource(frame->dataSource()); |
| 148 | 152 |
| 149 // Times based on the Web Timing metrics. | 153 // Times based on the Web Timing metrics. |
| 150 // http://www.w3.org/TR/navigation-timing/ | 154 // http://www.w3.org/TR/navigation-timing/ |
| 151 // TODO(tonyg, jar): We are in the process of vetting these metrics against | 155 // TODO(tonyg, jar): We are in the process of vetting these metrics against |
| 152 // the existing ones. Once we understand any differences, we will standardize | 156 // the existing ones. Once we understand any differences, we will standardize |
| 153 // on a single set of metrics. | 157 // on a single set of metrics. |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 | 976 |
| 973 DCHECK(document_state); | 977 DCHECK(document_state); |
| 974 DCHECK(ds); | 978 DCHECK(ds); |
| 975 GURL url(ds->request().url()); | 979 GURL url(ds->request().url()); |
| 976 Time start = document_state->start_load_time(); | 980 Time start = document_state->start_load_time(); |
| 977 Time finish = document_state->finish_load_time(); | 981 Time finish = document_state->finish_load_time(); |
| 978 // TODO(mbelshe): should we log more stats? | 982 // TODO(mbelshe): should we log more stats? |
| 979 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 983 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 980 << url.spec(); | 984 << url.spec(); |
| 981 } | 985 } |
| OLD | NEW |