| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 response->response_head.was_npn_negotiated = request->was_npn_negotiated(); | 204 response->response_head.was_npn_negotiated = request->was_npn_negotiated(); |
| 205 response->response_head.was_fetched_via_proxy = | 205 response->response_head.was_fetched_via_proxy = |
| 206 request->was_fetched_via_proxy(); | 206 request->was_fetched_via_proxy(); |
| 207 response->response_head.socket_address = request->GetSocketAddress(); | 207 response->response_head.socket_address = request->GetSocketAddress(); |
| 208 appcache::AppCacheInterceptor::GetExtraResponseInfo( | 208 appcache::AppCacheInterceptor::GetExtraResponseInfo( |
| 209 request, | 209 request, |
| 210 &response->response_head.appcache_id, | 210 &response->response_head.appcache_id, |
| 211 &response->response_head.appcache_manifest_url); | 211 &response->response_head.appcache_manifest_url); |
| 212 } | 212 } |
| 213 | 213 |
| 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, | 214 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, |
| 226 const FilePath& path) { | 215 const FilePath& path) { |
| 227 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( | 216 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( |
| 228 child_id, path); | 217 child_id, path); |
| 229 } | 218 } |
| 230 | 219 |
| 231 #if defined(OS_WIN) | 220 #if defined(OS_WIN) |
| 232 #pragma warning(disable: 4748) | 221 #pragma warning(disable: 4748) |
| 233 #pragma optimize("", off) | 222 #pragma optimize("", off) |
| 234 #endif | 223 #endif |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 VLOG(1) << "OnResponseCompleted: " << request->url().spec(); | 1594 VLOG(1) << "OnResponseCompleted: " << request->url().spec(); |
| 1606 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1595 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 1607 | 1596 |
| 1608 // If the load for a main frame has failed, track it in a histogram, | 1597 // If the load for a main frame has failed, track it in a histogram, |
| 1609 // since it will probably cause the user to see an error page. | 1598 // since it will probably cause the user to see an error page. |
| 1610 if (!request->status().is_success() && | 1599 if (!request->status().is_success() && |
| 1611 info->resource_type() == ResourceType::MAIN_FRAME && | 1600 info->resource_type() == ResourceType::MAIN_FRAME && |
| 1612 request->status().os_error() != net::ERR_ABORTED) { | 1601 request->status().os_error() != net::ERR_ABORTED) { |
| 1613 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", | 1602 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", |
| 1614 -request->status().os_error(), | 1603 -request->status().os_error(), |
| 1615 GetAllNetErrorCodes()); | 1604 net::GetAllErrorCodesForUma()); |
| 1616 } | 1605 } |
| 1617 | 1606 |
| 1618 std::string security_info; | 1607 std::string security_info; |
| 1619 const net::SSLInfo& ssl_info = request->ssl_info(); | 1608 const net::SSLInfo& ssl_info = request->ssl_info(); |
| 1620 if (ssl_info.cert != NULL) { | 1609 if (ssl_info.cert != NULL) { |
| 1621 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert, | 1610 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert, |
| 1622 info->child_id()); | 1611 info->child_id()); |
| 1623 security_info = SSLManager::SerializeSecurityInfo( | 1612 security_info = SSLManager::SerializeSecurityInfo( |
| 1624 cert_id, ssl_info.cert_status, ssl_info.security_bits, | 1613 cert_id, ssl_info.cert_status, ssl_info.security_bits, |
| 1625 ssl_info.connection_status); | 1614 ssl_info.connection_status); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 return is_prefetch_enabled_; | 2053 return is_prefetch_enabled_; |
| 2065 } | 2054 } |
| 2066 | 2055 |
| 2067 // static | 2056 // static |
| 2068 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 2057 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
| 2069 is_prefetch_enabled_ = value; | 2058 is_prefetch_enabled_ = value; |
| 2070 } | 2059 } |
| 2071 | 2060 |
| 2072 // static | 2061 // static |
| 2073 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 2062 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
| OLD | NEW |