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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 } | 1302 } |
1300 | 1303 |
1301 // Prefetches and <a ping> requests outlive their child process. | 1304 // Prefetches and <a ping> requests outlive their child process. |
1302 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1305 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { |
1303 handler.reset(new DetachableResourceHandler( | 1306 handler.reset(new DetachableResourceHandler( |
1304 request, | 1307 request, |
1305 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1308 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
1306 handler.Pass())); | 1309 handler.Pass())); |
1307 } | 1310 } |
1308 | 1311 |
1309 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1312 // PlzNavigate: If using --enable-browser-side-navigation, the |
1310 // let us check whether a transfer is required and pause for the unload | 1313 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
1311 // handler either if so or if a cross-process navigation is already under way. | 1314 // actual navigation request, but only the subsequent blob URL load. This does |
1312 bool is_swappable_navigation = | 1315 // not require request transfers. |
mmenke
2014/10/23 20:43:40
What about renderer-initiated cross-site navigatio
davidben
2014/10/27 20:46:05
So, that's part of the nice thing about inverting
| |
1313 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; | 1316 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1314 // If we are using --site-per-process, install it for subframes as well. | 1317 switches::kEnableBrowserSideNavigation)) { |
1315 if (!is_swappable_navigation && | 1318 // Install a CrossSiteResourceHandler for all main frame requests. This will |
1316 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1319 // check whether a transfer is required and, if so, pause for the UI thread |
1317 switches::kSitePerProcess)) { | 1320 // to drive the transfer. |
1318 is_swappable_navigation = | 1321 bool is_swappable_navigation = |
1319 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | 1322 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; |
1323 // If we are using --site-per-process, install it for subframes as well. | |
1324 if (!is_swappable_navigation && | |
1325 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1326 switches::kSitePerProcess)) { | |
1327 is_swappable_navigation = | |
1328 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | |
1329 } | |
1330 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | |
1331 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | |
1320 } | 1332 } |
1321 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | |
1322 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | |
1323 | 1333 |
1334 return AddStandardHandlers(request, request_data.resource_type, | |
1335 resource_context, filter_->appcache_service(), | |
1336 child_id, route_id, handler.Pass()); | |
1337 } | |
1338 | |
1339 scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers( | |
1340 net::URLRequest* request, | |
nasko
2014/10/23 22:36:17
nit: wrong indent, need only 4 spaces, not 6.
davidben
2014/10/27 20:46:05
Done.
| |
1341 ResourceType resource_type, | |
1342 ResourceContext* resource_context, | |
1343 AppCacheService* appcache_service, | |
1344 int child_id, | |
1345 int route_id, | |
1346 scoped_ptr<ResourceHandler> handler) { | |
1324 // Insert a buffered event handler before the actual one. | 1347 // Insert a buffered event handler before the actual one. |
1325 handler.reset( | 1348 handler.reset( |
1326 new BufferedResourceHandler(handler.Pass(), this, request)); | 1349 new BufferedResourceHandler(handler.Pass(), this, request)); |
1327 | 1350 |
1328 ScopedVector<ResourceThrottle> throttles; | 1351 ScopedVector<ResourceThrottle> throttles; |
1329 if (delegate_) { | 1352 if (delegate_) { |
1330 delegate_->RequestBeginning(request, | 1353 delegate_->RequestBeginning(request, |
1331 resource_context, | 1354 resource_context, |
1332 filter_->appcache_service(), | 1355 appcache_service, |
1333 request_data.resource_type, | 1356 resource_type, |
1334 &throttles); | 1357 &throttles); |
1335 } | 1358 } |
1336 | 1359 |
1337 if (request->has_upload()) { | 1360 if (request->has_upload()) { |
1338 // Block power save while uploading data. | 1361 // Block power save while uploading data. |
1339 throttles.push_back(new PowerSaveBlockResourceThrottle()); | 1362 throttles.push_back(new PowerSaveBlockResourceThrottle()); |
1340 } | 1363 } |
1341 | 1364 |
1342 throttles.push_back( | 1365 throttles.push_back( |
1343 scheduler_->ScheduleRequest(child_id, route_id, request).release()); | 1366 scheduler_->ScheduleRequest(child_id, route_id, request).release()); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1770 | 1793 |
1771 return true; | 1794 return true; |
1772 } | 1795 } |
1773 | 1796 |
1774 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( | 1797 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( |
1775 net::URLRequest* request) { | 1798 net::URLRequest* request) { |
1776 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1799 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1777 IncrementOutstandingRequestsCount(-1, info); | 1800 IncrementOutstandingRequestsCount(-1, info); |
1778 } | 1801 } |
1779 | 1802 |
1780 void ResourceDispatcherHostImpl::StartNavigationRequest( | 1803 void ResourceDispatcherHostImpl::BeginNavigationRequest( |
1804 ResourceContext* resource_context, | |
1805 int64 frame_tree_node_id, | |
1781 const CommonNavigationParams& params, | 1806 const CommonNavigationParams& params, |
1782 const NavigationRequestInfo& info, | 1807 const NavigationRequestInfo& info, |
1783 scoped_refptr<ResourceRequestBody> request_body, | 1808 scoped_refptr<ResourceRequestBody> request_body, |
1784 int64 navigation_request_id, | 1809 NavigationURLLoaderImplCore* loader) { |
1785 int64 frame_node_id) { | 1810 // PlzNavigate: BeginNavigationRequest currently should only be used for the |
1786 NOTIMPLEMENTED(); | 1811 // browser-side navigations project. |
1787 } | 1812 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
1813 switches::kEnableBrowserSideNavigation)); | |
1788 | 1814 |
1789 void ResourceDispatcherHostImpl::CancelNavigationRequest( | 1815 ResourceType resource_type = info.is_main_frame ? |
1790 int64 navigation_request_id, | 1816 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
1791 int64 frame_node_id) { | 1817 |
1792 NOTIMPLEMENTED(); | 1818 if (is_shutdown_ || |
1819 // TODO(davidben): Check ShouldServiceRequest here. This is important; it | |
1820 // needs to be checked relative to the child that /requested/ the | |
1821 // navigation. It's where file upload checks, etc., come in. | |
1822 (delegate_ && !delegate_->ShouldBeginRequest( | |
1823 info.navigation_params.method, | |
1824 params.url, | |
1825 resource_type, | |
1826 resource_context))) { | |
1827 loader->NotifyRequestFailed(net::ERR_ABORTED); | |
1828 return; | |
1829 } | |
1830 | |
1831 // Save the URL on the stack to help catch URLRequests which outlive their | |
1832 // URLRequestContexts. See https://crbug.com/90971 | |
1833 char url_buf[128]; | |
1834 base::strlcpy(url_buf, params.url.spec().c_str(), arraysize(url_buf)); | |
1835 base::debug::Alias(url_buf); | |
1836 CHECK(ContainsKey(active_resource_contexts_, resource_context)); | |
mmenke
2014/10/23 20:43:40
Is this needed?
davidben
2014/10/27 20:46:05
I pulled that from the other entry points. I guess
| |
1837 | |
1838 const net::URLRequestContext* request_context = | |
1839 resource_context->GetRequestContext(); | |
1840 | |
1841 int load_flags = info.navigation_params.load_flags; | |
1842 load_flags |= net::LOAD_VERIFY_EV_CERT; | |
1843 if (info.is_main_frame) { | |
1844 load_flags |= net::LOAD_MAIN_FRAME; | |
1845 } else { | |
1846 load_flags |= net::LOAD_SUB_FRAME; | |
1847 } | |
1848 // Add a flag to selectively bypass the data reduction proxy if the resource | |
1849 // type is not an image. | |
1850 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | |
1851 | |
1852 // TODO(davidben): BuildLoadFlagsForRequest includes logic for | |
1853 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? | |
1854 | |
1855 // Sync loads should have maximum priority and should be the only | |
1856 // requests that have the ignore limits flag set. | |
1857 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); | |
mmenke
2014/10/23 20:43:40
DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS))?
davidben
2014/10/27 20:46:04
Done.
| |
1858 | |
1859 // TODO(davidben): OverrideCookieStoreForRenderProcess handling for | |
1860 // prerender. There may not be a renderer process yet, so we need to use the | |
1861 // ResourceContext or something. | |
1862 scoped_ptr<net::URLRequest> new_request; | |
1863 new_request = request_context->CreateRequest(params.url, net::HIGHEST, | |
1864 nullptr, nullptr); | |
1865 | |
1866 new_request->set_method(info.navigation_params.method); | |
1867 new_request->set_first_party_for_cookies( | |
1868 info.first_party_for_cookies); | |
1869 if (info.is_main_frame) { | |
1870 new_request->set_first_party_url_policy( | |
1871 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); | |
1872 } | |
1873 | |
1874 SetReferrerForRequest(new_request.get(), params.referrer); | |
1875 | |
1876 net::HttpRequestHeaders headers; | |
1877 headers.AddHeadersFromString(info.navigation_params.headers); | |
1878 new_request->SetExtraRequestHeaders(headers); | |
1879 | |
1880 new_request->SetLoadFlags(load_flags); | |
1881 | |
1882 // Resolve elements from request_body and prepare upload data. | |
1883 if (info.navigation_params.request_body.get()) { | |
1884 storage::BlobStorageContext* blob_context = GetBlobStorageContext( | |
1885 GetChromeBlobStorageContextForResourceContext(resource_context)); | |
1886 AttachRequestBodyBlobDataHandles( | |
1887 info.navigation_params.request_body.get(), | |
1888 blob_context); | |
1889 // TODO(davidben): The FileSystemContext is null here. In the case where | |
1890 // another renderer requested this navigation, this should be the same | |
1891 // FileSystemContext passed into ShouldServiceRequest. | |
1892 new_request->set_upload(UploadDataStreamBuilder::Build( | |
1893 info.navigation_params.request_body.get(), | |
1894 blob_context, | |
1895 nullptr, // file_system_context | |
1896 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | |
1897 .get())); | |
1898 } | |
1899 | |
1900 request_id_--; | |
1901 | |
1902 // Make extra info and read footer (contains request ID). | |
1903 // | |
1904 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so | |
1905 // that IO thread -> UI thread hops will work. | |
1906 ResourceRequestInfoImpl* extra_info = | |
1907 new ResourceRequestInfoImpl( | |
1908 PROCESS_TYPE_BROWSER, | |
1909 -1, // child_id | |
1910 -1, // route_id | |
1911 -1, // request_data.origin_pid, | |
1912 request_id_, | |
1913 -1, // request_data.render_frame_id, | |
1914 info.is_main_frame, | |
1915 info.parent_is_main_frame, | |
1916 -1, // request_data.parent_render_frame_id, | |
1917 resource_type, | |
1918 params.transition, | |
1919 // should_replace_current_entry. This was only maintained at layer for | |
1920 // request transfers and isn't needed for browser-side navigations. | |
mmenke
2014/10/23 20:43:40
So this will be needed when we handle renderer-ini
davidben
2014/10/27 20:46:05
This is needed in the old navigation flow just for
| |
1921 false, | |
1922 false, // is download | |
1923 false, // is stream | |
1924 params.allow_download, | |
1925 info.navigation_params.has_user_gesture, | |
1926 true, | |
1927 params.referrer.policy, | |
1928 // TODO(davidben): This is only used for prerenders. Replace | |
1929 // is_showing with something for that. Or maybe it just comes from the | |
1930 // same mechanism as the cookie one. | |
1931 blink::WebPageVisibilityStateVisible, | |
1932 resource_context, | |
1933 base::WeakPtr<ResourceMessageFilter>(), // filter | |
1934 true); | |
1935 // Request takes ownership. | |
1936 extra_info->AssociateWithRequest(new_request.get()); | |
1937 | |
1938 if (new_request->url().SchemeIs(url::kBlobScheme)) { | |
1939 // Hang on to a reference to ensure the blob is not released prior | |
1940 // to the job being started. | |
1941 ChromeBlobStorageContext* blob_context = | |
1942 GetChromeBlobStorageContextForResourceContext(resource_context); | |
1943 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | |
1944 new_request.get(), | |
1945 blob_context->context()->GetBlobDataFromPublicURL(new_request->url())); | |
1946 } | |
1947 | |
1948 // TODO(davidben): Attach ServiceWorkerRequestHandler. | |
1949 | |
1950 // TODO(davidben): Attach AppCacheInterceptor. | |
1951 | |
1952 scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler( | |
1953 new_request.get(), loader)); | |
1954 | |
1955 handler = AddStandardHandlers(new_request.get(), resource_type, | |
1956 resource_context, | |
1957 nullptr, // TODO(davidben): appcache_service | |
1958 -1, // TODO(davidben): child_id | |
1959 -1, // TODO(davidben): route_id | |
mmenke
2014/10/23 20:43:40
Looks like these are only used by the scheduler -
davidben
2014/10/27 20:46:05
Yeah, it's currently a no-op because it can't find
| |
1960 handler.Pass()); | |
1961 | |
1962 BeginRequestInternal(new_request.Pass(), handler.Pass()); | |
1793 } | 1963 } |
1794 | 1964 |
1795 // static | 1965 // static |
1796 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 1966 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
1797 net::URLRequest* request) { | 1967 net::URLRequest* request) { |
1798 // The following fields should be a minor size contribution (experimentally | 1968 // The following fields should be a minor size contribution (experimentally |
1799 // on the order of 100). However since they are variable length, it could | 1969 // on the order of 100). However since they are variable length, it could |
1800 // in theory be a sizeable contribution. | 1970 // in theory be a sizeable contribution. |
1801 int strings_cost = request->extra_request_headers().ToString().size() + | 1971 int strings_cost = request->extra_request_headers().ToString().size() + |
1802 request->original_url().spec().size() + | 1972 request->original_url().spec().size() + |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2166 | 2336 |
2167 // Add a flag to selectively bypass the data reduction proxy if the resource | 2337 // Add a flag to selectively bypass the data reduction proxy if the resource |
2168 // type is not an image. | 2338 // type is not an image. |
2169 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2339 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2170 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2340 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2171 | 2341 |
2172 return load_flags; | 2342 return load_flags; |
2173 } | 2343 } |
2174 | 2344 |
2175 } // namespace content | 2345 } // namespace content |
OLD | NEW |