| 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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 const ResourceRequesterInfo* requester_info, | 1831 const ResourceRequesterInfo* requester_info, |
| 1832 int request_id) { | 1832 int request_id) { |
| 1833 CancelRequestFromRenderer( | 1833 CancelRequestFromRenderer( |
| 1834 GlobalRequestID(requester_info->child_id(), request_id)); | 1834 GlobalRequestID(requester_info->child_id(), request_id)); |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( | 1837 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( |
| 1838 int child_id, | 1838 int child_id, |
| 1839 int render_view_route_id, | 1839 int render_view_route_id, |
| 1840 int render_frame_route_id, | 1840 int render_frame_route_id, |
| 1841 int service_worker_provider_id, |
| 1841 bool download, | 1842 bool download, |
| 1842 ResourceContext* context) { | 1843 ResourceContext* context, |
| 1844 ServiceWorkerContextWrapper* service_worker_context) { |
| 1843 return new ResourceRequestInfoImpl( | 1845 return new ResourceRequestInfoImpl( |
| 1844 ResourceRequesterInfo::CreateForDownloadOrPageSave(child_id), | 1846 ResourceRequesterInfo::CreateForDownloadOrPageSave( |
| 1847 child_id, service_worker_context), |
| 1845 render_view_route_id, | 1848 render_view_route_id, |
| 1846 -1, // frame_tree_node_id | 1849 -1, // frame_tree_node_id |
| 1847 0, MakeRequestID(), render_frame_route_id, | 1850 0, MakeRequestID(), render_frame_route_id, |
| 1848 false, // is_main_frame | 1851 false, // is_main_frame |
| 1849 false, // parent_is_main_frame | 1852 false, // parent_is_main_frame |
| 1850 RESOURCE_TYPE_SUB_RESOURCE, ui::PAGE_TRANSITION_LINK, | 1853 RESOURCE_TYPE_SUB_RESOURCE, ui::PAGE_TRANSITION_LINK, |
| 1851 false, // should_replace_current_entry | 1854 false, // should_replace_current_entry |
| 1852 download, // is_download | 1855 download, // is_download |
| 1853 false, // is_stream | 1856 false, // is_stream |
| 1854 download, // allow_download | 1857 download, // allow_download |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2393 StartLoading(info, std::move(loader)); | 2396 StartLoading(info, std::move(loader)); |
| 2394 } | 2397 } |
| 2395 | 2398 |
| 2396 void ResourceDispatcherHostImpl::InitializeURLRequest( | 2399 void ResourceDispatcherHostImpl::InitializeURLRequest( |
| 2397 net::URLRequest* request, | 2400 net::URLRequest* request, |
| 2398 const Referrer& referrer, | 2401 const Referrer& referrer, |
| 2399 bool is_download, | 2402 bool is_download, |
| 2400 int render_process_host_id, | 2403 int render_process_host_id, |
| 2401 int render_view_routing_id, | 2404 int render_view_routing_id, |
| 2402 int render_frame_routing_id, | 2405 int render_frame_routing_id, |
| 2403 ResourceContext* context) { | 2406 int service_worker_provider_id, |
| 2407 ResourceContext* context, |
| 2408 ServiceWorkerContextWrapper* service_worker_context) { |
| 2404 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 2409 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 2405 DCHECK(!request->is_pending()); | 2410 DCHECK(!request->is_pending()); |
| 2406 | 2411 |
| 2407 SetReferrerForRequest(request, referrer); | 2412 SetReferrerForRequest(request, referrer); |
| 2408 | 2413 |
| 2409 ResourceRequestInfoImpl* info = | 2414 ResourceRequestInfoImpl* info = CreateRequestInfo( |
| 2410 CreateRequestInfo(render_process_host_id, render_view_routing_id, | 2415 render_process_host_id, render_view_routing_id, render_frame_routing_id, |
| 2411 render_frame_routing_id, is_download, context); | 2416 service_worker_provider_id, is_download, context, service_worker_context); |
| 2412 // Request takes ownership. | 2417 // Request takes ownership. |
| 2413 info->AssociateWithRequest(request); | 2418 info->AssociateWithRequest(request); |
| 2419 |
| 2420 if (!service_worker_context || service_worker_provider_id == -1) |
| 2421 return; |
| 2422 |
| 2423 ChromeBlobStorageContext* blob_context = |
| 2424 GetChromeBlobStorageContextForResourceContext(context); |
| 2425 |
| 2426 ServiceWorkerRequestHandler::InitializeHandler( |
| 2427 request, service_worker_context, blob_context->context(), |
| 2428 render_process_host_id, service_worker_provider_id, false, |
| 2429 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_INCLUDE, |
| 2430 FetchRedirectMode::FOLLOW_MODE, |
| 2431 RESOURCE_TYPE_SUB_RESOURCE /* TODO(horo) */, |
| 2432 REQUEST_CONTEXT_TYPE_DOWNLOAD, REQUEST_CONTEXT_FRAME_TYPE_NONE, |
| 2433 scoped_refptr<ResourceRequestBodyImpl>() /* TODO(horo) */); |
| 2414 } | 2434 } |
| 2415 | 2435 |
| 2416 void ResourceDispatcherHostImpl::BeginURLRequest( | 2436 void ResourceDispatcherHostImpl::BeginURLRequest( |
| 2417 std::unique_ptr<net::URLRequest> request, | 2437 std::unique_ptr<net::URLRequest> request, |
| 2418 std::unique_ptr<ResourceHandler> handler, | 2438 std::unique_ptr<ResourceHandler> handler, |
| 2419 bool is_download, | 2439 bool is_download, |
| 2420 bool is_content_initiated, | 2440 bool is_content_initiated, |
| 2421 bool do_not_prompt_for_login, | 2441 bool do_not_prompt_for_login, |
| 2422 ResourceContext* context) { | 2442 ResourceContext* context) { |
| 2423 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 2443 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2812 &throttles); | 2832 &throttles); |
| 2813 if (!throttles.empty()) { | 2833 if (!throttles.empty()) { |
| 2814 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2834 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2815 std::move(throttles))); | 2835 std::move(throttles))); |
| 2816 } | 2836 } |
| 2817 } | 2837 } |
| 2818 return handler; | 2838 return handler; |
| 2819 } | 2839 } |
| 2820 | 2840 |
| 2821 } // namespace content | 2841 } // namespace content |
| OLD | NEW |