| 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 19 matching lines...) Expand all Loading... |
| 30 #include "base/metrics/sparse_histogram.h" | 30 #include "base/metrics/sparse_histogram.h" |
| 31 #include "base/profiler/scoped_tracker.h" | 31 #include "base/profiler/scoped_tracker.h" |
| 32 #include "base/stl_util.h" | 32 #include "base/stl_util.h" |
| 33 #include "base/strings/string_util.h" | 33 #include "base/strings/string_util.h" |
| 34 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 34 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 35 #include "base/time/time.h" | 35 #include "base/time/time.h" |
| 36 #include "content/browser/appcache/appcache_interceptor.h" | 36 #include "content/browser/appcache/appcache_interceptor.h" |
| 37 #include "content/browser/appcache/chrome_appcache_service.h" | 37 #include "content/browser/appcache/chrome_appcache_service.h" |
| 38 #include "content/browser/bad_message.h" | 38 #include "content/browser/bad_message.h" |
| 39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 40 #include "content/browser/cert_store_impl.h" | |
| 41 #include "content/browser/child_process_security_policy_impl.h" | 40 #include "content/browser/child_process_security_policy_impl.h" |
| 42 #include "content/browser/frame_host/frame_tree.h" | 41 #include "content/browser/frame_host/frame_tree.h" |
| 43 #include "content/browser/frame_host/navigation_handle_impl.h" | 42 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 44 #include "content/browser/frame_host/navigation_request_info.h" | 43 #include "content/browser/frame_host/navigation_request_info.h" |
| 45 #include "content/browser/frame_host/navigator.h" | 44 #include "content/browser/frame_host/navigator.h" |
| 46 #include "content/browser/loader/async_resource_handler.h" | 45 #include "content/browser/loader/async_resource_handler.h" |
| 47 #include "content/browser/loader/async_revalidation_manager.h" | 46 #include "content/browser/loader/async_revalidation_manager.h" |
| 48 #include "content/browser/loader/cross_site_resource_handler.h" | 47 #include "content/browser/loader/cross_site_resource_handler.h" |
| 49 #include "content/browser/loader/detachable_resource_handler.h" | 48 #include "content/browser/loader/detachable_resource_handler.h" |
| 50 #include "content/browser/loader/intercepting_resource_handler.h" | 49 #include "content/browser/loader/intercepting_resource_handler.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 287 } |
| 289 request->set_referrer_policy(net_referrer_policy); | 288 request->set_referrer_policy(net_referrer_policy); |
| 290 } | 289 } |
| 291 | 290 |
| 292 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, | 291 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, |
| 293 const base::FilePath& path) { | 292 const base::FilePath& path) { |
| 294 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeAllPermissionsForFile( | 293 ChildProcessSecurityPolicyImpl::GetInstance()->RevokeAllPermissionsForFile( |
| 295 child_id, path); | 294 child_id, path); |
| 296 } | 295 } |
| 297 | 296 |
| 298 int GetCertID(CertStore* cert_store, net::URLRequest* request, int child_id) { | |
| 299 if (request->ssl_info().cert.get()) | |
| 300 return cert_store->StoreCert(request->ssl_info().cert.get(), child_id); | |
| 301 return 0; | |
| 302 } | |
| 303 | |
| 304 bool IsValidatedSCT( | 297 bool IsValidatedSCT( |
| 305 const net::SignedCertificateTimestampAndStatus& sct_status) { | 298 const net::SignedCertificateTimestampAndStatus& sct_status) { |
| 306 return sct_status.status == net::ct::SCT_STATUS_OK; | 299 return sct_status.status == net::ct::SCT_STATUS_OK; |
| 307 } | 300 } |
| 308 | 301 |
| 309 storage::BlobStorageContext* GetBlobStorageContext( | 302 storage::BlobStorageContext* GetBlobStorageContext( |
| 310 ChromeBlobStorageContext* blob_storage_context) { | 303 ChromeBlobStorageContext* blob_storage_context) { |
| 311 if (!blob_storage_context) | 304 if (!blob_storage_context) |
| 312 return NULL; | 305 return NULL; |
| 313 return blob_storage_context->context(); | 306 return blob_storage_context->context(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 if (frame_host) | 406 if (frame_host) |
| 414 routing_ids->insert(frame_host->GetGlobalFrameRoutingId()); | 407 routing_ids->insert(frame_host->GetGlobalFrameRoutingId()); |
| 415 if (pending_frame_host) | 408 if (pending_frame_host) |
| 416 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); | 409 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); |
| 417 } | 410 } |
| 418 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 411 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 419 base::Bind(&NotifyForRouteSetOnIO, frame_callback, | 412 base::Bind(&NotifyForRouteSetOnIO, frame_callback, |
| 420 base::Passed(std::move(routing_ids)))); | 413 base::Passed(std::move(routing_ids)))); |
| 421 } | 414 } |
| 422 | 415 |
| 423 void UpdateSSLStatus(int render_process_id, | |
| 424 int render_frame_host_id, | |
| 425 const GURL& url, | |
| 426 CertStore* cert_store) { | |
| 427 RenderFrameHostImpl* render_frame_host = | |
| 428 RenderFrameHostImpl::FromID(render_process_id, render_frame_host_id); | |
| 429 if (!render_frame_host) | |
| 430 return; | |
| 431 | |
| 432 NavigationHandleImpl* navigation_handle = | |
| 433 render_frame_host->navigation_handle(); | |
| 434 if (!navigation_handle || navigation_handle->GetURL() != url) | |
| 435 return; | |
| 436 | |
| 437 scoped_refptr<net::X509Certificate> cert; | |
| 438 if (!cert_store->RetrieveCert( | |
| 439 navigation_handle->ssl_status().cert_id, &cert)) { | |
| 440 NOTREACHED() << "Must have set an SSL certificate already."; | |
| 441 return; | |
| 442 } | |
| 443 | |
| 444 int new_cert_id = cert_store->StoreCert(cert.get(), render_process_id); | |
| 445 navigation_handle->UpdateSSLCertId(new_cert_id); | |
| 446 } | |
| 447 | |
| 448 } // namespace | 416 } // namespace |
| 449 | 417 |
| 450 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} | 418 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} |
| 451 | 419 |
| 452 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} | 420 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} |
| 453 | 421 |
| 454 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( | 422 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( |
| 455 const HeaderInterceptorInfo& other) {} | 423 const HeaderInterceptorInfo& other) {} |
| 456 | 424 |
| 457 // static | 425 // static |
| 458 ResourceDispatcherHost* ResourceDispatcherHost::Get() { | 426 ResourceDispatcherHost* ResourceDispatcherHost::Get() { |
| 459 return g_resource_dispatcher_host; | 427 return g_resource_dispatcher_host; |
| 460 } | 428 } |
| 461 | 429 |
| 462 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl( | 430 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl( |
| 463 CreateDownloadHandlerIntercept download_handler_intercept) | 431 CreateDownloadHandlerIntercept download_handler_intercept) |
| 464 : request_id_(-1), | 432 : request_id_(-1), |
| 465 is_shutdown_(false), | 433 is_shutdown_(false), |
| 466 num_in_flight_requests_(0), | 434 num_in_flight_requests_(0), |
| 467 max_num_in_flight_requests_(base::SharedMemory::GetHandleLimit()), | 435 max_num_in_flight_requests_(base::SharedMemory::GetHandleLimit()), |
| 468 max_num_in_flight_requests_per_process_(static_cast<int>( | 436 max_num_in_flight_requests_per_process_(static_cast<int>( |
| 469 max_num_in_flight_requests_ * kMaxRequestsPerProcessRatio)), | 437 max_num_in_flight_requests_ * kMaxRequestsPerProcessRatio)), |
| 470 max_outstanding_requests_cost_per_process_( | 438 max_outstanding_requests_cost_per_process_( |
| 471 kMaxOutstandingRequestsCostPerProcess), | 439 kMaxOutstandingRequestsCostPerProcess), |
| 472 filter_(nullptr), | 440 filter_(nullptr), |
| 473 delegate_(nullptr), | 441 delegate_(nullptr), |
| 474 loader_delegate_(nullptr), | 442 loader_delegate_(nullptr), |
| 475 allow_cross_origin_auth_prompt_(false), | 443 allow_cross_origin_auth_prompt_(false), |
| 476 cert_store_for_testing_(nullptr), | |
| 477 create_download_handler_intercept_(download_handler_intercept) { | 444 create_download_handler_intercept_(download_handler_intercept) { |
| 478 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 445 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 479 DCHECK(!g_resource_dispatcher_host); | 446 DCHECK(!g_resource_dispatcher_host); |
| 480 g_resource_dispatcher_host = this; | 447 g_resource_dispatcher_host = this; |
| 481 | 448 |
| 482 ANNOTATE_BENIGN_RACE( | 449 ANNOTATE_BENIGN_RACE( |
| 483 &last_user_gesture_time_, | 450 &last_user_gesture_time_, |
| 484 "We don't care about the precise value, see http://crbug.com/92889"); | 451 "We don't care about the precise value, see http://crbug.com/92889"); |
| 485 | 452 |
| 486 BrowserThread::PostTask(BrowserThread::IO, | 453 BrowserThread::PostTask(BrowserThread::IO, |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 775 |
| 809 // Don't notify WebContents observers for requests known to be | 776 // Don't notify WebContents observers for requests known to be |
| 810 // downloads; they aren't really associated with the Webcontents. | 777 // downloads; they aren't really associated with the Webcontents. |
| 811 // Note that not all downloads are known before content sniffing. | 778 // Note that not all downloads are known before content sniffing. |
| 812 if (info->IsDownload()) | 779 if (info->IsDownload()) |
| 813 return; | 780 return; |
| 814 | 781 |
| 815 // Notify the observers on the UI thread. | 782 // Notify the observers on the UI thread. |
| 816 std::unique_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails( | 783 std::unique_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails( |
| 817 loader->request(), | 784 loader->request(), |
| 818 GetCertID(GetCertStore(), loader->request(), info->GetChildID()), | 785 !!request->ssl_info().cert, |
| 819 new_url)); | 786 new_url)); |
| 820 loader_delegate_->DidGetRedirectForResourceRequest( | 787 loader_delegate_->DidGetRedirectForResourceRequest( |
| 821 render_process_id, render_frame_host, std::move(detail)); | 788 render_process_id, render_frame_host, std::move(detail)); |
| 822 } | 789 } |
| 823 | 790 |
| 824 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { | 791 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { |
| 825 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 792 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
| 826 net::URLRequest* request = loader->request(); | 793 net::URLRequest* request = loader->request(); |
| 827 if (request->was_fetched_via_proxy() && | 794 if (request->was_fetched_via_proxy() && |
| 828 request->was_fetched_via_spdy() && | 795 request->was_fetched_via_spdy() && |
| (...skipping 15 matching lines...) Expand all Loading... |
| 844 return; | 811 return; |
| 845 | 812 |
| 846 // Don't notify WebContents observers for requests known to be | 813 // Don't notify WebContents observers for requests known to be |
| 847 // downloads; they aren't really associated with the Webcontents. | 814 // downloads; they aren't really associated with the Webcontents. |
| 848 // Note that not all downloads are known before content sniffing. | 815 // Note that not all downloads are known before content sniffing. |
| 849 if (info->IsDownload()) | 816 if (info->IsDownload()) |
| 850 return; | 817 return; |
| 851 | 818 |
| 852 // Notify the observers on the UI thread. | 819 // Notify the observers on the UI thread. |
| 853 std::unique_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails( | 820 std::unique_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails( |
| 854 request, GetCertID(GetCertStore(), request, info->GetChildID()))); | 821 request, !!request->ssl_info().cert)); |
| 855 loader_delegate_->DidGetResourceResponseStart( | 822 loader_delegate_->DidGetResourceResponseStart( |
| 856 render_process_id, render_frame_host, std::move(detail)); | 823 render_process_id, render_frame_host, std::move(detail)); |
| 857 } | 824 } |
| 858 | 825 |
| 859 void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) { | 826 void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) { |
| 860 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 827 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
| 861 | 828 |
| 862 // Record final result of all resource loads. | 829 // Record final result of all resource loads. |
| 863 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) { | 830 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) { |
| 864 // This enumeration has "3" appended to its name to distinguish it from | 831 // This enumeration has "3" appended to its name to distinguish it from |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 ResourceLoader* loader_ptr = loader.get(); | 1117 ResourceLoader* loader_ptr = loader.get(); |
| 1151 pending_loaders_.erase(iter); | 1118 pending_loaders_.erase(iter); |
| 1152 | 1119 |
| 1153 // ResourceHandlers should always get state related to the request from the | 1120 // ResourceHandlers should always get state related to the request from the |
| 1154 // ResourceRequestInfo rather than caching it locally. This lets us update | 1121 // ResourceRequestInfo rather than caching it locally. This lets us update |
| 1155 // the info object when a transfer occurs. | 1122 // the info object when a transfer occurs. |
| 1156 info->UpdateForTransfer(child_id, route_id, request_data.render_frame_id, | 1123 info->UpdateForTransfer(child_id, route_id, request_data.render_frame_id, |
| 1157 request_data.origin_pid, request_id, | 1124 request_data.origin_pid, request_id, |
| 1158 filter_->GetWeakPtr()); | 1125 filter_->GetWeakPtr()); |
| 1159 | 1126 |
| 1160 // If a certificate is stored with the ResourceResponse, it has to be | |
| 1161 // updated to be associated with the new process. | |
| 1162 if (loader->transferring_response()) { | |
| 1163 UpdateResponseCertificateForTransfer(loader->transferring_response(), | |
| 1164 loader->request(), | |
| 1165 info); | |
| 1166 } | |
| 1167 | |
| 1168 // Update maps that used the old IDs, if necessary. Some transfers in tests | 1127 // Update maps that used the old IDs, if necessary. Some transfers in tests |
| 1169 // do not actually use a different ID, so not all maps need to be updated. | 1128 // do not actually use a different ID, so not all maps need to be updated. |
| 1170 pending_loaders_[new_request_id] = std::move(loader); | 1129 pending_loaders_[new_request_id] = std::move(loader); |
| 1171 IncrementOutstandingRequestsMemory(1, *info); | 1130 IncrementOutstandingRequestsMemory(1, *info); |
| 1172 if (should_update_count) | 1131 if (should_update_count) |
| 1173 IncrementOutstandingRequestsCount(1, info); | 1132 IncrementOutstandingRequestsCount(1, info); |
| 1174 if (old_routing_id != new_routing_id) { | 1133 if (old_routing_id != new_routing_id) { |
| 1175 if (blocked_loaders_map_.find(old_routing_id) != | 1134 if (blocked_loaders_map_.find(old_routing_id) != |
| 1176 blocked_loaders_map_.end()) { | 1135 blocked_loaders_map_.end()) { |
| 1177 blocked_loaders_map_[new_routing_id] = | 1136 blocked_loaders_map_[new_routing_id] = |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 InterceptingResourceHandler* intercepting_handler = | 1619 InterceptingResourceHandler* intercepting_handler = |
| 1661 static_cast<InterceptingResourceHandler*>(handler.get()); | 1620 static_cast<InterceptingResourceHandler*>(handler.get()); |
| 1662 | 1621 |
| 1663 ScopedVector<ResourceThrottle> throttles; | 1622 ScopedVector<ResourceThrottle> throttles; |
| 1664 | 1623 |
| 1665 // Add a NavigationResourceThrottle for navigations. | 1624 // Add a NavigationResourceThrottle for navigations. |
| 1666 // PlzNavigate: the throttle is unnecessary as communication with the UI | 1625 // PlzNavigate: the throttle is unnecessary as communication with the UI |
| 1667 // thread is handled by the NavigationURLloader. | 1626 // thread is handled by the NavigationURLloader. |
| 1668 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) { | 1627 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) { |
| 1669 throttles.push_back(new NavigationResourceThrottle( | 1628 throttles.push_back(new NavigationResourceThrottle( |
| 1670 request, delegate_, GetCertStore(), fetch_request_context_type)); | 1629 request, delegate_, fetch_request_context_type)); |
| 1671 } | 1630 } |
| 1672 | 1631 |
| 1673 if (delegate_) { | 1632 if (delegate_) { |
| 1674 delegate_->RequestBeginning(request, | 1633 delegate_->RequestBeginning(request, |
| 1675 resource_context, | 1634 resource_context, |
| 1676 appcache_service, | 1635 appcache_service, |
| 1677 resource_type, | 1636 resource_type, |
| 1678 &throttles); | 1637 &throttles); |
| 1679 } | 1638 } |
| 1680 | 1639 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 // Hang on to a reference to ensure the blob is not released prior | 2181 // Hang on to a reference to ensure the blob is not released prior |
| 2223 // to the job being started. | 2182 // to the job being started. |
| 2224 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2183 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 2225 new_request.get(), | 2184 new_request.get(), |
| 2226 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2185 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
| 2227 } | 2186 } |
| 2228 | 2187 |
| 2229 // TODO(davidben): Attach AppCacheInterceptor. | 2188 // TODO(davidben): Attach AppCacheInterceptor. |
| 2230 | 2189 |
| 2231 std::unique_ptr<ResourceHandler> handler( | 2190 std::unique_ptr<ResourceHandler> handler( |
| 2232 new NavigationResourceHandler(new_request.get(), loader, delegate(), | 2191 new NavigationResourceHandler(new_request.get(), loader, delegate())); |
| 2233 GetCertStore())); | |
| 2234 | 2192 |
| 2235 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the | 2193 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the |
| 2236 // dependency on child_id/route_id. Those are used by the ResourceScheduler; | 2194 // dependency on child_id/route_id. Those are used by the ResourceScheduler; |
| 2237 // currently it's a no-op. | 2195 // currently it's a no-op. |
| 2238 handler = | 2196 handler = |
| 2239 AddStandardHandlers(new_request.get(), resource_type, resource_context, | 2197 AddStandardHandlers(new_request.get(), resource_type, resource_context, |
| 2240 info.begin_params.request_context_type, | 2198 info.begin_params.request_context_type, |
| 2241 nullptr, // appcache_service | 2199 nullptr, // appcache_service |
| 2242 -1, // child_id | 2200 -1, // child_id |
| 2243 -1, // route_id | 2201 -1, // route_id |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2322 } | 2280 } |
| 2323 | 2281 |
| 2324 IncrementOutstandingRequestsMemory(-1, *info); | 2282 IncrementOutstandingRequestsMemory(-1, *info); |
| 2325 | 2283 |
| 2326 // A ResourceHandler must not outlive its associated URLRequest. | 2284 // A ResourceHandler must not outlive its associated URLRequest. |
| 2327 handler.reset(); | 2285 handler.reset(); |
| 2328 return; | 2286 return; |
| 2329 } | 2287 } |
| 2330 | 2288 |
| 2331 std::unique_ptr<ResourceLoader> loader(new ResourceLoader( | 2289 std::unique_ptr<ResourceLoader> loader(new ResourceLoader( |
| 2332 std::move(request), std::move(handler), GetCertStore(), this)); | 2290 std::move(request), std::move(handler), this)); |
| 2333 | 2291 |
| 2334 GlobalFrameRoutingId id(info->GetChildID(), info->GetRenderFrameID()); | 2292 GlobalFrameRoutingId id(info->GetChildID(), info->GetRenderFrameID()); |
| 2335 BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id); | 2293 BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id); |
| 2336 if (iter != blocked_loaders_map_.end()) { | 2294 if (iter != blocked_loaders_map_.end()) { |
| 2337 // The request should be blocked. | 2295 // The request should be blocked. |
| 2338 iter->second->push_back(std::move(loader)); | 2296 iter->second->push_back(std::move(loader)); |
| 2339 return; | 2297 return; |
| 2340 } | 2298 } |
| 2341 | 2299 |
| 2342 StartLoading(info, std::move(loader)); | 2300 StartLoading(info, std::move(loader)); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) { | 2585 } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) { |
| 2628 load_flags |= net::LOAD_PREFETCH; | 2586 load_flags |= net::LOAD_PREFETCH; |
| 2629 } | 2587 } |
| 2630 | 2588 |
| 2631 if (is_sync_load) | 2589 if (is_sync_load) |
| 2632 load_flags |= net::LOAD_IGNORE_LIMITS; | 2590 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2633 | 2591 |
| 2634 return load_flags; | 2592 return load_flags; |
| 2635 } | 2593 } |
| 2636 | 2594 |
| 2637 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer( | |
| 2638 ResourceResponse* response, | |
| 2639 net::URLRequest* request, | |
| 2640 ResourceRequestInfoImpl* info) { | |
| 2641 const net::SSLInfo& ssl_info = request->ssl_info(); | |
| 2642 if (info->GetResourceType() != RESOURCE_TYPE_MAIN_FRAME || !ssl_info.cert) | |
| 2643 return; | |
| 2644 int render_process_id, render_frame_id; | |
| 2645 if (info->GetAssociatedRenderFrame(&render_process_id, &render_frame_id)) { | |
| 2646 BrowserThread::PostTask(BrowserThread::UI, | |
| 2647 FROM_HERE, | |
| 2648 base::Bind(UpdateSSLStatus, | |
| 2649 render_process_id, | |
| 2650 render_frame_id, | |
| 2651 request->url(), | |
| 2652 GetCertStore())); | |
| 2653 } | |
| 2654 } | |
| 2655 | |
| 2656 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | |
| 2657 return cert_store_for_testing_ ? cert_store_for_testing_ | |
| 2658 : CertStore::GetInstance(); | |
| 2659 } | |
| 2660 | |
| 2661 bool ResourceDispatcherHostImpl::ShouldServiceRequest( | 2595 bool ResourceDispatcherHostImpl::ShouldServiceRequest( |
| 2662 int process_type, | 2596 int process_type, |
| 2663 int child_id, | 2597 int child_id, |
| 2664 const ResourceRequest& request_data, | 2598 const ResourceRequest& request_data, |
| 2665 const net::HttpRequestHeaders& headers, | 2599 const net::HttpRequestHeaders& headers, |
| 2666 ResourceMessageFilter* filter, | 2600 ResourceMessageFilter* filter, |
| 2667 ResourceContext* resource_context) { | 2601 ResourceContext* resource_context) { |
| 2668 ChildProcessSecurityPolicyImpl* policy = | 2602 ChildProcessSecurityPolicyImpl* policy = |
| 2669 ChildProcessSecurityPolicyImpl::GetInstance(); | 2603 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 2670 | 2604 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2730 request_info->GetRouteID(), is_content_initiated, true, &throttles); | 2664 request_info->GetRouteID(), is_content_initiated, true, &throttles); |
| 2731 if (!throttles.empty()) { | 2665 if (!throttles.empty()) { |
| 2732 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2666 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2733 std::move(throttles))); | 2667 std::move(throttles))); |
| 2734 } | 2668 } |
| 2735 } | 2669 } |
| 2736 return handler; | 2670 return handler; |
| 2737 } | 2671 } |
| 2738 | 2672 |
| 2739 } // namespace content | 2673 } // namespace content |
| OLD | NEW |