| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 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.mo
jom.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/common/content_constants.h" | 26 #include "content/public/common/content_constants.h" |
| 27 #include "content/public/common/service_registry.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/URLConversion.h" | 35 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 35 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 36 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 36 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 37 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 // for pages visited due to an explicit user navigation. | 881 // for pages visited due to an explicit user navigation. |
| 881 if (SearchBouncer::GetInstance()->IsNewTabPage(frame->document().url())) { | 882 if (SearchBouncer::GetInstance()->IsNewTabPage(frame->document().url())) { |
| 882 return; | 883 return; |
| 883 } | 884 } |
| 884 | 885 |
| 885 DocumentState* document_state = | 886 DocumentState* document_state = |
| 886 DocumentState::FromDataSource(frame->dataSource()); | 887 DocumentState::FromDataSource(frame->dataSource()); |
| 887 | 888 |
| 888 bool data_reduction_proxy_was_used = false; | 889 bool data_reduction_proxy_was_used = false; |
| 889 if (!document_state->proxy_server().IsEmpty()) { | 890 if (!document_state->proxy_server().IsEmpty()) { |
| 890 bool handled = | 891 data_reduction_proxy::mojom::DataReductionProxyHostPtr |
| 891 Send(new DataReductionProxyViewHostMsg_IsDataReductionProxy( | 892 data_reduction_proxy_host; |
| 892 document_state->proxy_server(), &data_reduction_proxy_was_used)); | 893 content::RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService( |
| 894 mojo::GetProxy(&data_reduction_proxy_host)); |
| 895 bool handled = data_reduction_proxy_host->IsDataReductionProxy( |
| 896 document_state->proxy_server(), &data_reduction_proxy_was_used); |
| 893 // If the IPC call is not handled, then |data_reduction_proxy_was_used| | 897 // If the IPC call is not handled, then |data_reduction_proxy_was_used| |
| 894 // should remain |false|. | 898 // should remain |false|. |
| 895 DCHECK(handled || !data_reduction_proxy_was_used); | 899 DCHECK(handled || !data_reduction_proxy_was_used); |
| 896 } | 900 } |
| 897 | 901 |
| 898 bool came_from_websearch = IsFromGoogleSearchResult( | 902 bool came_from_websearch = IsFromGoogleSearchResult( |
| 899 frame->document().url(), | 903 frame->document().url(), |
| 900 blink::WebStringToGURL(frame->document().referrer())); | 904 blink::WebStringToGURL(frame->document().referrer())); |
| 901 int websearch_chrome_joint_experiment_id = kNoExperiment; | 905 int websearch_chrome_joint_experiment_id = kNoExperiment; |
| 902 bool is_preview = false; | 906 bool is_preview = false; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 Time start = document_state->start_load_time(); | 968 Time start = document_state->start_load_time(); |
| 965 Time finish = document_state->finish_load_time(); | 969 Time finish = document_state->finish_load_time(); |
| 966 // TODO(mbelshe): should we log more stats? | 970 // TODO(mbelshe): should we log more stats? |
| 967 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 971 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 968 << url.spec(); | 972 << url.spec(); |
| 969 } | 973 } |
| 970 | 974 |
| 971 void PageLoadHistograms::OnDestruct() { | 975 void PageLoadHistograms::OnDestruct() { |
| 972 delete this; | 976 delete this; |
| 973 } | 977 } |
| OLD | NEW |