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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/renderer/searchbox/search_bouncer.h" | 23 #include "chrome/renderer/searchbox/search_bouncer.h" |
24 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me
ssages.h" | 24 #include "components/data_reduction_proxy/content/common/data_reduction_proxy_me
ssages.h" |
25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 25 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 26 #include "content/public/child/url_conversion.h" |
26 #include "content/public/common/content_constants.h" | 27 #include "content/public/common/content_constants.h" |
27 #include "content/public/renderer/document_state.h" | 28 #include "content/public/renderer/document_state.h" |
28 #include "content/public/renderer/render_frame.h" | 29 #include "content/public/renderer/render_frame.h" |
29 #include "content/public/renderer/render_thread.h" | 30 #include "content/public/renderer/render_thread.h" |
30 #include "content/public/renderer/render_view.h" | 31 #include "content/public/renderer/render_view.h" |
31 #include "extensions/common/url_pattern.h" | 32 #include "extensions/common/url_pattern.h" |
32 #include "net/base/url_util.h" | 33 #include "net/base/url_util.h" |
33 #include "net/http/http_response_headers.h" | 34 #include "net/http/http_response_headers.h" |
34 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 35 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
35 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 36 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 bool data_reduction_proxy_was_used = false; | 904 bool data_reduction_proxy_was_used = false; |
904 if (!document_state->proxy_server().IsEmpty()) { | 905 if (!document_state->proxy_server().IsEmpty()) { |
905 bool handled = | 906 bool handled = |
906 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( | 907 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( |
907 document_state->proxy_server(), &data_reduction_proxy_was_used)); | 908 document_state->proxy_server(), &data_reduction_proxy_was_used)); |
908 // If the IPC call is not handled, then |data_reduction_proxy_was_used| | 909 // If the IPC call is not handled, then |data_reduction_proxy_was_used| |
909 // should remain |false|. | 910 // should remain |false|. |
910 DCHECK(handled || !data_reduction_proxy_was_used); | 911 DCHECK(handled || !data_reduction_proxy_was_used); |
911 } | 912 } |
912 | 913 |
913 bool came_from_websearch = | 914 bool came_from_websearch = IsFromGoogleSearchResult( |
914 IsFromGoogleSearchResult(frame->document().url(), | 915 frame->document().url(), |
915 GURL(frame->document().referrer())); | 916 content::WebStringToGURL(frame->document().referrer())); |
916 int websearch_chrome_joint_experiment_id = kNoExperiment; | 917 int websearch_chrome_joint_experiment_id = kNoExperiment; |
917 bool is_preview = false; | 918 bool is_preview = false; |
918 if (came_from_websearch) { | 919 if (came_from_websearch) { |
919 websearch_chrome_joint_experiment_id = | 920 websearch_chrome_joint_experiment_id = GetQueryStringBasedExperiment( |
920 GetQueryStringBasedExperiment(GURL(frame->document().referrer())); | 921 content::WebStringToGURL(frame->document().referrer())); |
921 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); | 922 is_preview = ViaHeaderContains(frame, "1.1 Google Instant Proxy Preview"); |
922 } | 923 } |
923 | 924 |
924 MaybeDumpFirstLayoutHistograms(); | 925 MaybeDumpFirstLayoutHistograms(); |
925 | 926 |
926 content::RenderFrame* render_frame = | 927 content::RenderFrame* render_frame = |
927 content::RenderFrame::FromWebFrame(frame); | 928 content::RenderFrame::FromWebFrame(frame); |
928 | 929 |
929 // Metrics based on the timing information recorded for the Navigation Timing | 930 // Metrics based on the timing information recorded for the Navigation Timing |
930 // API - http://www.w3.org/TR/navigation-timing/. | 931 // API - http://www.w3.org/TR/navigation-timing/. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 | 1044 |
1044 DCHECK(document_state); | 1045 DCHECK(document_state); |
1045 DCHECK(ds); | 1046 DCHECK(ds); |
1046 GURL url(ds->request().url()); | 1047 GURL url(ds->request().url()); |
1047 Time start = document_state->start_load_time(); | 1048 Time start = document_state->start_load_time(); |
1048 Time finish = document_state->finish_load_time(); | 1049 Time finish = document_state->finish_load_time(); |
1049 // TODO(mbelshe): should we log more stats? | 1050 // TODO(mbelshe): should we log more stats? |
1050 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 1051 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
1051 << url.spec(); | 1052 << url.spec(); |
1052 } | 1053 } |
OLD | NEW |