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 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 loader->CancelRequest(true); | 1791 loader->CancelRequest(true); |
1792 } | 1792 } |
1793 | 1793 |
1794 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( | 1794 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( |
1795 int child_id, | 1795 int child_id, |
1796 int render_view_route_id, | 1796 int render_view_route_id, |
1797 int render_frame_route_id, | 1797 int render_frame_route_id, |
1798 bool download, | 1798 bool download, |
1799 ResourceContext* context) { | 1799 ResourceContext* context) { |
1800 return new ResourceRequestInfoImpl( | 1800 return new ResourceRequestInfoImpl( |
1801 PROCESS_TYPE_RENDERER, | 1801 PROCESS_TYPE_RENDERER, child_id, render_view_route_id, |
1802 child_id, | |
1803 render_view_route_id, | |
1804 -1, // frame_tree_node_id | 1802 -1, // frame_tree_node_id |
1805 0, | 1803 0, MakeRequestID(), render_frame_route_id, |
1806 request_id_, | 1804 false, // is_main_frame |
1807 render_frame_route_id, | 1805 false, // parent_is_main_frame |
1808 false, // is_main_frame | 1806 RESOURCE_TYPE_SUB_RESOURCE, ui::PAGE_TRANSITION_LINK, |
1809 false, // parent_is_main_frame | |
1810 RESOURCE_TYPE_SUB_RESOURCE, | |
1811 ui::PAGE_TRANSITION_LINK, | |
1812 false, // should_replace_current_entry | 1807 false, // should_replace_current_entry |
1813 download, // is_download | 1808 download, // is_download |
1814 false, // is_stream | 1809 false, // is_stream |
1815 download, // allow_download | 1810 download, // allow_download |
1816 false, // has_user_gesture | 1811 false, // has_user_gesture |
1817 false, // enable_load_timing | 1812 false, // enable_load_timing |
1818 false, // enable_upload_progress | 1813 false, // enable_upload_progress |
1819 false, // do_not_prompt_for_login | 1814 false, // do_not_prompt_for_login |
1820 blink::WebReferrerPolicyDefault, | 1815 blink::WebReferrerPolicyDefault, blink::WebPageVisibilityStateVisible, |
1821 blink::WebPageVisibilityStateVisible, | |
1822 context, | 1816 context, |
1823 base::WeakPtr<ResourceMessageFilter>(), // filter | 1817 base::WeakPtr<ResourceMessageFilter>(), // filter |
1824 false, // report_raw_headers | 1818 false, // report_raw_headers |
1825 true, // is_async | 1819 true, // is_async |
1826 false, // is_using_lofi | 1820 false, // is_using_lofi |
1827 std::string(), // original_headers | 1821 std::string(), // original_headers |
1828 nullptr, // body | 1822 nullptr, // body |
1829 false); // initiated_in_secure_context | 1823 false); // initiated_in_secure_context |
1830 } | 1824 } |
1831 | 1825 |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 AttachRequestBodyBlobDataHandles(body, blob_context); | 2134 AttachRequestBodyBlobDataHandles(body, blob_context); |
2141 // TODO(davidben): The FileSystemContext is null here. In the case where | 2135 // TODO(davidben): The FileSystemContext is null here. In the case where |
2142 // another renderer requested this navigation, this should be the same | 2136 // another renderer requested this navigation, this should be the same |
2143 // FileSystemContext passed into ShouldServiceRequest. | 2137 // FileSystemContext passed into ShouldServiceRequest. |
2144 new_request->set_upload(UploadDataStreamBuilder::Build( | 2138 new_request->set_upload(UploadDataStreamBuilder::Build( |
2145 body, blob_context, | 2139 body, blob_context, |
2146 nullptr, // file_system_context | 2140 nullptr, // file_system_context |
2147 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); | 2141 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get())); |
2148 } | 2142 } |
2149 | 2143 |
2150 request_id_--; | |
2151 | |
2152 // Make extra info and read footer (contains request ID). | 2144 // Make extra info and read footer (contains request ID). |
2153 // | 2145 // |
2154 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so | 2146 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so |
2155 // that IO thread -> UI thread hops will work. | 2147 // that IO thread -> UI thread hops will work. |
2156 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( | 2148 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
2157 PROCESS_TYPE_BROWSER, | 2149 PROCESS_TYPE_BROWSER, |
2158 -1, // child_id | 2150 -1, // child_id |
2159 -1, // route_id | 2151 -1, // route_id |
2160 info.frame_tree_node_id, | 2152 info.frame_tree_node_id, |
2161 -1, // request_data.origin_pid, | 2153 -1, // request_data.origin_pid, |
2162 request_id_, | 2154 MakeRequestID(), |
2163 -1, // request_data.render_frame_id, | 2155 -1, // request_data.render_frame_id, |
2164 info.is_main_frame, info.parent_is_main_frame, resource_type, | 2156 info.is_main_frame, info.parent_is_main_frame, resource_type, |
2165 info.common_params.transition, | 2157 info.common_params.transition, |
2166 // should_replace_current_entry. This was only maintained at layer for | 2158 // should_replace_current_entry. This was only maintained at layer for |
2167 // request transfers and isn't needed for browser-side navigations. | 2159 // request transfers and isn't needed for browser-side navigations. |
2168 false, | 2160 false, |
2169 false, // is download | 2161 false, // is download |
2170 false, // is stream | 2162 false, // is stream |
2171 info.common_params.allow_download, info.begin_params.has_user_gesture, | 2163 info.common_params.allow_download, info.begin_params.has_user_gesture, |
2172 true, // enable_load_timing | 2164 true, // enable_load_timing |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 bool is_download, | 2334 bool is_download, |
2343 int render_process_host_id, | 2335 int render_process_host_id, |
2344 int render_view_routing_id, | 2336 int render_view_routing_id, |
2345 int render_frame_routing_id, | 2337 int render_frame_routing_id, |
2346 ResourceContext* context) { | 2338 ResourceContext* context) { |
2347 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 2339 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
2348 DCHECK(!request->is_pending()); | 2340 DCHECK(!request->is_pending()); |
2349 | 2341 |
2350 SetReferrerForRequest(request, referrer); | 2342 SetReferrerForRequest(request, referrer); |
2351 | 2343 |
2352 request_id_--; | |
2353 | |
2354 ResourceRequestInfoImpl* info = | 2344 ResourceRequestInfoImpl* info = |
2355 CreateRequestInfo(render_process_host_id, render_view_routing_id, | 2345 CreateRequestInfo(render_process_host_id, render_view_routing_id, |
2356 render_frame_routing_id, is_download, context); | 2346 render_frame_routing_id, is_download, context); |
2357 // Request takes ownership. | 2347 // Request takes ownership. |
2358 info->AssociateWithRequest(request); | 2348 info->AssociateWithRequest(request); |
2359 } | 2349 } |
2360 | 2350 |
2361 void ResourceDispatcherHostImpl::BeginURLRequest( | 2351 void ResourceDispatcherHostImpl::BeginURLRequest( |
2362 std::unique_ptr<net::URLRequest> request, | 2352 std::unique_ptr<net::URLRequest> request, |
2363 std::unique_ptr<ResourceHandler> handler, | 2353 std::unique_ptr<ResourceHandler> handler, |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 &throttles); | 2723 &throttles); |
2734 if (!throttles.empty()) { | 2724 if (!throttles.empty()) { |
2735 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2725 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2736 std::move(throttles))); | 2726 std::move(throttles))); |
2737 } | 2727 } |
2738 } | 2728 } |
2739 return handler; | 2729 return handler; |
2740 } | 2730 } |
2741 | 2731 |
2742 } // namespace content | 2732 } // namespace content |
OLD | NEW |