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/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #include "webkit/appcache/appcache_interceptor.h" | 83 #include "webkit/appcache/appcache_interceptor.h" |
84 #include "webkit/appcache/appcache_interfaces.h" | 84 #include "webkit/appcache/appcache_interfaces.h" |
85 #include "webkit/blob/blob_storage_controller.h" | 85 #include "webkit/blob/blob_storage_controller.h" |
86 #include "webkit/blob/deletable_file_reference.h" | 86 #include "webkit/blob/deletable_file_reference.h" |
87 | 87 |
88 using base::Time; | 88 using base::Time; |
89 using base::TimeDelta; | 89 using base::TimeDelta; |
90 using base::TimeTicks; | 90 using base::TimeTicks; |
91 using content::BrowserThread; | 91 using content::BrowserThread; |
92 using content::GlobalRequestID; | 92 using content::GlobalRequestID; |
| 93 using content::ResourceContext; |
93 using content::ResourceResponse; | 94 using content::ResourceResponse; |
94 using content::ResourceThrottle; | 95 using content::ResourceThrottle; |
95 using content::ThrottlingResourceHandler; | 96 using content::ThrottlingResourceHandler; |
96 using content::WebContents; | 97 using content::WebContents; |
97 using content::WorkerServiceImpl; | 98 using content::WorkerServiceImpl; |
98 using webkit_blob::DeletableFileReference; | 99 using webkit_blob::DeletableFileReference; |
99 | 100 |
100 // ---------------------------------------------------------------------------- | 101 // ---------------------------------------------------------------------------- |
101 | 102 |
102 namespace { | 103 namespace { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 if (iter != transferred_navigations_.end()) { | 535 if (iter != transferred_navigations_.end()) { |
535 deferred_request = iter->second; | 536 deferred_request = iter->second; |
536 pending_requests_.erase(old_request_id); | 537 pending_requests_.erase(old_request_id); |
537 transferred_navigations_.erase(iter); | 538 transferred_navigations_.erase(iter); |
538 } | 539 } |
539 | 540 |
540 content::ResourceContext* resource_context = filter_->resource_context(); | 541 content::ResourceContext* resource_context = filter_->resource_context(); |
541 | 542 |
542 // Might need to resolve the blob references in the upload data. | 543 // Might need to resolve the blob references in the upload data. |
543 if (request_data.upload_data) { | 544 if (request_data.upload_data) { |
544 resource_context->GetBlobStorageContext()->controller()-> | 545 ResourceContext::GetBlobStorageController(resource_context)-> |
545 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); | 546 ResolveBlobReferencesInUploadData(request_data.upload_data.get()); |
546 } | 547 } |
547 | 548 |
548 if (is_shutdown_ || | 549 if (is_shutdown_ || |
549 !ShouldServiceRequest(process_type, child_id, request_data)) { | 550 !ShouldServiceRequest(process_type, child_id, request_data)) { |
550 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); | 551 AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); |
551 return; | 552 return; |
552 } | 553 } |
553 | 554 |
554 const content::Referrer referrer(MaybeStripReferrer(request_data.referrer), | 555 const content::Referrer referrer(MaybeStripReferrer(request_data.referrer), |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 ResourceType::IsFrame(request_data.resource_type), // allow_download | 710 ResourceType::IsFrame(request_data.resource_type), // allow_download |
710 request_data.has_user_gesture, | 711 request_data.has_user_gesture, |
711 request_data.referrer_policy, | 712 request_data.referrer_policy, |
712 resource_context); | 713 resource_context); |
713 SetRequestInfo(request, extra_info); // Request takes ownership. | 714 SetRequestInfo(request, extra_info); // Request takes ownership. |
714 | 715 |
715 if (request->url().SchemeIs(chrome::kBlobScheme)) { | 716 if (request->url().SchemeIs(chrome::kBlobScheme)) { |
716 // Hang on to a reference to ensure the blob is not released prior | 717 // Hang on to a reference to ensure the blob is not released prior |
717 // to the job being started. | 718 // to the job being started. |
718 webkit_blob::BlobStorageController* controller = | 719 webkit_blob::BlobStorageController* controller = |
719 resource_context->GetBlobStorageContext()->controller(); | 720 ResourceContext::GetBlobStorageController(resource_context); |
720 extra_info->set_requested_blob_data( | 721 extra_info->set_requested_blob_data( |
721 controller->GetBlobDataFromUrl(request->url())); | 722 controller->GetBlobDataFromUrl(request->url())); |
722 } | 723 } |
723 | 724 |
724 // Have the appcache associate its extra info with the request. | 725 // Have the appcache associate its extra info with the request. |
725 appcache::AppCacheInterceptor::SetExtraRequestInfo( | 726 appcache::AppCacheInterceptor::SetExtraRequestInfo( |
726 request, resource_context->GetAppCacheService(), child_id, | 727 request, ResourceContext::GetAppCacheService(resource_context), child_id, |
727 request_data.appcache_host_id, request_data.resource_type); | 728 request_data.appcache_host_id, request_data.resource_type); |
728 | 729 |
729 if (deferred_request) { | 730 if (deferred_request) { |
730 // This is a request that has been transferred from another process, so | 731 // This is a request that has been transferred from another process, so |
731 // resume it rather than continuing the regular procedure for starting a | 732 // resume it rather than continuing the regular procedure for starting a |
732 // request. Currently this is only done for redirects. | 733 // request. Currently this is only done for redirects. |
733 GlobalRequestID global_id(extra_info->child_id(), extra_info->request_id()); | 734 GlobalRequestID global_id(extra_info->child_id(), extra_info->request_id()); |
734 pending_requests_[global_id] = request; | 735 pending_requests_[global_id] = request; |
735 request->FollowDeferredRedirect(); | 736 request->FollowDeferredRedirect(); |
736 } else { | 737 } else { |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 scoped_refptr<ResourceHandler> transferred_resource_handler( | 2298 scoped_refptr<ResourceHandler> transferred_resource_handler( |
2298 new DoomedResourceHandler(info->resource_handler())); | 2299 new DoomedResourceHandler(info->resource_handler())); |
2299 info->set_resource_handler(transferred_resource_handler.get()); | 2300 info->set_resource_handler(transferred_resource_handler.get()); |
2300 } | 2301 } |
2301 | 2302 |
2302 bool ResourceDispatcherHost::IsTransferredNavigation( | 2303 bool ResourceDispatcherHost::IsTransferredNavigation( |
2303 const content::GlobalRequestID& transferred_request_id) const { | 2304 const content::GlobalRequestID& transferred_request_id) const { |
2304 return transferred_navigations_.find(transferred_request_id) != | 2305 return transferred_navigations_.find(transferred_request_id) != |
2305 transferred_navigations_.end(); | 2306 transferred_navigations_.end(); |
2306 } | 2307 } |
OLD | NEW |