| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 // Helper function to check for string in 'via' header. Returns true if | 159 // Helper function to check for string in 'via' header. Returns true if |
| 160 // |via_value| is one of the values listed in the Via header. | 160 // |via_value| is one of the values listed in the Via header. |
| 161 bool ViaHeaderContains(WebFrame* frame, const std::string& via_value) { | 161 bool ViaHeaderContains(WebFrame* frame, const std::string& via_value) { |
| 162 const char kViaHeaderName[] = "Via"; | 162 const char kViaHeaderName[] = "Via"; |
| 163 std::vector<std::string> values; | 163 std::vector<std::string> values; |
| 164 // Multiple via headers have already been coalesced and hence each value | 164 // Multiple via headers have already been coalesced and hence each value |
| 165 // separated by a comma corresponds to a proxy. The value added by a proxy is | 165 // separated by a comma corresponds to a proxy. The value added by a proxy is |
| 166 // not expected to contain any commas. | 166 // not expected to contain any commas. |
| 167 // Example., Via: 1.0 Compression proxy, 1.1 Google Instant Proxy Preview | 167 // Example., Via: 1.0 Compression proxy, 1.1 Google Instant Proxy Preview |
| 168 base::SplitString( | 168 values = base::SplitString( |
| 169 frame->dataSource()->response().httpHeaderField(kViaHeaderName).utf8(), | 169 frame->dataSource()->response().httpHeaderField(kViaHeaderName).utf8(), |
| 170 ',', &values); | 170 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 171 return std::find(values.begin(), values.end(), via_value) != values.end(); | 171 return std::find(values.begin(), values.end(), via_value) != values.end(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Returns true if the provided URL is a referrer string that came from | 174 // Returns true if the provided URL is a referrer string that came from |
| 175 // a Google Web Search results page. This is a little non-deterministic | 175 // a Google Web Search results page. This is a little non-deterministic |
| 176 // because desktop and mobile websearch differ and sometimes just provide | 176 // because desktop and mobile websearch differ and sometimes just provide |
| 177 // http://www.google.com/ as the referrer. In the case of /url we can be sure | 177 // http://www.google.com/ as the referrer. In the case of /url we can be sure |
| 178 // that it came from websearch but we will be generous and allow for cases | 178 // that it came from websearch but we will be generous and allow for cases |
| 179 // where a non-Google URL was provided a bare Google URL as a referrer. | 179 // where a non-Google URL was provided a bare Google URL as a referrer. |
| 180 // The domain validation matches the code used by the prerenderer for similar | 180 // The domain validation matches the code used by the prerenderer for similar |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 | 1016 |
| 1017 DCHECK(document_state); | 1017 DCHECK(document_state); |
| 1018 DCHECK(ds); | 1018 DCHECK(ds); |
| 1019 GURL url(ds->request().url()); | 1019 GURL url(ds->request().url()); |
| 1020 Time start = document_state->start_load_time(); | 1020 Time start = document_state->start_load_time(); |
| 1021 Time finish = document_state->finish_load_time(); | 1021 Time finish = document_state->finish_load_time(); |
| 1022 // TODO(mbelshe): should we log more stats? | 1022 // TODO(mbelshe): should we log more stats? |
| 1023 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " | 1023 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " |
| 1024 << url.spec(); | 1024 << url.spec(); |
| 1025 } | 1025 } |
| OLD | NEW |