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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 // context. | 1433 // context. |
1434 if (blob_context) { | 1434 if (blob_context) { |
1435 // Attaches the BlobDataHandles to request_body not to free the blobs and | 1435 // Attaches the BlobDataHandles to request_body not to free the blobs and |
1436 // any attached shareable files until upload completion. These data will | 1436 // any attached shareable files until upload completion. These data will |
1437 // be used in UploadDataStream and ServiceWorkerURLRequestJob. | 1437 // be used in UploadDataStream and ServiceWorkerURLRequestJob. |
1438 AttachRequestBodyBlobDataHandles( | 1438 AttachRequestBodyBlobDataHandles( |
1439 request_data.request_body.get(), | 1439 request_data.request_body.get(), |
1440 blob_context); | 1440 blob_context); |
1441 } | 1441 } |
1442 new_request->set_upload(UploadDataStreamBuilder::Build( | 1442 new_request->set_upload(UploadDataStreamBuilder::Build( |
1443 request_data.request_body.get(), | 1443 request_data.request_body.get(), blob_context, |
1444 blob_context, | |
1445 filter_->file_system_context(), | 1444 filter_->file_system_context(), |
1446 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | 1445 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); |
1447 .get())); | |
1448 } | 1446 } |
1449 | 1447 |
1450 bool allow_download = request_data.allow_download && | 1448 bool allow_download = request_data.allow_download && |
1451 IsResourceTypeFrame(request_data.resource_type); | 1449 IsResourceTypeFrame(request_data.resource_type); |
1452 bool do_not_prompt_for_login = request_data.do_not_prompt_for_login; | 1450 bool do_not_prompt_for_login = request_data.do_not_prompt_for_login; |
1453 bool is_sync_load = sync_result != NULL; | 1451 bool is_sync_load = sync_result != NULL; |
1454 | 1452 |
1455 // Raw headers are sensitive, as they include Cookie/Set-Cookie, so only | 1453 // Raw headers are sensitive, as they include Cookie/Set-Cookie, so only |
1456 // allow requesting them if requester has ReadRawCookies permission. | 1454 // allow requesting them if requester has ReadRawCookies permission. |
1457 ChildProcessSecurityPolicyImpl* policy = | 1455 ChildProcessSecurityPolicyImpl* policy = |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 resource_context, | 1677 resource_context, |
1680 appcache_service, | 1678 appcache_service, |
1681 resource_type, | 1679 resource_type, |
1682 &throttles); | 1680 &throttles); |
1683 } | 1681 } |
1684 | 1682 |
1685 if (request->has_upload()) { | 1683 if (request->has_upload()) { |
1686 // Block power save while uploading data. | 1684 // Block power save while uploading data. |
1687 throttles.push_back(new PowerSaveBlockResourceThrottle( | 1685 throttles.push_back(new PowerSaveBlockResourceThrottle( |
1688 request->url().host(), | 1686 request->url().host(), |
1689 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 1687 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
1690 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | 1688 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
1691 } | 1689 } |
1692 | 1690 |
1693 // TODO(ricea): Stop looking this up so much. | 1691 // TODO(ricea): Stop looking this up so much. |
1694 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1692 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1695 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, | 1693 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, |
1696 info->IsAsync(), request)); | 1694 info->IsAsync(), request)); |
1697 | 1695 |
1698 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 1696 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
1699 std::move(throttles))); | 1697 std::move(throttles))); |
1700 | 1698 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 GetChromeBlobStorageContextForResourceContext(resource_context)); | 2178 GetChromeBlobStorageContextForResourceContext(resource_context)); |
2181 | 2179 |
2182 // Resolve elements from request_body and prepare upload data. | 2180 // Resolve elements from request_body and prepare upload data. |
2183 ResourceRequestBodyImpl* body = info.common_params.post_data.get(); | 2181 ResourceRequestBodyImpl* body = info.common_params.post_data.get(); |
2184 if (body) { | 2182 if (body) { |
2185 AttachRequestBodyBlobDataHandles(body, blob_context); | 2183 AttachRequestBodyBlobDataHandles(body, blob_context); |
2186 // TODO(davidben): The FileSystemContext is null here. In the case where | 2184 // TODO(davidben): The FileSystemContext is null here. In the case where |
2187 // another renderer requested this navigation, this should be the same | 2185 // another renderer requested this navigation, this should be the same |
2188 // FileSystemContext passed into ShouldServiceRequest. | 2186 // FileSystemContext passed into ShouldServiceRequest. |
2189 new_request->set_upload(UploadDataStreamBuilder::Build( | 2187 new_request->set_upload(UploadDataStreamBuilder::Build( |
2190 body, | 2188 body, blob_context, |
2191 blob_context, | |
2192 nullptr, // file_system_context | 2189 nullptr, // file_system_context |
2193 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | 2190 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); |
2194 .get())); | |
2195 } | 2191 } |
2196 | 2192 |
2197 request_id_--; | 2193 request_id_--; |
2198 | 2194 |
2199 // Make extra info and read footer (contains request ID). | 2195 // Make extra info and read footer (contains request ID). |
2200 // | 2196 // |
2201 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so | 2197 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so |
2202 // that IO thread -> UI thread hops will work. | 2198 // that IO thread -> UI thread hops will work. |
2203 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( | 2199 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
2204 PROCESS_TYPE_BROWSER, | 2200 PROCESS_TYPE_BROWSER, |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2600 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2596 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); |
2601 response->head.security_info = SerializeSecurityInfo(ssl); | 2597 response->head.security_info = SerializeSecurityInfo(ssl); |
2602 } | 2598 } |
2603 | 2599 |
2604 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2600 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
2605 return cert_store_for_testing_ ? cert_store_for_testing_ | 2601 return cert_store_for_testing_ ? cert_store_for_testing_ |
2606 : CertStore::GetInstance(); | 2602 : CertStore::GetInstance(); |
2607 } | 2603 } |
2608 | 2604 |
2609 } // namespace content | 2605 } // namespace content |
OLD | NEW |