| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // use. Arbitrarily chosen. | 185 // use. Arbitrarily chosen. |
| 186 const double kMaxRequestsPerProcessRatio = 0.45; | 186 const double kMaxRequestsPerProcessRatio = 0.45; |
| 187 | 187 |
| 188 // TODO(jkarlin): The value is high to reduce the chance of the detachable | 188 // TODO(jkarlin): The value is high to reduce the chance of the detachable |
| 189 // request timing out, forcing a blocked second request to open a new connection | 189 // request timing out, forcing a blocked second request to open a new connection |
| 190 // and start over. Reduce this value once we have a better idea of what it | 190 // and start over. Reduce this value once we have a better idea of what it |
| 191 // should be and once we stop blocking multiple simultaneous requests for the | 191 // should be and once we stop blocking multiple simultaneous requests for the |
| 192 // same resource (see bugs 46104 and 31014). | 192 // same resource (see bugs 46104 and 31014). |
| 193 const int kDefaultDetachableCancelDelayMs = 30000; | 193 const int kDefaultDetachableCancelDelayMs = 30000; |
| 194 | 194 |
| 195 enum SHA1HistogramTypes { | |
| 196 // SHA-1 is not present in the certificate chain. | |
| 197 SHA1_NOT_PRESENT = 0, | |
| 198 // SHA-1 is present in the certificate chain, and the leaf expires on or | |
| 199 // after January 1, 2017. | |
| 200 SHA1_EXPIRES_AFTER_JANUARY_2017 = 1, | |
| 201 // SHA-1 is present in the certificate chain, and the leaf expires on or | |
| 202 // after June 1, 2016. | |
| 203 SHA1_EXPIRES_AFTER_JUNE_2016 = 2, | |
| 204 // SHA-1 is present in the certificate chain, and the leaf expires on or | |
| 205 // after January 1, 2016. | |
| 206 SHA1_EXPIRES_AFTER_JANUARY_2016 = 3, | |
| 207 // SHA-1 is present in the certificate chain, but the leaf expires before | |
| 208 // January 1, 2016 | |
| 209 SHA1_PRESENT = 4, | |
| 210 // Always keep this at the end. | |
| 211 SHA1_HISTOGRAM_TYPES_MAX, | |
| 212 }; | |
| 213 | |
| 214 void RecordCertificateHistograms(const net::SSLInfo& ssl_info, | |
| 215 ResourceType resource_type) { | |
| 216 // The internal representation of the dates for UI treatment of SHA-1. | |
| 217 // See http://crbug.com/401365 for details | |
| 218 static const int64_t kJanuary2017 = INT64_C(13127702400000000); | |
| 219 static const int64_t kJune2016 = INT64_C(13109213000000000); | |
| 220 static const int64_t kJanuary2016 = INT64_C(13096080000000000); | |
| 221 | |
| 222 SHA1HistogramTypes sha1_histogram = SHA1_NOT_PRESENT; | |
| 223 if (ssl_info.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) { | |
| 224 DCHECK(ssl_info.cert.get()); | |
| 225 if (ssl_info.cert->valid_expiry() >= | |
| 226 base::Time::FromInternalValue(kJanuary2017)) { | |
| 227 sha1_histogram = SHA1_EXPIRES_AFTER_JANUARY_2017; | |
| 228 } else if (ssl_info.cert->valid_expiry() >= | |
| 229 base::Time::FromInternalValue(kJune2016)) { | |
| 230 sha1_histogram = SHA1_EXPIRES_AFTER_JUNE_2016; | |
| 231 } else if (ssl_info.cert->valid_expiry() >= | |
| 232 base::Time::FromInternalValue(kJanuary2016)) { | |
| 233 sha1_histogram = SHA1_EXPIRES_AFTER_JANUARY_2016; | |
| 234 } else { | |
| 235 sha1_histogram = SHA1_PRESENT; | |
| 236 } | |
| 237 } | |
| 238 if (resource_type == RESOURCE_TYPE_MAIN_FRAME) { | |
| 239 UMA_HISTOGRAM_ENUMERATION("Net.Certificate.SHA1.MainFrame", | |
| 240 sha1_histogram, | |
| 241 SHA1_HISTOGRAM_TYPES_MAX); | |
| 242 } else { | |
| 243 UMA_HISTOGRAM_ENUMERATION("Net.Certificate.SHA1.Subresource", | |
| 244 sha1_histogram, | |
| 245 SHA1_HISTOGRAM_TYPES_MAX); | |
| 246 } | |
| 247 } | |
| 248 | |
| 249 bool IsDetachableResourceType(ResourceType type) { | 195 bool IsDetachableResourceType(ResourceType type) { |
| 250 switch (type) { | 196 switch (type) { |
| 251 case RESOURCE_TYPE_PREFETCH: | 197 case RESOURCE_TYPE_PREFETCH: |
| 252 case RESOURCE_TYPE_PING: | 198 case RESOURCE_TYPE_PING: |
| 253 case RESOURCE_TYPE_CSP_REPORT: | 199 case RESOURCE_TYPE_CSP_REPORT: |
| 254 return true; | 200 return true; |
| 255 default: | 201 default: |
| 256 return false; | 202 return false; |
| 257 } | 203 } |
| 258 } | 204 } |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 UMA_HISTOGRAM_SPARSE_SLOWLY( | 718 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 773 "Net.ErrorCodesForImages", | 719 "Net.ErrorCodesForImages", |
| 774 -loader->request()->status().error()); | 720 -loader->request()->status().error()); |
| 775 } | 721 } |
| 776 // This enumeration has "2" appended to distinguish it from older versions. | 722 // This enumeration has "2" appended to distinguish it from older versions. |
| 777 UMA_HISTOGRAM_SPARSE_SLOWLY( | 723 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 778 "Net.ErrorCodesForSubresources2", | 724 "Net.ErrorCodesForSubresources2", |
| 779 -loader->request()->status().error()); | 725 -loader->request()->status().error()); |
| 780 } | 726 } |
| 781 | 727 |
| 782 if (loader->request()->url().SchemeIsCryptographic()) { | |
| 783 RecordCertificateHistograms(loader->request()->ssl_info(), | |
| 784 info->GetResourceType()); | |
| 785 } | |
| 786 | |
| 787 if (delegate_) | 728 if (delegate_) |
| 788 delegate_->RequestComplete(loader->request()); | 729 delegate_->RequestComplete(loader->request()); |
| 789 | 730 |
| 790 // Destroy the ResourceLoader. | 731 // Destroy the ResourceLoader. |
| 791 RemovePendingRequest(info->GetChildID(), info->GetRequestID()); | 732 RemovePendingRequest(info->GetChildID(), info->GetRequestID()); |
| 792 } | 733 } |
| 793 | 734 |
| 794 std::unique_ptr<net::ClientCertStore> | 735 std::unique_ptr<net::ClientCertStore> |
| 795 ResourceDispatcherHostImpl::CreateClientCertStore(ResourceLoader* loader) { | 736 ResourceDispatcherHostImpl::CreateClientCertStore(ResourceLoader* loader) { |
| 796 return delegate_->CreateClientCertStore( | 737 return delegate_->CreateClientCertStore( |
| (...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 &throttles); | 2656 &throttles); |
| 2716 if (!throttles.empty()) { | 2657 if (!throttles.empty()) { |
| 2717 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2658 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2718 std::move(throttles))); | 2659 std::move(throttles))); |
| 2719 } | 2660 } |
| 2720 } | 2661 } |
| 2721 return handler; | 2662 return handler; |
| 2722 } | 2663 } |
| 2723 | 2664 |
| 2724 } // namespace content | 2665 } // namespace content |
| OLD | NEW |