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_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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1161 const Referrer referrer(request_data.referrer, request_data.referrer_policy); | 1164 const Referrer referrer(request_data.referrer, request_data.referrer_policy); |
1162 SetReferrerForRequest(new_request.get(), referrer); | 1165 SetReferrerForRequest(new_request.get(), referrer); |
1163 | 1166 |
1164 net::HttpRequestHeaders headers; | 1167 net::HttpRequestHeaders headers; |
1165 headers.AddHeadersFromString(request_data.headers); | 1168 headers.AddHeadersFromString(request_data.headers); |
1166 new_request->SetExtraRequestHeaders(headers); | 1169 new_request->SetExtraRequestHeaders(headers); |
1167 | 1170 |
1168 new_request->SetLoadFlags(load_flags); | 1171 new_request->SetLoadFlags(load_flags); |
1169 | 1172 |
1170 storage::BlobStorageContext* blob_context = | 1173 storage::BlobStorageContext* blob_context = |
1171 GetBlobStorageContext(filter_); | 1174 GetBlobStorageContext(filter_->blob_storage_context()); |
1172 // Resolve elements from request_body and prepare upload data. | 1175 // Resolve elements from request_body and prepare upload data. |
1173 if (request_data.request_body.get()) { | 1176 if (request_data.request_body.get()) { |
1174 // |blob_context| could be null when the request is from the plugins because | 1177 // |blob_context| could be null when the request is from the plugins because |
1175 // ResourceMessageFilters created in PluginProcessHost don't have the blob | 1178 // ResourceMessageFilters created in PluginProcessHost don't have the blob |
1176 // context. | 1179 // context. |
1177 if (blob_context) { | 1180 if (blob_context) { |
1178 // Attaches the BlobDataHandles to request_body not to free the blobs and | 1181 // Attaches the BlobDataHandles to request_body not to free the blobs and |
1179 // any attached shareable files until upload completion. These data will | 1182 // any attached shareable files until upload completion. These data will |
1180 // be used in UploadDataStream and ServiceWorkerURLRequestJob. | 1183 // be used in UploadDataStream and ServiceWorkerURLRequestJob. |
1181 AttachRequestBodyBlobDataHandles( | 1184 AttachRequestBodyBlobDataHandles( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 } | 1294 } |
1292 | 1295 |
1293 // Prefetches and <a ping> requests outlive their child process. | 1296 // Prefetches and <a ping> requests outlive their child process. |
1294 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1297 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { |
1295 handler.reset(new DetachableResourceHandler( | 1298 handler.reset(new DetachableResourceHandler( |
1296 request, | 1299 request, |
1297 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1300 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
1298 handler.Pass())); | 1301 handler.Pass())); |
1299 } | 1302 } |
1300 | 1303 |
1301 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1304 // If using --enable-browser-side-navigation, the CrossSiteResourceHandler is |
1302 // let us check whether a transfer is required and pause for the unload | 1305 // not needed. |
clamy
2014/10/13 15:22:43
CreateResourceHandler is not called by BeginNaviga
davidben
2014/10/15 22:53:28
Done.
| |
1303 // handler either if so or if a cross-process navigation is already under way. | 1306 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1304 bool is_swappable_navigation = | 1307 switches::kEnableBrowserSideNavigation)) { |
1305 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; | 1308 // Install a CrossSiteResourceHandler for all main frame requests. This |
1306 // If we are using --site-per-process, install it for subframes as well. | 1309 // will let us check whether a transfer is required and pause for the unload |
1307 if (!is_swappable_navigation && | 1310 // handler either if so or if a cross-process navigation is already under |
clamy
2014/10/13 15:22:43
nit: We are not pausing for the unload anymore, so
davidben
2014/10/15 22:53:29
Done.
| |
1308 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1311 // way. |
1309 switches::kSitePerProcess)) { | 1312 bool is_swappable_navigation = |
1310 is_swappable_navigation = | 1313 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME; |
1311 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | 1314 // If we are using --site-per-process, install it for subframes as well. |
1315 if (!is_swappable_navigation && | |
1316 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1317 switches::kSitePerProcess)) { | |
1318 is_swappable_navigation = | |
1319 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; | |
1320 } | |
1321 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | |
1322 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | |
1312 } | 1323 } |
1313 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) | |
1314 handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); | |
1315 | 1324 |
1316 // Insert a buffered event handler before the actual one. | 1325 // Insert a buffered event handler before the actual one. |
1317 handler.reset( | 1326 handler.reset( |
1318 new BufferedResourceHandler(handler.Pass(), this, request)); | 1327 new BufferedResourceHandler(handler.Pass(), this, request)); |
1319 | 1328 |
1320 ScopedVector<ResourceThrottle> throttles; | 1329 ScopedVector<ResourceThrottle> throttles; |
1321 if (delegate_) { | 1330 if (delegate_) { |
1322 delegate_->RequestBeginning(request, | 1331 delegate_->RequestBeginning(request, |
1323 resource_context, | 1332 resource_context, |
1324 filter_->appcache_service(), | 1333 filter_->appcache_service(), |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1758 return true; | 1767 return true; |
1759 } | 1768 } |
1760 | 1769 |
1761 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( | 1770 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( |
1762 const net::URLRequest* request_) { | 1771 const net::URLRequest* request_) { |
1763 const ResourceRequestInfoImpl* info = | 1772 const ResourceRequestInfoImpl* info = |
1764 ResourceRequestInfoImpl::ForRequest(request_); | 1773 ResourceRequestInfoImpl::ForRequest(request_); |
1765 IncrementOutstandingRequestsCount(-1, *info); | 1774 IncrementOutstandingRequestsCount(-1, *info); |
1766 } | 1775 } |
1767 | 1776 |
1768 void ResourceDispatcherHostImpl::StartNavigationRequest( | 1777 void ResourceDispatcherHostImpl::BeginNavigationRequest( |
1778 ResourceContext* resource_context, | |
1779 int64 frame_tree_node_id, | |
1769 const CommonNavigationParams& params, | 1780 const CommonNavigationParams& params, |
1770 const NavigationRequestInfo& info, | 1781 const NavigationRequestInfo& info, |
1771 scoped_refptr<ResourceRequestBody> request_body, | 1782 scoped_refptr<ResourceRequestBody> request_body, |
1772 int64 navigation_request_id, | 1783 NavigationURLLoaderCore* loader) { |
1773 int64 frame_node_id) { | 1784 // BeginNavigationRequest currently should only be used for the browser-side |
1774 NOTIMPLEMENTED(); | 1785 // navigations project. |
1775 } | 1786 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
1787 switches::kEnableBrowserSideNavigation)); | |
1776 | 1788 |
1777 void ResourceDispatcherHostImpl::CancelNavigationRequest( | 1789 ResourceType resource_type = info.is_main_frame ? |
1778 int64 navigation_request_id, | 1790 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
1779 int64 frame_node_id) { | 1791 |
1780 NOTIMPLEMENTED(); | 1792 if (is_shutdown_ || |
1793 // TODO(davidben): Check ShouldServiceRequest here. This is important; it | |
1794 // needs to be checked relative to the child that /requested/ the | |
1795 // navigation. It's where file upload checks, etc., come in. | |
1796 (delegate_ && !delegate_->ShouldBeginRequest( | |
1797 info.navigation_params.method, | |
1798 params.url, | |
1799 resource_type, | |
1800 resource_context))) { | |
1801 loader->RequestFailedOnIOThread(net::ERR_ABORTED); | |
1802 return; | |
1803 } | |
1804 | |
1805 // http://crbug.com/90971 | |
1806 char url_buf[128]; | |
1807 base::strlcpy(url_buf, params.url.spec().c_str(), arraysize(url_buf)); | |
1808 base::debug::Alias(url_buf); | |
1809 CHECK(ContainsKey(active_resource_contexts_, resource_context)); | |
1810 | |
1811 const net::URLRequestContext* request_context = | |
1812 resource_context->GetRequestContext(); | |
1813 | |
1814 int load_flags = info.navigation_params.load_flags; | |
1815 load_flags |= net::LOAD_VERIFY_EV_CERT; | |
1816 if (info.is_main_frame) { | |
1817 load_flags |= net::LOAD_MAIN_FRAME; | |
1818 } else { | |
1819 load_flags |= net::LOAD_SUB_FRAME; | |
1820 } | |
1821 // Add a flag to selectively bypass the data reduction proxy if the resource | |
1822 // type is not an image. | |
1823 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | |
1824 | |
1825 // TODO(davidben): BuildLoadFlagsForRequest includes logic for | |
1826 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? | |
1827 | |
1828 // Sync loads should have maximum priority and should be the only | |
1829 // requests that have the ignore limits flag set. | |
1830 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); | |
1831 | |
1832 // TODO(davidben): OverrideCookieStoreForRenderProcess handling for | |
1833 // prerender. There isn't a renderer process yet, so we need to use the | |
1834 // ResourceContext or something. | |
1835 scoped_ptr<net::URLRequest> new_request; | |
1836 new_request = request_context->CreateRequest(params.url, net::HIGHEST, | |
1837 nullptr, nullptr); | |
1838 | |
1839 new_request->set_method(info.navigation_params.method); | |
1840 new_request->set_first_party_for_cookies( | |
1841 info.first_party_for_cookies); | |
1842 if (info.is_main_frame) { | |
1843 new_request->set_first_party_url_policy( | |
1844 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); | |
1845 } | |
1846 | |
1847 SetReferrerForRequest(new_request.get(), params.referrer); | |
1848 | |
1849 net::HttpRequestHeaders headers; | |
1850 headers.AddHeadersFromString(info.navigation_params.headers); | |
1851 new_request->SetExtraRequestHeaders(headers); | |
1852 | |
1853 new_request->SetLoadFlags(load_flags); | |
1854 | |
1855 // Resolve elements from request_body and prepare upload data. | |
1856 if (info.navigation_params.request_body.get()) { | |
1857 storage::BlobStorageContext* blob_context = GetBlobStorageContext( | |
1858 GetChromeBlobStorageContextForResourceContext(resource_context)); | |
1859 AttachRequestBodyBlobDataHandles( | |
1860 info.navigation_params.request_body.get(), | |
1861 blob_context); | |
1862 // TODO(davidben): The FileSystemContext is null here. In the case where | |
1863 // another renderer requested this navigation, this should be the same | |
1864 // FileSystemContext passed into ShouldServiceRequest. | |
1865 new_request->set_upload(UploadDataStreamBuilder::Build( | |
1866 info.navigation_params.request_body.get(), | |
1867 blob_context, | |
1868 nullptr, // file_system_context | |
1869 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | |
1870 .get())); | |
1871 } | |
1872 | |
1873 request_id_--; | |
1874 | |
1875 // Make extra info and read footer (contains request ID). | |
1876 // | |
1877 // TODO(davidben): Associate the request with the FrameTreeNode or tab so that | |
1878 // IO thread -> UI thread hops will work. | |
1879 ResourceRequestInfoImpl* extra_info = | |
1880 new ResourceRequestInfoImpl( | |
1881 PROCESS_TYPE_BROWSER, | |
1882 -1, // child_id | |
1883 -1, // route_id | |
1884 -1, // request_data.origin_pid, | |
1885 request_id_, | |
1886 -1, // request_data.render_frame_id, | |
1887 info.is_main_frame, | |
1888 info.parent_is_main_frame, | |
1889 -1, // request_data.parent_render_frame_id, | |
1890 resource_type, | |
1891 params.transition, | |
1892 // should_replace_current_entry. This was only maintained at layer for | |
1893 // request transfers and isn't needed for browser-side navigations. | |
1894 false, | |
1895 false, // is download | |
1896 false, // is stream | |
1897 params.allow_download, | |
1898 info.navigation_params.has_user_gesture, | |
1899 true, | |
1900 params.referrer.policy, | |
1901 // TODO(davidben): This is only used for prerenders. Replace | |
1902 // is_showing with something for that. Or maybe it just comes from the | |
1903 // same mechanism as the cookie one. | |
1904 blink::WebPageVisibilityStateVisible, | |
1905 resource_context, | |
1906 base::WeakPtr<ResourceMessageFilter>(), // filter | |
1907 true); | |
1908 // Request takes ownership. | |
1909 extra_info->AssociateWithRequest(new_request.get()); | |
1910 | |
1911 if (new_request->url().SchemeIs(url::kBlobScheme)) { | |
1912 // Hang on to a reference to ensure the blob is not released prior | |
1913 // to the job being started. | |
1914 ChromeBlobStorageContext* blob_context = | |
1915 GetChromeBlobStorageContextForResourceContext(resource_context); | |
1916 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | |
1917 new_request.get(), | |
1918 blob_context->context()->GetBlobDataFromPublicURL(new_request->url())); | |
1919 } | |
1920 | |
1921 // TODO(davidben): Attach ServiceWorkerRequestHandler. | |
1922 | |
1923 // TODO(davidben): Attach AppCacheInterceptor. | |
1924 | |
1925 scoped_ptr<ResourceHandler> handler(new NavigationResourceHandler( | |
clamy
2014/10/13 15:22:43
The code following there is fairly close to Create
davidben
2014/10/15 22:53:28
Done.
| |
1926 new_request.get(), loader)); | |
1927 | |
1928 // Insert a buffered event handler before the actual one. | |
1929 handler.reset( | |
1930 new BufferedResourceHandler(handler.Pass(), this, new_request.get())); | |
1931 | |
1932 ScopedVector<ResourceThrottle> throttles; | |
1933 if (delegate_) { | |
1934 // TODO(davidben): appcache_service is currently null. | |
1935 delegate_->RequestBeginning(new_request.get(), | |
1936 resource_context, | |
1937 nullptr, | |
1938 resource_type, | |
1939 &throttles); | |
1940 } | |
1941 | |
1942 if (new_request->has_upload()) { | |
1943 // Block power save while uploading data. | |
1944 throttles.push_back(new PowerSaveBlockResourceThrottle()); | |
1945 } | |
1946 | |
1947 // TODO(davidben): Attach ResourceScheduler's throttle. | |
1948 | |
1949 handler.reset(new ThrottlingResourceHandler( | |
1950 handler.Pass(), new_request.get(), throttles.Pass())); | |
1951 | |
1952 BeginRequestInternal(new_request.Pass(), handler.Pass()); | |
1781 } | 1953 } |
1782 | 1954 |
1783 // static | 1955 // static |
1784 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 1956 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
1785 net::URLRequest* request) { | 1957 net::URLRequest* request) { |
1786 // The following fields should be a minor size contribution (experimentally | 1958 // The following fields should be a minor size contribution (experimentally |
1787 // on the order of 100). However since they are variable length, it could | 1959 // on the order of 100). However since they are variable length, it could |
1788 // in theory be a sizeable contribution. | 1960 // in theory be a sizeable contribution. |
1789 int strings_cost = request->extra_request_headers().ToString().size() + | 1961 int strings_cost = request->extra_request_headers().ToString().size() + |
1790 request->original_url().spec().size() + | 1962 request->original_url().spec().size() + |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2154 | 2326 |
2155 // Add a flag to selectively bypass the data reduction proxy if the resource | 2327 // Add a flag to selectively bypass the data reduction proxy if the resource |
2156 // type is not an image. | 2328 // type is not an image. |
2157 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) | 2329 if (request_data.resource_type != RESOURCE_TYPE_IMAGE) |
2158 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 2330 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
2159 | 2331 |
2160 return load_flags; | 2332 return load_flags; |
2161 } | 2333 } |
2162 | 2334 |
2163 } // namespace content | 2335 } // namespace content |
OLD | NEW |