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_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 // transferred navigation case? | 951 // transferred navigation case? |
952 | 952 |
953 request->set_load_flags(load_flags); | 953 request->set_load_flags(load_flags); |
954 | 954 |
955 request->set_priority(DetermineRequestPriority(request_data.resource_type)); | 955 request->set_priority(DetermineRequestPriority(request_data.resource_type)); |
956 | 956 |
957 // Resolve elements from request_body and prepare upload data. | 957 // Resolve elements from request_body and prepare upload data. |
958 if (request_data.request_body) { | 958 if (request_data.request_body) { |
959 request->set_upload( | 959 request->set_upload( |
960 request_data.request_body->ResolveElementsAndCreateUploadData( | 960 request_data.request_body->ResolveElementsAndCreateUploadData( |
961 GetBlobStorageControllerForResourceContext(resource_context))); | 961 filter_->blob_storage_context()->controller())); |
962 } | 962 } |
963 | 963 |
964 bool allow_download = request_data.allow_download && | 964 bool allow_download = request_data.allow_download && |
965 ResourceType::IsFrame(request_data.resource_type); | 965 ResourceType::IsFrame(request_data.resource_type); |
966 | 966 |
967 // Make extra info and read footer (contains request ID). | 967 // Make extra info and read footer (contains request ID). |
968 ResourceRequestInfoImpl* extra_info = | 968 ResourceRequestInfoImpl* extra_info = |
969 new ResourceRequestInfoImpl( | 969 new ResourceRequestInfoImpl( |
970 process_type, | 970 process_type, |
971 child_id, | 971 child_id, |
972 route_id, | 972 route_id, |
973 request_data.origin_pid, | 973 request_data.origin_pid, |
974 request_id, | 974 request_id, |
975 request_data.is_main_frame, | 975 request_data.is_main_frame, |
976 request_data.frame_id, | 976 request_data.frame_id, |
977 request_data.parent_is_main_frame, | 977 request_data.parent_is_main_frame, |
978 request_data.parent_frame_id, | 978 request_data.parent_frame_id, |
979 request_data.resource_type, | 979 request_data.resource_type, |
980 request_data.transition_type, | 980 request_data.transition_type, |
981 false, // is download | 981 false, // is download |
982 allow_download, | 982 allow_download, |
983 request_data.has_user_gesture, | 983 request_data.has_user_gesture, |
984 request_data.referrer_policy, | 984 request_data.referrer_policy, |
985 resource_context); | 985 resource_context); |
986 extra_info->AssociateWithRequest(request); // Request takes ownership. | 986 extra_info->AssociateWithRequest(request); // Request takes ownership. |
987 | 987 |
988 if (request->url().SchemeIs(chrome::kBlobScheme)) { | 988 if (request->url().SchemeIs(chrome::kBlobScheme)) { |
989 // Hang on to a reference to ensure the blob is not released prior | 989 // Hang on to a reference to ensure the blob is not released prior |
990 // to the job being started. | 990 // to the job being started. |
991 webkit_blob::BlobStorageController* controller = | |
992 GetBlobStorageControllerForResourceContext(resource_context); | |
993 extra_info->set_requested_blob_data( | 991 extra_info->set_requested_blob_data( |
994 controller->GetBlobDataFromUrl(request->url())); | 992 filter_->blob_storage_context()->controller()-> |
| 993 GetBlobDataFromUrl(request->url())); |
995 } | 994 } |
996 | 995 |
997 // Have the appcache associate its extra info with the request. | 996 // Have the appcache associate its extra info with the request. |
998 appcache::AppCacheInterceptor::SetExtraRequestInfo( | 997 appcache::AppCacheInterceptor::SetExtraRequestInfo( |
999 request, ResourceContext::GetAppCacheService(resource_context), child_id, | 998 request, filter_->appcache_service(), child_id, |
1000 request_data.appcache_host_id, request_data.resource_type); | 999 request_data.appcache_host_id, request_data.resource_type); |
1001 | 1000 |
1002 // Construct the IPC resource handler. | 1001 // Construct the IPC resource handler. |
1003 scoped_ptr<ResourceHandler> handler; | 1002 scoped_ptr<ResourceHandler> handler; |
1004 if (sync_result) { | 1003 if (sync_result) { |
1005 handler.reset(new SyncResourceHandler( | 1004 handler.reset(new SyncResourceHandler( |
1006 filter_, request, sync_result, this)); | 1005 filter_, request, sync_result, this)); |
1007 } else { | 1006 } else { |
1008 handler.reset(new AsyncResourceHandler( | 1007 handler.reset(new AsyncResourceHandler( |
1009 filter_, route_id, request, this)); | 1008 filter_, route_id, request, this)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 request_data.resource_type, | 1042 request_data.resource_type, |
1044 request)); | 1043 request)); |
1045 | 1044 |
1046 ScopedVector<ResourceThrottle> throttles; | 1045 ScopedVector<ResourceThrottle> throttles; |
1047 if (delegate_) { | 1046 if (delegate_) { |
1048 bool is_continuation_of_transferred_request = | 1047 bool is_continuation_of_transferred_request = |
1049 (deferred_loader.get() != NULL); | 1048 (deferred_loader.get() != NULL); |
1050 | 1049 |
1051 delegate_->RequestBeginning(request, | 1050 delegate_->RequestBeginning(request, |
1052 resource_context, | 1051 resource_context, |
| 1052 filter_->appcache_service(), |
1053 request_data.resource_type, | 1053 request_data.resource_type, |
1054 child_id, | 1054 child_id, |
1055 route_id, | 1055 route_id, |
1056 is_continuation_of_transferred_request, | 1056 is_continuation_of_transferred_request, |
1057 &throttles); | 1057 &throttles); |
1058 } | 1058 } |
1059 | 1059 |
1060 if (request_data.resource_type == ResourceType::MAIN_FRAME) { | 1060 if (request_data.resource_type == ResourceType::MAIN_FRAME) { |
1061 throttles.insert( | 1061 throttles.insert( |
1062 throttles.begin(), | 1062 throttles.begin(), |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 | 1720 |
1721 return i->second.get(); | 1721 return i->second.get(); |
1722 } | 1722 } |
1723 | 1723 |
1724 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, | 1724 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, |
1725 int request_id) const { | 1725 int request_id) const { |
1726 return GetLoader(GlobalRequestID(child_id, request_id)); | 1726 return GetLoader(GlobalRequestID(child_id, request_id)); |
1727 } | 1727 } |
1728 | 1728 |
1729 } // namespace content | 1729 } // namespace content |
OLD | NEW |