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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 if (frame_host) | 409 if (frame_host) |
410 routing_ids->insert(frame_host->GetGlobalFrameRoutingId()); | 410 routing_ids->insert(frame_host->GetGlobalFrameRoutingId()); |
411 if (pending_frame_host) | 411 if (pending_frame_host) |
412 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); | 412 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); |
413 } | 413 } |
414 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 414 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
415 base::Bind(&NotifyForRouteSetOnIO, frame_callback, | 415 base::Bind(&NotifyForRouteSetOnIO, frame_callback, |
416 base::Passed(std::move(routing_ids)))); | 416 base::Passed(std::move(routing_ids)))); |
417 } | 417 } |
418 | 418 |
| 419 void SetTransferredRFHSSLStatus(int render_process_id, |
| 420 int render_frame_id, |
| 421 const GURL& url, |
| 422 const SSLStatus& ssl_status) { |
| 423 RenderFrameHostImpl* rfh = |
| 424 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); |
| 425 if (rfh) |
| 426 rfh->SetSSLStatusForPendingNavigate(url, ssl_status); |
| 427 } |
| 428 |
419 } // namespace | 429 } // namespace |
420 | 430 |
421 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} | 431 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} |
422 | 432 |
423 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} | 433 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} |
424 | 434 |
425 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( | 435 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( |
426 const HeaderInterceptorInfo& other) {} | 436 const HeaderInterceptorInfo& other) {} |
427 | 437 |
428 // static | 438 // static |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 // ResourceRequestInfo rather than caching it locally. This lets us update | 1192 // ResourceRequestInfo rather than caching it locally. This lets us update |
1183 // the info object when a transfer occurs. | 1193 // the info object when a transfer occurs. |
1184 info->UpdateForTransfer(child_id, route_id, request_data.render_frame_id, | 1194 info->UpdateForTransfer(child_id, route_id, request_data.render_frame_id, |
1185 request_data.origin_pid, request_id, | 1195 request_data.origin_pid, request_id, |
1186 filter_->GetWeakPtr()); | 1196 filter_->GetWeakPtr()); |
1187 | 1197 |
1188 // If a certificate is stored with the ResourceResponse, it has to be | 1198 // If a certificate is stored with the ResourceResponse, it has to be |
1189 // updated to be associated with the new process. | 1199 // updated to be associated with the new process. |
1190 if (loader->transferring_response()) { | 1200 if (loader->transferring_response()) { |
1191 UpdateResponseCertificateForTransfer(loader->transferring_response(), | 1201 UpdateResponseCertificateForTransfer(loader->transferring_response(), |
1192 loader->request()->ssl_info(), | 1202 loader->request(), |
1193 child_id); | 1203 info); |
1194 } | 1204 } |
1195 | 1205 |
1196 // Update maps that used the old IDs, if necessary. Some transfers in tests | 1206 // Update maps that used the old IDs, if necessary. Some transfers in tests |
1197 // do not actually use a different ID, so not all maps need to be updated. | 1207 // do not actually use a different ID, so not all maps need to be updated. |
1198 pending_loaders_[new_request_id] = std::move(loader); | 1208 pending_loaders_[new_request_id] = std::move(loader); |
1199 IncrementOutstandingRequestsMemory(1, *info); | 1209 IncrementOutstandingRequestsMemory(1, *info); |
1200 if (should_update_count) | 1210 if (should_update_count) |
1201 IncrementOutstandingRequestsCount(1, info); | 1211 IncrementOutstandingRequestsCount(1, info); |
1202 if (old_routing_id != new_routing_id) { | 1212 if (old_routing_id != new_routing_id) { |
1203 if (blocked_loaders_map_.find(old_routing_id) != | 1213 if (blocked_loaders_map_.find(old_routing_id) != |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 } | 2597 } |
2588 | 2598 |
2589 if (is_sync_load) | 2599 if (is_sync_load) |
2590 load_flags |= net::LOAD_IGNORE_LIMITS; | 2600 load_flags |= net::LOAD_IGNORE_LIMITS; |
2591 | 2601 |
2592 return load_flags; | 2602 return load_flags; |
2593 } | 2603 } |
2594 | 2604 |
2595 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer( | 2605 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer( |
2596 ResourceResponse* response, | 2606 ResourceResponse* response, |
2597 const net::SSLInfo& ssl_info, | 2607 net::URLRequest* request, |
2598 int child_id) { | 2608 ResourceRequestInfoImpl* info) { |
| 2609 const net::SSLInfo& ssl_info = request->ssl_info(); |
2599 if (!ssl_info.cert) | 2610 if (!ssl_info.cert) |
2600 return; | 2611 return; |
2601 SSLStatus ssl; | 2612 SSLStatus ssl; |
2602 // DeserializeSecurityInfo() often takes security info sent by a | 2613 // DeserializeSecurityInfo() often takes security info sent by a |
2603 // renderer as input, in which case it's important to check that the | 2614 // renderer as input, in which case it's important to check that the |
2604 // security info deserializes properly and kill the renderer if | 2615 // security info deserializes properly and kill the renderer if |
2605 // not. In this case, however, the security info has been provided by | 2616 // not. In this case, however, the security info has been provided by |
2606 // the ResourceLoader, so it does not need to be treated as untrusted | 2617 // the ResourceLoader, so it does not need to be treated as untrusted |
2607 // data. | 2618 // data. |
2608 bool deserialized = | 2619 bool deserialized = |
2609 DeserializeSecurityInfo(response->head.security_info, &ssl); | 2620 DeserializeSecurityInfo(response->head.security_info, &ssl); |
2610 DCHECK(deserialized); | 2621 DCHECK(deserialized); |
2611 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2622 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), |
| 2623 info->GetChildID()); |
2612 response->head.security_info = SerializeSecurityInfo(ssl); | 2624 response->head.security_info = SerializeSecurityInfo(ssl); |
| 2625 |
| 2626 if (!info->IsMainFrame()) |
| 2627 return; |
| 2628 |
| 2629 // TODO(jam): eventually we'll get rid of this serialized SSLStatus in the |
| 2630 // response and won't send it to the child process. So for preparation, don't |
| 2631 // use it below. |
| 2632 SSLStatus ssl_status; |
| 2633 ResourceLoader::GetSSLStatusForRequest( |
| 2634 request->url(), ssl_info, info->GetChildID(), |
| 2635 ResourceDispatcherHostImpl::Get()->GetCertStore(), &ssl_status); |
| 2636 |
| 2637 BrowserThread::PostTask(BrowserThread::UI, |
| 2638 FROM_HERE, |
| 2639 base::Bind(SetTransferredRFHSSLStatus, |
| 2640 info->GetChildID(), |
| 2641 info->GetRenderFrameID(), |
| 2642 request->url(), |
| 2643 ssl_status)); |
2613 } | 2644 } |
2614 | 2645 |
2615 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2646 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
2616 return cert_store_for_testing_ ? cert_store_for_testing_ | 2647 return cert_store_for_testing_ ? cert_store_for_testing_ |
2617 : CertStore::GetInstance(); | 2648 : CertStore::GetInstance(); |
2618 } | 2649 } |
2619 | 2650 |
2620 bool ResourceDispatcherHostImpl::ShouldServiceRequest( | 2651 bool ResourceDispatcherHostImpl::ShouldServiceRequest( |
2621 int process_type, | 2652 int process_type, |
2622 int child_id, | 2653 int child_id, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 << iter->filesystem_url().spec(); | 2699 << iter->filesystem_url().spec(); |
2669 return false; | 2700 return false; |
2670 } | 2701 } |
2671 } | 2702 } |
2672 } | 2703 } |
2673 } | 2704 } |
2674 return true; | 2705 return true; |
2675 } | 2706 } |
2676 | 2707 |
2677 } // namespace content | 2708 } // namespace content |
OLD | NEW |