Chromium Code Reviews| 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 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1170 bool call_interceptor = true; | 1170 bool call_interceptor = true; |
| 1171 if (!interceptor_info.starts_with.empty()) { | 1171 if (!interceptor_info.starts_with.empty()) { |
| 1172 call_interceptor = | 1172 call_interceptor = |
| 1173 base::StartsWith(it.value(), interceptor_info.starts_with, | 1173 base::StartsWith(it.value(), interceptor_info.starts_with, |
| 1174 base::CompareCase::INSENSITIVE_ASCII); | 1174 base::CompareCase::INSENSITIVE_ASCII); |
| 1175 } | 1175 } |
| 1176 if (call_interceptor) { | 1176 if (call_interceptor) { |
| 1177 interceptor_info.interceptor.Run( | 1177 interceptor_info.interceptor.Run( |
| 1178 it.name(), it.value(), child_id, resource_context, | 1178 it.name(), it.value(), child_id, resource_context, |
| 1179 base::Bind( | 1179 base::Bind( |
| 1180 &ResourceDispatcherHostImpl::ContinuePendingBeginRequest, | 1180 &ResourceDispatcherHostImpl::ContinuePendingBeginRequest, |
|
michaeln
2017/05/31 22:41:19
Looks like ContinuePendingBeginRequest can be defe
horo
2017/06/01 02:04:48
OnHttpHeaderReceived() in chrome_content_browser_c
dmurph
2017/06/01 18:18:29
Acknowledged.
michaeln
2017/06/01 20:46:59
Oh well, I was hoping that might be the source of
kinuko
2017/06/02 03:15:40
Moving AttachRequestBodyBlobDataHandle earlier als
dmurph
2017/06/02 19:38:07
Done.
| |
| 1181 base::Unretained(this), requester_info, request_id, | 1181 base::Unretained(this), requester_info, request_id, |
| 1182 request_data, sync_result_handler, route_id, headers, | 1182 request_data, sync_result_handler, route_id, headers, |
| 1183 base::Passed(std::move(mojo_request)), | 1183 base::Passed(std::move(mojo_request)), |
| 1184 base::Passed(std::move(url_loader_client)))); | 1184 base::Passed(std::move(url_loader_client)))); |
| 1185 return; | 1185 return; |
| 1186 } | 1186 } |
| 1187 } | 1187 } |
| 1188 } | 1188 } |
| 1189 } | 1189 } |
| 1190 ContinuePendingBeginRequest( | 1190 ContinuePendingBeginRequest( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 GetBlobStorageContext(requester_info->blob_storage_context()); | 1304 GetBlobStorageContext(requester_info->blob_storage_context()); |
| 1305 // Resolve elements from request_body and prepare upload data. | 1305 // Resolve elements from request_body and prepare upload data. |
| 1306 if (request_data.request_body.get()) { | 1306 if (request_data.request_body.get()) { |
| 1307 // |blob_context| could be null when the request is from the plugins | 1307 // |blob_context| could be null when the request is from the plugins |
| 1308 // because ResourceMessageFilters created in PluginProcessHost don't have | 1308 // because ResourceMessageFilters created in PluginProcessHost don't have |
| 1309 // the blob context. | 1309 // the blob context. |
| 1310 if (blob_context) { | 1310 if (blob_context) { |
| 1311 // Attaches the BlobDataHandles to request_body not to free the blobs | 1311 // Attaches the BlobDataHandles to request_body not to free the blobs |
| 1312 // and any attached shareable files until upload completion. These data | 1312 // and any attached shareable files until upload completion. These data |
| 1313 // will be used in UploadDataStream and ServiceWorkerURLRequestJob. | 1313 // will be used in UploadDataStream and ServiceWorkerURLRequestJob. |
| 1314 AttachRequestBodyBlobDataHandles(request_data.request_body.get(), | 1314 bool blobs_alive = AttachRequestBodyBlobDataHandles( |
| 1315 resource_context); | 1315 request_data.request_body.get(), resource_context); |
| 1316 if (!blobs_alive) { | |
| 1317 AbortRequestBeforeItStarts(requester_info->filter(), | |
| 1318 sync_result_handler, request_id, | |
| 1319 std::move(url_loader_client)); | |
| 1320 return; | |
| 1321 } | |
| 1316 } | 1322 } |
| 1317 new_request->set_upload(UploadDataStreamBuilder::Build( | 1323 new_request->set_upload(UploadDataStreamBuilder::Build( |
| 1318 request_data.request_body.get(), blob_context, | 1324 request_data.request_body.get(), blob_context, |
| 1319 requester_info->file_system_context(), | 1325 requester_info->file_system_context(), |
| 1320 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); | 1326 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); |
| 1321 } | 1327 } |
| 1322 | 1328 |
| 1323 allow_download = request_data.allow_download && | 1329 allow_download = request_data.allow_download && |
| 1324 IsResourceTypeFrame(request_data.resource_type); | 1330 IsResourceTypeFrame(request_data.resource_type); |
| 1325 do_not_prompt_for_login = request_data.do_not_prompt_for_login; | 1331 do_not_prompt_for_login = request_data.do_not_prompt_for_login; |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2067 new_request->SetExtraRequestHeaders(headers); | 2073 new_request->SetExtraRequestHeaders(headers); |
| 2068 | 2074 |
| 2069 new_request->SetLoadFlags(load_flags); | 2075 new_request->SetLoadFlags(load_flags); |
| 2070 | 2076 |
| 2071 storage::BlobStorageContext* blob_context = GetBlobStorageContext( | 2077 storage::BlobStorageContext* blob_context = GetBlobStorageContext( |
| 2072 GetChromeBlobStorageContextForResourceContext(resource_context)); | 2078 GetChromeBlobStorageContextForResourceContext(resource_context)); |
| 2073 | 2079 |
| 2074 // Resolve elements from request_body and prepare upload data. | 2080 // Resolve elements from request_body and prepare upload data. |
| 2075 ResourceRequestBodyImpl* body = info.common_params.post_data.get(); | 2081 ResourceRequestBodyImpl* body = info.common_params.post_data.get(); |
| 2076 if (body) { | 2082 if (body) { |
| 2077 AttachRequestBodyBlobDataHandles(body, resource_context); | 2083 bool blobs_alive = AttachRequestBodyBlobDataHandles(body, resource_context); |
| 2084 if (!blobs_alive) { | |
| 2085 new_request->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); | |
| 2086 loader->NotifyRequestFailed(false, net::ERR_ABORTED); | |
| 2087 return; | |
| 2088 } | |
| 2078 new_request->set_upload(UploadDataStreamBuilder::Build( | 2089 new_request->set_upload(UploadDataStreamBuilder::Build( |
| 2079 body, blob_context, upload_file_system_context, | 2090 body, blob_context, upload_file_system_context, |
| 2080 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); | 2091 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); |
| 2081 } | 2092 } |
| 2082 | 2093 |
| 2083 // Make extra info and read footer (contains request ID). | 2094 // Make extra info and read footer (contains request ID). |
| 2084 // | 2095 // |
| 2085 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so | 2096 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so |
| 2086 // that IO thread -> UI thread hops will work. | 2097 // that IO thread -> UI thread hops will work. |
| 2087 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( | 2098 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2706 &throttles); | 2717 &throttles); |
| 2707 if (!throttles.empty()) { | 2718 if (!throttles.empty()) { |
| 2708 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2719 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2709 std::move(throttles))); | 2720 std::move(throttles))); |
| 2710 } | 2721 } |
| 2711 } | 2722 } |
| 2712 return handler; | 2723 return handler; |
| 2713 } | 2724 } |
| 2714 | 2725 |
| 2715 } // namespace content | 2726 } // namespace content |
| OLD | NEW |