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 <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 request, | 1124 request, |
1125 filter_->blob_storage_context()->context()-> | 1125 filter_->blob_storage_context()->context()-> |
1126 GetBlobDataFromPublicURL(request->url())); | 1126 GetBlobDataFromPublicURL(request->url())); |
1127 } | 1127 } |
1128 | 1128 |
1129 // Have the appcache associate its extra info with the request. | 1129 // Have the appcache associate its extra info with the request. |
1130 appcache::AppCacheInterceptor::SetExtraRequestInfo( | 1130 appcache::AppCacheInterceptor::SetExtraRequestInfo( |
1131 request, filter_->appcache_service(), child_id, | 1131 request, filter_->appcache_service(), child_id, |
1132 request_data.appcache_host_id, request_data.resource_type); | 1132 request_data.appcache_host_id, request_data.resource_type); |
1133 | 1133 |
| 1134 scoped_ptr<ResourceHandler> handler( |
| 1135 CreateResourceHandler( |
| 1136 request, |
| 1137 request_data, sync_result, route_id, process_type, child_id, |
| 1138 resource_context)); |
| 1139 |
| 1140 BeginRequestInternal(new_request.Pass(), handler.Pass()); |
| 1141 } |
| 1142 |
| 1143 scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( |
| 1144 net::URLRequest* request, |
| 1145 const ResourceHostMsg_Request& request_data, |
| 1146 IPC::Message* sync_result, |
| 1147 int route_id, |
| 1148 int process_type, |
| 1149 int child_id, |
| 1150 ResourceContext* resource_context) { |
1134 // Construct the IPC resource handler. | 1151 // Construct the IPC resource handler. |
1135 scoped_ptr<ResourceHandler> handler; | 1152 scoped_ptr<ResourceHandler> handler; |
1136 if (sync_result) { | 1153 if (sync_result) { |
1137 handler.reset(new SyncResourceHandler(request, sync_result, this)); | 1154 handler.reset(new SyncResourceHandler(request, sync_result, this)); |
1138 } else { | 1155 } else { |
1139 handler.reset(new AsyncResourceHandler(request, this)); | 1156 handler.reset(new AsyncResourceHandler(request, this)); |
1140 if (IsDetachableResourceType(request_data.resource_type)) { | 1157 if (IsDetachableResourceType(request_data.resource_type)) { |
1141 handler.reset(new DetachableResourceHandler( | 1158 handler.reset(new DetachableResourceHandler( |
1142 request, | 1159 request, |
1143 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1160 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 // Block power save while uploading data. | 1195 // Block power save while uploading data. |
1179 throttles.push_back(new PowerSaveBlockResourceThrottle()); | 1196 throttles.push_back(new PowerSaveBlockResourceThrottle()); |
1180 } | 1197 } |
1181 | 1198 |
1182 throttles.push_back( | 1199 throttles.push_back( |
1183 scheduler_->ScheduleRequest(child_id, route_id, request).release()); | 1200 scheduler_->ScheduleRequest(child_id, route_id, request).release()); |
1184 | 1201 |
1185 handler.reset( | 1202 handler.reset( |
1186 new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass())); | 1203 new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass())); |
1187 | 1204 |
1188 BeginRequestInternal(new_request.Pass(), handler.Pass()); | 1205 return handler.Pass(); |
1189 } | 1206 } |
1190 | 1207 |
1191 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { | 1208 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { |
1192 UnregisterDownloadedTempFile(filter_->child_id(), request_id); | 1209 UnregisterDownloadedTempFile(filter_->child_id(), request_id); |
1193 } | 1210 } |
1194 | 1211 |
1195 void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) { | 1212 void ResourceDispatcherHostImpl::OnDataDownloadedACK(int request_id) { |
1196 // TODO(michaeln): maybe throttle DataDownloaded messages | 1213 // TODO(michaeln): maybe throttle DataDownloaded messages |
1197 } | 1214 } |
1198 | 1215 |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1975 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
1959 && !policy->CanReadRawCookies(child_id)) { | 1976 && !policy->CanReadRawCookies(child_id)) { |
1960 VLOG(1) << "Denied unauthorized request for raw headers"; | 1977 VLOG(1) << "Denied unauthorized request for raw headers"; |
1961 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1978 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
1962 } | 1979 } |
1963 | 1980 |
1964 return load_flags; | 1981 return load_flags; |
1965 } | 1982 } |
1966 | 1983 |
1967 } // namespace content | 1984 } // namespace content |
OLD | NEW |