Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/resource_dispatcher_host.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 116 |
| 117 // Maximum number of pending data messages sent to the renderer at any | 117 // Maximum number of pending data messages sent to the renderer at any |
| 118 // given time for a given request. | 118 // given time for a given request. |
| 119 const int kMaxPendingDataMessages = 20; | 119 const int kMaxPendingDataMessages = 20; |
| 120 | 120 |
| 121 // Maximum byte "cost" of all the outstanding requests for a renderer. | 121 // Maximum byte "cost" of all the outstanding requests for a renderer. |
| 122 // See delcaration of |max_outstanding_requests_cost_per_process_| for details. | 122 // See delcaration of |max_outstanding_requests_cost_per_process_| for details. |
| 123 // This bound is 25MB, which allows for around 6000 outstanding requests. | 123 // This bound is 25MB, which allows for around 6000 outstanding requests. |
| 124 const int kMaxOutstandingRequestsCostPerProcess = 26214400; | 124 const int kMaxOutstandingRequestsCostPerProcess = 26214400; |
| 125 | 125 |
| 126 // All possible error codes from the network module. Note that the error codes | |
| 127 // are all positive (since histograms expect positive sample values). | |
| 128 const int kAllNetErrorCodes[] = { | |
| 129 #define NET_ERROR(label, value) -(value), | |
| 130 #include "net/base/net_error_list.h" | |
| 131 #undef NET_ERROR | |
| 132 }; | |
| 133 | |
| 126 // Aborts a request before an URLRequest has actually been created. | 134 // Aborts a request before an URLRequest has actually been created. |
| 127 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, | 135 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, |
| 128 IPC::Message* sync_result, | 136 IPC::Message* sync_result, |
| 129 int route_id, | 137 int route_id, |
| 130 int request_id) { | 138 int request_id) { |
| 131 net::URLRequestStatus status(net::URLRequestStatus::FAILED, | 139 net::URLRequestStatus status(net::URLRequestStatus::FAILED, |
| 132 net::ERR_ABORTED); | 140 net::ERR_ABORTED); |
| 133 if (sync_result) { | 141 if (sync_result) { |
| 134 SyncLoadResult result; | 142 SyncLoadResult result; |
| 135 result.status = status; | 143 result.status = status; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 response->response_head.was_npn_negotiated = request->was_npn_negotiated(); | 212 response->response_head.was_npn_negotiated = request->was_npn_negotiated(); |
| 205 response->response_head.was_fetched_via_proxy = | 213 response->response_head.was_fetched_via_proxy = |
| 206 request->was_fetched_via_proxy(); | 214 request->was_fetched_via_proxy(); |
| 207 response->response_head.socket_address = request->GetSocketAddress(); | 215 response->response_head.socket_address = request->GetSocketAddress(); |
| 208 appcache::AppCacheInterceptor::GetExtraResponseInfo( | 216 appcache::AppCacheInterceptor::GetExtraResponseInfo( |
| 209 request, | 217 request, |
| 210 &response->response_head.appcache_id, | 218 &response->response_head.appcache_id, |
| 211 &response->response_head.appcache_manifest_url); | 219 &response->response_head.appcache_manifest_url); |
| 212 } | 220 } |
| 213 | 221 |
| 214 // Returns a list of all the possible error codes from the network module. | |
| 215 // Note that the error codes are all positive (since histograms expect positive | |
| 216 // sample values). | |
| 217 std::vector<int> GetAllNetErrorCodes() { | |
| 218 std::vector<int> all_error_codes; | |
| 219 #define NET_ERROR(label, value) all_error_codes.push_back(-(value)); | |
| 220 #include "net/base/net_error_list.h" | |
| 221 #undef NET_ERROR | |
| 222 return all_error_codes; | |
| 223 } | |
| 224 | |
| 225 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, | 222 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, |
| 226 const FilePath& path) { | 223 const FilePath& path) { |
| 227 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( | 224 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( |
| 228 child_id, path); | 225 child_id, path); |
| 229 } | 226 } |
| 230 | 227 |
| 231 #if defined(OS_WIN) | 228 #if defined(OS_WIN) |
| 232 #pragma warning(disable: 4748) | 229 #pragma warning(disable: 4748) |
| 233 #pragma optimize("", off) | 230 #pragma optimize("", off) |
| 234 #endif | 231 #endif |
| (...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1600 | 1597 |
| 1601 void ResourceDispatcherHost::OnResponseCompleted(net::URLRequest* request) { | 1598 void ResourceDispatcherHost::OnResponseCompleted(net::URLRequest* request) { |
| 1602 VLOG(1) << "OnResponseCompleted: " << request->url().spec(); | 1599 VLOG(1) << "OnResponseCompleted: " << request->url().spec(); |
| 1603 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1600 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 1604 | 1601 |
| 1605 // If the load for a main frame has failed, track it in a histogram, | 1602 // If the load for a main frame has failed, track it in a histogram, |
| 1606 // since it will probably cause the user to see an error page. | 1603 // since it will probably cause the user to see an error page. |
| 1607 if (!request->status().is_success() && | 1604 if (!request->status().is_success() && |
| 1608 info->resource_type() == ResourceType::MAIN_FRAME && | 1605 info->resource_type() == ResourceType::MAIN_FRAME && |
| 1609 request->status().os_error() != net::ERR_ABORTED) { | 1606 request->status().os_error() != net::ERR_ABORTED) { |
| 1610 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", | 1607 // This enumeration has "2" appended to its name to distinguish it from |
| 1611 -request->status().os_error(), | 1608 // its original version. We changed the buckets at one point (added |
| 1612 GetAllNetErrorCodes()); | 1609 // guard buckets by using CustomHistogram::ArrayToCustomRanges). |
| 1610 UMA_HISTOGRAM_CUSTOM_ENUMERATION( | |
| 1611 "Net.ErrorCodesForMainFrame2", | |
|
jar (doing other things)
2011/05/24 18:10:07
Be sure to submit a related addition to histograms
Jói
2011/05/24 18:27:31
Thanks for the reminder; preparing that now.
| |
| 1612 -request->status().os_error(), | |
| 1613 base::CustomHistogram::ArrayToCustomRanges( | |
| 1614 kAllNetErrorCodes, arraysize(kAllNetErrorCodes))); | |
| 1613 } | 1615 } |
| 1614 | 1616 |
| 1615 std::string security_info; | 1617 std::string security_info; |
| 1616 const net::SSLInfo& ssl_info = request->ssl_info(); | 1618 const net::SSLInfo& ssl_info = request->ssl_info(); |
| 1617 if (ssl_info.cert != NULL) { | 1619 if (ssl_info.cert != NULL) { |
| 1618 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert, | 1620 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert, |
| 1619 info->child_id()); | 1621 info->child_id()); |
| 1620 security_info = SSLManager::SerializeSecurityInfo( | 1622 security_info = SSLManager::SerializeSecurityInfo( |
| 1621 cert_id, ssl_info.cert_status, ssl_info.security_bits, | 1623 cert_id, ssl_info.cert_status, ssl_info.security_bits, |
| 1622 ssl_info.connection_status); | 1624 ssl_info.connection_status); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2039 return is_prefetch_enabled_; | 2041 return is_prefetch_enabled_; |
| 2040 } | 2042 } |
| 2041 | 2043 |
| 2042 // static | 2044 // static |
| 2043 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 2045 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
| 2044 is_prefetch_enabled_ = value; | 2046 is_prefetch_enabled_ = value; |
| 2045 } | 2047 } |
| 2046 | 2048 |
| 2047 // static | 2049 // static |
| 2048 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 2050 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
| OLD | NEW |