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 <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/browser/download/download_resource_handler.h" | 30 #include "content/browser/download/download_resource_handler.h" |
31 #include "content/browser/download/save_file_manager.h" | 31 #include "content/browser/download/save_file_manager.h" |
32 #include "content/browser/download/save_file_resource_handler.h" | 32 #include "content/browser/download/save_file_resource_handler.h" |
33 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 33 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
34 #include "content/browser/frame_host/navigation_request_info.h" | 34 #include "content/browser/frame_host/navigation_request_info.h" |
35 #include "content/browser/frame_host/navigator.h" | 35 #include "content/browser/frame_host/navigator.h" |
36 #include "content/browser/loader/async_resource_handler.h" | 36 #include "content/browser/loader/async_resource_handler.h" |
37 #include "content/browser/loader/buffered_resource_handler.h" | 37 #include "content/browser/loader/buffered_resource_handler.h" |
38 #include "content/browser/loader/cross_site_resource_handler.h" | 38 #include "content/browser/loader/cross_site_resource_handler.h" |
39 #include "content/browser/loader/detachable_resource_handler.h" | 39 #include "content/browser/loader/detachable_resource_handler.h" |
| 40 #include "content/browser/loader/navigation_resource_handler.h" |
| 41 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
40 #include "content/browser/loader/power_save_block_resource_throttle.h" | 42 #include "content/browser/loader/power_save_block_resource_throttle.h" |
41 #include "content/browser/loader/redirect_to_file_resource_handler.h" | 43 #include "content/browser/loader/redirect_to_file_resource_handler.h" |
42 #include "content/browser/loader/resource_message_filter.h" | 44 #include "content/browser/loader/resource_message_filter.h" |
43 #include "content/browser/loader/resource_request_info_impl.h" | 45 #include "content/browser/loader/resource_request_info_impl.h" |
44 #include "content/browser/loader/stream_resource_handler.h" | 46 #include "content/browser/loader/stream_resource_handler.h" |
45 #include "content/browser/loader/sync_resource_handler.h" | 47 #include "content/browser/loader/sync_resource_handler.h" |
46 #include "content/browser/loader/throttling_resource_handler.h" | 48 #include "content/browser/loader/throttling_resource_handler.h" |
47 #include "content/browser/loader/upload_data_stream_builder.h" | 49 #include "content/browser/loader/upload_data_stream_builder.h" |
48 #include "content/browser/renderer_host/render_view_host_delegate.h" | 50 #include "content/browser/renderer_host/render_view_host_delegate.h" |
49 #include "content/browser/renderer_host/render_view_host_impl.h" | 51 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return; | 355 return; |
354 web_contents->DidGetResourceResponseStart(*details.get()); | 356 web_contents->DidGetResourceResponseStart(*details.get()); |
355 } | 357 } |
356 | 358 |
357 bool IsValidatedSCT( | 359 bool IsValidatedSCT( |
358 const net::SignedCertificateTimestampAndStatus& sct_status) { | 360 const net::SignedCertificateTimestampAndStatus& sct_status) { |
359 return sct_status.status == net::ct::SCT_STATUS_OK; | 361 return sct_status.status == net::ct::SCT_STATUS_OK; |
360 } | 362 } |
361 | 363 |
362 storage::BlobStorageContext* GetBlobStorageContext( | 364 storage::BlobStorageContext* GetBlobStorageContext( |
363 ResourceMessageFilter* filter) { | 365 ChromeBlobStorageContext* blob_storage_context) { |
364 if (!filter->blob_storage_context()) | 366 if (!blob_storage_context) |
365 return NULL; | 367 return NULL; |
366 return filter->blob_storage_context()->context(); | 368 return blob_storage_context->context(); |
367 } | 369 } |
368 | 370 |
369 void AttachRequestBodyBlobDataHandles( | 371 void AttachRequestBodyBlobDataHandles( |
370 ResourceRequestBody* body, | 372 ResourceRequestBody* body, |
371 storage::BlobStorageContext* blob_context) { | 373 storage::BlobStorageContext* blob_context) { |
372 DCHECK(blob_context); | 374 DCHECK(blob_context); |
373 for (size_t i = 0; i < body->elements()->size(); ++i) { | 375 for (size_t i = 0; i < body->elements()->size(); ++i) { |
374 const ResourceRequestBody::Element& element = (*body->elements())[i]; | 376 const ResourceRequestBody::Element& element = (*body->elements())[i]; |
375 if (element.type() != ResourceRequestBody::Element::TYPE_BLOB) | 377 if (element.type() != ResourceRequestBody::Element::TYPE_BLOB) |
376 continue; | 378 continue; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 delete loaders; | 537 delete loaders; |
536 } else { | 538 } else { |
537 ++i; | 539 ++i; |
538 } | 540 } |
539 } | 541 } |
540 | 542 |
541 #ifndef NDEBUG | 543 #ifndef NDEBUG |
542 for (LoaderList::iterator i = loaders_to_cancel.begin(); | 544 for (LoaderList::iterator i = loaders_to_cancel.begin(); |
543 i != loaders_to_cancel.end(); ++i) { | 545 i != loaders_to_cancel.end(); ++i) { |
544 // There is no strict requirement that this be the case, but currently | 546 // There is no strict requirement that this be the case, but currently |
545 // downloads, streams, detachable requests, and transferred requests are the | 547 // downloads, streams, detachable requests, transferred requests, and |
546 // only requests that aren't cancelled when the associated processes go | 548 // browser-owned requests are the only requests that aren't cancelled when |
547 // away. It may be OK for this invariant to change in the future, but if | 549 // the associated processes go away. It may be OK for this invariant to |
548 // this assertion fires without the invariant changing, then it's indicative | 550 // change in the future, but if this assertion fires without the invariant |
549 // of a leak. | 551 // changing, then it's indicative of a leak. |
550 DCHECK((*i)->GetRequestInfo()->IsDownload() || | 552 DCHECK((*i)->GetRequestInfo()->IsDownload() || |
551 (*i)->GetRequestInfo()->is_stream() || | 553 (*i)->GetRequestInfo()->is_stream() || |
552 ((*i)->GetRequestInfo()->detachable_handler() && | 554 ((*i)->GetRequestInfo()->detachable_handler() && |
553 (*i)->GetRequestInfo()->detachable_handler()->is_detached()) || | 555 (*i)->GetRequestInfo()->detachable_handler()->is_detached()) || |
| 556 (*i)->GetRequestInfo()->GetProcessType() == PROCESS_TYPE_BROWSER || |
554 (*i)->is_transferring()); | 557 (*i)->is_transferring()); |
555 } | 558 } |
556 #endif | 559 #endif |
557 | 560 |
558 loaders_to_cancel.clear(); | 561 loaders_to_cancel.clear(); |
559 | 562 |
560 // Validate that no more requests for this context were added. | 563 // Validate that no more requests for this context were added. |
561 for (LoaderMap::const_iterator i = pending_loaders_.begin(); | 564 for (LoaderMap::const_iterator i = pending_loaders_.begin(); |
562 i != pending_loaders_.end(); ++i) { | 565 i != pending_loaders_.end(); ++i) { |
563 // http://crbug.com/90971 | 566 // http://crbug.com/90971 |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 const Referrer referrer(request_data.referrer, request_data.referrer_policy); | 1170 const Referrer referrer(request_data.referrer, request_data.referrer_policy); |
1168 SetReferrerForRequest(new_request.get(), referrer); | 1171 SetReferrerForRequest(new_request.get(), referrer); |
1169 | 1172 |
1170 net::HttpRequestHeaders headers; | 1173 net::HttpRequestHeaders headers; |
1171 headers.AddHeadersFromString(request_data.headers); | 1174 headers.AddHeadersFromString(request_data.headers); |
1172 new_request->SetExtraRequestHeaders(headers); | 1175 new_request->SetExtraRequestHeaders(headers); |
1173 | 1176 |
1174 new_request->SetLoadFlags(load_flags); | 1177 new_request->SetLoadFlags(load_flags); |
1175 | 1178 |
1176 storage::BlobStorageContext* blob_context = | 1179 storage::BlobStorageContext* blob_context = |
1177 GetBlobStorageContext(filter_); | 1180 GetBlobStorageContext(filter_->blob_storage_context()); |
1178 // Resolve elements from request_body and prepare upload data. | 1181 // Resolve elements from request_body and prepare upload data. |
1179 if (request_data.request_body.get()) { | 1182 if (request_data.request_body.get()) { |
1180 // |blob_context| could be null when the request is from the plugins because | 1183 // |blob_context| could be null when the request is from the plugins because |
1181 // ResourceMessageFilters created in PluginProcessHost don't have the blob | 1184 // ResourceMessageFilters created in PluginProcessHost don't have the blob |
1182 // context. | 1185 // context. |
1183 if (blob_context) { | 1186 if (blob_context) { |
1184 // Attaches the BlobDataHandles to request_body not to free the blobs and | 1187 // Attaches the BlobDataHandles to request_body not to free the blobs and |
1185 // any attached shareable files until upload completion. These data will | 1188 // any attached shareable files until upload completion. These data will |
1186 // be used in UploadDataStream and ServiceWorkerURLRequestJob. | 1189 // be used in UploadDataStream and ServiceWorkerURLRequestJob. |
1187 AttachRequestBodyBlobDataHandles( | 1190 AttachRequestBodyBlobDataHandles( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } | 1303 } |
1301 | 1304 |
1302 // Prefetches and <a ping> requests outlive their child process. | 1305 // Prefetches and <a ping> requests outlive their child process. |
1303 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1306 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { |
1304 handler.reset(new DetachableResourceHandler( | 1307 handler.reset(new DetachableResourceHandler( |
1305 request, | 1308 request, |
1306 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1309 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
1307 handler.Pass())); | 1310 handler.Pass())); |
1308 } | 1311 } |
1309 | 1312 |
1310 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1313 // PlzNavigate: If using --enable-browser-side-navigation, the |
1311 // let us check whether a transfer is required and pause for the unload | 1314 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
1312 // handler either if so or if a cross-process navigation is already under way. | 1315 // actual navigation request, but only the subsequent blob URL load. This does |
1313 bool is_swappable_navigation = | 1316 // not require request transfers. |
1314 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; | 1317 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1315 // If we are using --site-per-process, install it for subframes as well. | 1318 switches::kEnableBrowserSideNavigation)) { |
1316 if (!is_swappable_navigation && | 1319 // Install a CrossSiteResourceHandler for all main frame requests. This will |
1317 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1320 // check whether a transfer is required and, if so, pause for the UI thread |
1318 switches::kSitePerProcess)) { | 1321 // to drive the transfer. |
1319 is_swappable_navigation = | 1322 bool is_swappable_navigation = |
1320 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | 1323 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; |
| 1324 // If we are using --site-per-process, install it for subframes as well. |
| 1325 if (!is_swappable_navigation && |
| 1326 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1327 switches::kSitePerProcess)) { |
| 1328 is_swappable_navigation = |
| 1329 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; |
| 1330 } |
| 1331 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) |
| 1332 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); |
1321 } | 1333 } |
1322 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | |
1323 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | |
1324 | 1334 |
| 1335 return AddStandardHandlers(request, request_data.resource_type, |
| 1336 resource_context, filter_->appcache_service(), |
| 1337 child_id, route_id, handler.Pass()); |
| 1338 } |
| 1339 |
| 1340 scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers( |
| 1341 net::URLRequest* request, |
| 1342 ResourceType resource_type, |
| 1343 ResourceContext* resource_context, |
| 1344 AppCacheService* appcache_service, |
| 1345 int child_id, |
| 1346 int route_id, |
| 1347 scoped_ptr<ResourceHandler> handler) { |
1325 // Insert a buffered event handler before the actual one. | 1348 // Insert a buffered event handler before the actual one. |
1326 handler.reset( | 1349 handler.reset( |
1327 new BufferedResourceHandler(handler.Pass(), this, request)); | 1350 new BufferedResourceHandler(handler.Pass(), this, request)); |
1328 | 1351 |
1329 ScopedVector<ResourceThrottle> throttles; | 1352 ScopedVector<ResourceThrottle> throttles; |
1330 if (delegate_) { | 1353 if (delegate_) { |
1331 delegate_->RequestBeginning(request, | 1354 delegate_->RequestBeginning(request, |
1332 resource_context, | 1355 resource_context, |
1333 filter_->appcache_service(), | 1356 appcache_service, |
1334 request_data.resource_type, | 1357 resource_type, |
1335 &throttles); | 1358 &throttles); |
1336 } | 1359 } |
1337 | 1360 |
1338 if (request->has_upload()) { | 1361 if (request->has_upload()) { |
1339 // Block power save while uploading data. | 1362 // Block power save while uploading data. |
1340 throttles.push_back(new PowerSaveBlockResourceThrottle()); | 1363 throttles.push_back(new PowerSaveBlockResourceThrottle()); |
1341 } | 1364 } |
1342 | 1365 |
1343 throttles.push_back( | 1366 throttles.push_back( |
1344 scheduler_->ScheduleRequest(child_id, route_id, request).release()); | 1367 scheduler_->ScheduleRequest(child_id, route_id, request).release()); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 | 1795 |
1773 return true; | 1796 return true; |
1774 } | 1797 } |
1775 | 1798 |
1776 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( | 1799 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( |
1777 net::URLRequest* request) { | 1800 net::URLRequest* request) { |
1778 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1801 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1779 IncrementOutstandingRequestsCount(-1, info); | 1802 IncrementOutstandingRequestsCount(-1, info); |
1780 } | 1803 } |
1781 | 1804 |
1782 void ResourceDispatcherHostImpl::StartNavigationRequest( | 1805 void ResourceDispatcherHostImpl::BeginNavigationRequest( |
| 1806 ResourceContext* resource_context, |
| 1807 int64 frame_tree_node_id, |
1783 const CommonNavigationParams& params, | 1808 const CommonNavigationParams& params, |
1784 const NavigationRequestInfo& info, | 1809 const NavigationRequestInfo& info, |
1785 scoped_refptr<ResourceRequestBody> request_body, | 1810 scoped_refptr<ResourceRequestBody> request_body, |
1786 int64 navigation_request_id, | 1811 NavigationURLLoaderImplCore* loader) { |
1787 int64 frame_node_id) { | 1812 // PlzNavigate: BeginNavigationRequest currently should only be used for the |
1788 NOTIMPLEMENTED(); | 1813 // browser-side navigations project. |
1789 } | 1814 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1815 switches::kEnableBrowserSideNavigation)); |
1790 | 1816 |
1791 void ResourceDispatcherHostImpl::CancelNavigationRequest( | 1817 ResourceType resource_type = info.is_main_frame ? |
1792 int64 navigation_request_id, | 1818 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
1793 int64 frame_node_id) { | 1819 |
1794 NOTIMPLEMENTED(); | 1820 if (is_shutdown_ || |
| 1821 // TODO(davidben): Check ShouldServiceRequest here. This is important; it |
| 1822 // needs to be checked relative to the child that /requested/ the |
| 1823 // navigation. It's where file upload checks, etc., come in. |
| 1824 (delegate_ && !delegate_->ShouldBeginRequest( |
| 1825 info.navigation_params.method, |
| 1826 params.url, |
| 1827 resource_type, |
| 1828 resource_context))) { |
| 1829 loader->NotifyRequestFailed(net::ERR_ABORTED); |
| 1830 return; |
| 1831 } |
| 1832 |
| 1833 // Save the URL on the stack to help catch URLRequests which outlive their |
| 1834 // URLRequestContexts. See https://crbug.com/90971 |
| 1835 char url_buf[128]; |
| 1836 base::strlcpy(url_buf, params.url.spec().c_str(), arraysize(url_buf)); |
| 1837 base::debug::Alias(url_buf); |
| 1838 CHECK(ContainsKey(active_resource_contexts_, resource_context)); |
| 1839 |
| 1840 const net::URLRequestContext* request_context = |
| 1841 resource_context->GetRequestContext(); |
| 1842 |
| 1843 int load_flags = info.navigation_params.load_flags; |
| 1844 load_flags |= net::LOAD_VERIFY_EV_CERT; |
| 1845 if (info.is_main_frame) { |
| 1846 load_flags |= net::LOAD_MAIN_FRAME; |
| 1847 } else { |
| 1848 load_flags |= net::LOAD_SUB_FRAME; |
| 1849 } |
| 1850 // Add a flag to selectively bypass the data reduction proxy if the resource |
| 1851 // type is not an image. |
| 1852 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
| 1853 |
| 1854 // TODO(davidben): BuildLoadFlagsForRequest includes logic for |
| 1855 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? |
| 1856 |
| 1857 // Sync loads should have maximum priority and should be the only |
| 1858 // requests that have the ignore limits flag set. |
| 1859 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); |
| 1860 |
| 1861 // TODO(davidben): OverrideCookieStoreForRenderProcess handling for |
| 1862 // prerender. There may not be a renderer process yet, so we need to use the |
| 1863 // ResourceContext or something. |
| 1864 scoped_ptr<net::URLRequest> new_request; |
| 1865 new_request = request_context->CreateRequest(params.url, net::HIGHEST, |
| 1866 nullptr, nullptr); |
| 1867 |
| 1868 new_request->set_method(info.navigation_params.method); |
| 1869 new_request->set_first_party_for_cookies( |
| 1870 info.first_party_for_cookies); |
| 1871 if (info.is_main_frame) { |
| 1872 new_request->set_first_party_url_policy( |
| 1873 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
| 1874 } |
| 1875 |
| 1876 SetReferrerForRequest(new_request.get(), params.referrer); |
| 1877 |
| 1878 net::HttpRequestHeaders headers; |
| 1879 headers.AddHeadersFromString(info.navigation_params.headers); |
| 1880 new_request->SetExtraRequestHeaders(headers); |
| 1881 |
| 1882 new_request->SetLoadFlags(load_flags); |
| 1883 |
| 1884 // Resolve elements from request_body and prepare upload data. |
| 1885 if (info.navigation_params.request_body.get()) { |
| 1886 storage::BlobStorageContext* blob_context = GetBlobStorageContext( |
| 1887 GetChromeBlobStorageContextForResourceContext(resource_context)); |
| 1888 AttachRequestBodyBlobDataHandles( |
| 1889 info.navigation_params.request_body.get(), |
| 1890 blob_context); |
| 1891 // TODO(davidben): The FileSystemContext is null here. In the case where |
| 1892 // another renderer requested this navigation, this should be the same |
| 1893 // FileSystemContext passed into ShouldServiceRequest. |
| 1894 new_request->set_upload(UploadDataStreamBuilder::Build( |
| 1895 info.navigation_params.request_body.get(), |
| 1896 blob_context, |
| 1897 nullptr, // file_system_context |
| 1898 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
| 1899 .get())); |
| 1900 } |
| 1901 |
| 1902 request_id_--; |
| 1903 |
| 1904 // Make extra info and read footer (contains request ID). |
| 1905 // |
| 1906 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so |
| 1907 // that IO thread -> UI thread hops will work. |
| 1908 ResourceRequestInfoImpl* extra_info = |
| 1909 new ResourceRequestInfoImpl( |
| 1910 PROCESS_TYPE_BROWSER, |
| 1911 -1, // child_id |
| 1912 -1, // route_id |
| 1913 -1, // request_data.origin_pid, |
| 1914 request_id_, |
| 1915 -1, // request_data.render_frame_id, |
| 1916 info.is_main_frame, |
| 1917 info.parent_is_main_frame, |
| 1918 -1, // request_data.parent_render_frame_id, |
| 1919 resource_type, |
| 1920 params.transition, |
| 1921 // should_replace_current_entry. This was only maintained at layer for |
| 1922 // request transfers and isn't needed for browser-side navigations. |
| 1923 false, |
| 1924 false, // is download |
| 1925 false, // is stream |
| 1926 params.allow_download, |
| 1927 info.navigation_params.has_user_gesture, |
| 1928 true, // enable_load_timing |
| 1929 false, // enable_upload_progress |
| 1930 params.referrer.policy, |
| 1931 // TODO(davidben): This is only used for prerenders. Replace |
| 1932 // is_showing with something for that. Or maybe it just comes from the |
| 1933 // same mechanism as the cookie one. |
| 1934 blink::WebPageVisibilityStateVisible, |
| 1935 resource_context, |
| 1936 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 1937 true); |
| 1938 // Request takes ownership. |
| 1939 extra_info->AssociateWithRequest(new_request.get()); |
| 1940 |
| 1941 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 1942 // Hang on to a reference to ensure the blob is not released prior |
| 1943 // to the job being started. |
| 1944 ChromeBlobStorageContext* blob_context = |
| 1945 GetChromeBlobStorageContextForResourceContext(resource_context); |
| 1946 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 1947 new_request.get(), |
| 1948 blob_context->context()->GetBlobDataFromPublicURL(new_request->url())); |
| 1949 } |
| 1950 |
| 1951 // TODO(davidben): Attach ServiceWorkerRequestHandler. |
| 1952 |
| 1953 // TODO(davidben): Attach AppCacheInterceptor. |
| 1954 |
| 1955 scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler( |
| 1956 new_request.get(), loader)); |
| 1957 |
| 1958 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the |
| 1959 // dependency on child_id/route_id. Those are used by the ResourceScheduler; |
| 1960 // currently it's a no-op. |
| 1961 handler = AddStandardHandlers(new_request.get(), resource_type, |
| 1962 resource_context, |
| 1963 nullptr, // appcache_service |
| 1964 -1, // child_id |
| 1965 -1, // route_id |
| 1966 handler.Pass()); |
| 1967 |
| 1968 BeginRequestInternal(new_request.Pass(), handler.Pass()); |
1795 } | 1969 } |
1796 | 1970 |
1797 // static | 1971 // static |
1798 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 1972 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
1799 net::URLRequest* request) { | 1973 net::URLRequest* request) { |
1800 // The following fields should be a minor size contribution (experimentally | 1974 // The following fields should be a minor size contribution (experimentally |
1801 // on the order of 100). However since they are variable length, it could | 1975 // on the order of 100). However since they are variable length, it could |
1802 // in theory be a sizeable contribution. | 1976 // in theory be a sizeable contribution. |
1803 int strings_cost = request->extra_request_headers().ToString().size() + | 1977 int strings_cost = request->extra_request_headers().ToString().size() + |
1804 request->original_url().spec().size() + | 1978 request->original_url().spec().size() + |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 | 2342 |
2169 // Add a flag to selectively bypass the data reduction proxy if the resource | 2343 // Add a flag to selectively bypass the data reduction proxy if the resource |
2170 // type is not an image. | 2344 // type is not an image. |
2171 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2345 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2172 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2346 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2173 | 2347 |
2174 return load_flags; | 2348 return load_flags; |
2175 } | 2349 } |
2176 | 2350 |
2177 } // namespace content | 2351 } // namespace content |
OLD | NEW |