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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/debug/alias.h" | 17 #include "base/debug/alias.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/memory/shared_memory.h" | 20 #include "base/memory/shared_memory.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/metrics/field_trial.h" | |
22 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
23 #include "base/metrics/sparse_histogram.h" | 24 #include "base/metrics/sparse_histogram.h" |
24 #include "base/profiler/scoped_tracker.h" | 25 #include "base/profiler/scoped_tracker.h" |
25 #include "base/stl_util.h" | 26 #include "base/stl_util.h" |
26 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 27 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
27 #include "base/time/time.h" | 28 #include "base/time/time.h" |
28 #include "content/browser/appcache/appcache_interceptor.h" | 29 #include "content/browser/appcache/appcache_interceptor.h" |
29 #include "content/browser/appcache/chrome_appcache_service.h" | 30 #include "content/browser/appcache/chrome_appcache_service.h" |
30 #include "content/browser/bad_message.h" | 31 #include "content/browser/bad_message.h" |
31 #include "content/browser/cert_store_impl.h" | 32 #include "content/browser/cert_store_impl.h" |
32 #include "content/browser/child_process_security_policy_impl.h" | 33 #include "content/browser/child_process_security_policy_impl.h" |
33 #include "content/browser/download/download_resource_handler.h" | 34 #include "content/browser/download/download_resource_handler.h" |
34 #include "content/browser/download/save_file_manager.h" | 35 #include "content/browser/download/save_file_manager.h" |
35 #include "content/browser/download/save_file_resource_handler.h" | 36 #include "content/browser/download/save_file_resource_handler.h" |
36 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 37 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
37 #include "content/browser/frame_host/navigation_request_info.h" | 38 #include "content/browser/frame_host/navigation_request_info.h" |
38 #include "content/browser/frame_host/navigator.h" | 39 #include "content/browser/frame_host/navigator.h" |
39 #include "content/browser/loader/async_resource_handler.h" | 40 #include "content/browser/loader/async_resource_handler.h" |
41 #include "content/browser/loader/async_revalidation_manager.h" | |
40 #include "content/browser/loader/cross_site_resource_handler.h" | 42 #include "content/browser/loader/cross_site_resource_handler.h" |
41 #include "content/browser/loader/detachable_resource_handler.h" | 43 #include "content/browser/loader/detachable_resource_handler.h" |
42 #include "content/browser/loader/mime_type_resource_handler.h" | 44 #include "content/browser/loader/mime_type_resource_handler.h" |
43 #include "content/browser/loader/navigation_resource_handler.h" | 45 #include "content/browser/loader/navigation_resource_handler.h" |
44 #include "content/browser/loader/navigation_resource_throttle.h" | 46 #include "content/browser/loader/navigation_resource_throttle.h" |
45 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 47 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
46 #include "content/browser/loader/power_save_block_resource_throttle.h" | 48 #include "content/browser/loader/power_save_block_resource_throttle.h" |
47 #include "content/browser/loader/redirect_to_file_resource_handler.h" | 49 #include "content/browser/loader/redirect_to_file_resource_handler.h" |
48 #include "content/browser/loader/resource_message_filter.h" | 50 #include "content/browser/loader/resource_message_filter.h" |
49 #include "content/browser/loader/resource_request_info_impl.h" | 51 #include "content/browser/loader/resource_request_info_impl.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 ANNOTATE_BENIGN_RACE( | 477 ANNOTATE_BENIGN_RACE( |
476 &last_user_gesture_time_, | 478 &last_user_gesture_time_, |
477 "We don't care about the precise value, see http://crbug.com/92889"); | 479 "We don't care about the precise value, see http://crbug.com/92889"); |
478 | 480 |
479 BrowserThread::PostTask(BrowserThread::IO, | 481 BrowserThread::PostTask(BrowserThread::IO, |
480 FROM_HERE, | 482 FROM_HERE, |
481 base::Bind(&ResourceDispatcherHostImpl::OnInit, | 483 base::Bind(&ResourceDispatcherHostImpl::OnInit, |
482 base::Unretained(this))); | 484 base::Unretained(this))); |
483 | 485 |
484 update_load_states_timer_.reset(new base::RepeatingTimer()); | 486 update_load_states_timer_.reset(new base::RepeatingTimer()); |
487 | |
488 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
489 // This needs to be called to mark the trial as active, even if the result | |
490 // isn't used. | |
491 std::string stale_while_revalidate_trial_group = | |
492 base::FieldTrialList::FindFullName("StaleWhileRevalidate"); | |
493 // Browser-side navigation and stale-while-revalidate do not work | |
494 // together. Only enable stale-while-revalidate if browser navigation is not | |
495 // enabled. | |
496 // TODO(ricea): Disable stale-while-revalidate completely before browser-side | |
497 // navigation becomes the default. Or make them work together. | |
498 // crbug.com/561610 | |
499 if (!command_line->HasSwitch(switches::kEnableBrowserSideNavigation) && | |
500 (stale_while_revalidate_trial_group == "Enabled" || | |
501 command_line->HasSwitch(switches::kEnableStaleWhileRevalidate))) { | |
502 async_revalidation_manager_.reset(new AsyncRevalidationManager); | |
503 } | |
485 } | 504 } |
486 | 505 |
487 ResourceDispatcherHostImpl::~ResourceDispatcherHostImpl() { | 506 ResourceDispatcherHostImpl::~ResourceDispatcherHostImpl() { |
488 DCHECK(outstanding_requests_stats_map_.empty()); | 507 DCHECK(outstanding_requests_stats_map_.empty()); |
489 DCHECK(g_resource_dispatcher_host); | 508 DCHECK(g_resource_dispatcher_host); |
490 g_resource_dispatcher_host = NULL; | 509 g_resource_dispatcher_host = NULL; |
491 } | 510 } |
492 | 511 |
493 // static | 512 // static |
494 ResourceDispatcherHostImpl* ResourceDispatcherHostImpl::Get() { | 513 ResourceDispatcherHostImpl* ResourceDispatcherHostImpl::Get() { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 (*i)->GetRequestInfo()->is_stream() || | 599 (*i)->GetRequestInfo()->is_stream() || |
581 ((*i)->GetRequestInfo()->detachable_handler() && | 600 ((*i)->GetRequestInfo()->detachable_handler() && |
582 (*i)->GetRequestInfo()->detachable_handler()->is_detached()) || | 601 (*i)->GetRequestInfo()->detachable_handler()->is_detached()) || |
583 (*i)->GetRequestInfo()->GetProcessType() == PROCESS_TYPE_BROWSER || | 602 (*i)->GetRequestInfo()->GetProcessType() == PROCESS_TYPE_BROWSER || |
584 (*i)->is_transferring()); | 603 (*i)->is_transferring()); |
585 } | 604 } |
586 #endif | 605 #endif |
587 | 606 |
588 loaders_to_cancel.clear(); | 607 loaders_to_cancel.clear(); |
589 | 608 |
609 if (async_revalidation_manager_) { | |
610 // Cancelling async revalidations should not result in the creation of new | |
611 // requests. Do it before the CHECKs to ensure this does not happen. | |
612 async_revalidation_manager_->CancelAsyncRevalidationsForResourceContext( | |
613 context); | |
614 } | |
615 | |
590 // Validate that no more requests for this context were added. | 616 // Validate that no more requests for this context were added. |
591 for (LoaderMap::const_iterator i = pending_loaders_.begin(); | 617 for (LoaderMap::const_iterator i = pending_loaders_.begin(); |
592 i != pending_loaders_.end(); ++i) { | 618 i != pending_loaders_.end(); ++i) { |
593 // http://crbug.com/90971 | 619 // http://crbug.com/90971 |
594 CHECK_NE(i->second->GetRequestInfo()->GetContext(), context); | 620 CHECK_NE(i->second->GetRequestInfo()->GetContext(), context); |
595 } | 621 } |
596 | 622 |
597 for (BlockedLoadersMap::const_iterator i = blocked_loaders_map_.begin(); | 623 for (BlockedLoadersMap::const_iterator i = blocked_loaders_map_.begin(); |
598 i != blocked_loaders_map_.end(); ++i) { | 624 i != blocked_loaders_map_.end(); ++i) { |
599 BlockedLoadersList* loaders = i->second; | 625 BlockedLoadersList* loaders = i->second; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 } | 854 } |
829 | 855 |
830 void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader, | 856 void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader, |
831 const GURL& new_url) { | 857 const GURL& new_url) { |
832 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 858 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
833 | 859 |
834 int render_process_id, render_frame_host; | 860 int render_process_id, render_frame_host; |
835 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) | 861 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) |
836 return; | 862 return; |
837 | 863 |
864 net::URLRequest* request = loader->request(); | |
865 if (request->response_info().async_revalidation_required) { | |
866 // Async revalidation is only supported for the first redirect leg. | |
867 DCHECK_EQ(request->url_chain().size(), 1u); | |
868 DCHECK(async_revalidation_manager_); | |
869 | |
870 async_revalidation_manager_->BeginAsyncRevalidation(*request, | |
871 scheduler_.get()); | |
872 } | |
873 | |
874 // Remove the LOAD_SUPPORT_ASYNC_REVALIDATION flag if it is present. | |
875 // It is difficult to create a URLRequest with the correct flags and headers | |
876 // for redirect legs other than the first one. Since stale-while-revalidate in | |
877 // combination with redirects isn't needed for experimental use, punt on it | |
878 // for now. | |
879 // TODO(ricea): Fix this before launching the feature. | |
880 if (request->load_flags() & net::LOAD_SUPPORT_ASYNC_REVALIDATION) { | |
881 int new_load_flags = | |
882 request->load_flags() & ~net::LOAD_SUPPORT_ASYNC_REVALIDATION; | |
883 request->SetLoadFlags(new_load_flags); | |
884 } | |
885 | |
838 // Don't notify WebContents observers for requests known to be | 886 // Don't notify WebContents observers for requests known to be |
839 // downloads; they aren't really associated with the Webcontents. | 887 // downloads; they aren't really associated with the Webcontents. |
840 // Note that not all downloads are known before content sniffing. | 888 // Note that not all downloads are known before content sniffing. |
841 if (info->IsDownload()) | 889 if (info->IsDownload()) |
842 return; | 890 return; |
843 | 891 |
844 // Notify the observers on the UI thread. | 892 // Notify the observers on the UI thread. |
845 scoped_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails( | 893 scoped_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails( |
846 loader->request(), | 894 loader->request(), |
847 GetCertID(loader->request(), info->GetChildID()), | 895 GetCertID(loader->request(), info->GetChildID()), |
848 new_url)); | 896 new_url)); |
849 BrowserThread::PostTask( | 897 BrowserThread::PostTask( |
850 BrowserThread::UI, FROM_HERE, | 898 BrowserThread::UI, FROM_HERE, |
851 base::Bind( | 899 base::Bind( |
852 &NotifyRedirectOnUI, | 900 &NotifyRedirectOnUI, |
853 render_process_id, render_frame_host, base::Passed(&detail))); | 901 render_process_id, render_frame_host, base::Passed(&detail))); |
854 } | 902 } |
855 | 903 |
856 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { | 904 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { |
857 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 905 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
858 net::URLRequest* request = loader->request(); | 906 net::URLRequest* request = loader->request(); |
859 if (request->was_fetched_via_proxy() && | 907 if (request->was_fetched_via_proxy() && |
860 request->was_fetched_via_spdy() && | 908 request->was_fetched_via_spdy() && |
861 request->url().SchemeIs(url::kHttpScheme)) { | 909 request->url().SchemeIs(url::kHttpScheme)) { |
862 scheduler_->OnReceivedSpdyProxiedHttpResponse( | 910 scheduler_->OnReceivedSpdyProxiedHttpResponse( |
863 info->GetChildID(), info->GetRouteID()); | 911 info->GetChildID(), info->GetRouteID()); |
864 } | 912 } |
865 | 913 |
914 if (request->response_info().async_revalidation_required) { | |
915 DCHECK(async_revalidation_manager_); | |
916 async_revalidation_manager_->BeginAsyncRevalidation(*request, | |
917 scheduler_.get()); | |
918 } | |
919 | |
866 int render_process_id, render_frame_host; | 920 int render_process_id, render_frame_host; |
867 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) | 921 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) |
868 return; | 922 return; |
869 | 923 |
870 // Don't notify WebContents observers for requests known to be | 924 // Don't notify WebContents observers for requests known to be |
871 // downloads; they aren't really associated with the Webcontents. | 925 // downloads; they aren't really associated with the Webcontents. |
872 // Note that not all downloads are known before content sniffing. | 926 // Note that not all downloads are known before content sniffing. |
873 if (info->IsDownload()) | 927 if (info->IsDownload()) |
874 return; | 928 return; |
875 | 929 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1315 // Only block image loads, as the attack applies largely to the "src" | 1369 // Only block image loads, as the attack applies largely to the "src" |
1316 // property of the <img> tag. It is common for web properties to allow | 1370 // property of the <img> tag. It is common for web properties to allow |
1317 // untrusted values for <img src>; this is considered a fair thing for an | 1371 // untrusted values for <img src>; this is considered a fair thing for an |
1318 // HTML sanitizer to do. Conversely, any HTML sanitizer that didn't | 1372 // HTML sanitizer to do. Conversely, any HTML sanitizer that didn't |
1319 // filter sources for <script>, <link>, <embed>, <object>, <iframe> tags | 1373 // filter sources for <script>, <link>, <embed>, <object>, <iframe> tags |
1320 // would be considered vulnerable in and of itself. | 1374 // would be considered vulnerable in and of itself. |
1321 do_not_prompt_for_login = true; | 1375 do_not_prompt_for_login = true; |
1322 load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; | 1376 load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; |
1323 } | 1377 } |
1324 | 1378 |
1379 bool support_async_revalidation = | |
1380 (!is_sync_load && async_revalidation_manager_ && | |
1381 AsyncRevalidationManager::QualifiesForAsyncRevalidation(request_data)); | |
1382 | |
1383 if (support_async_revalidation) | |
1384 load_flags |= net::LOAD_SUPPORT_ASYNC_REVALIDATION; | |
1385 | |
1325 // Sync loads should have maximum priority and should be the only | 1386 // Sync loads should have maximum priority and should be the only |
1326 // requets that have the ignore limits flag set. | 1387 // requets that have the ignore limits flag set. |
1327 if (is_sync_load) { | 1388 if (is_sync_load) { |
1328 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); | 1389 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); |
1329 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1390 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
1330 } else { | 1391 } else { |
1331 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1392 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
1332 } | 1393 } |
1333 new_request->SetLoadFlags(load_flags); | 1394 new_request->SetLoadFlags(load_flags); |
1334 | 1395 |
(...skipping 16 matching lines...) Expand all Loading... | |
1351 request_data.has_user_gesture, | 1412 request_data.has_user_gesture, |
1352 request_data.enable_load_timing, | 1413 request_data.enable_load_timing, |
1353 request_data.enable_upload_progress, | 1414 request_data.enable_upload_progress, |
1354 do_not_prompt_for_login, | 1415 do_not_prompt_for_login, |
1355 request_data.referrer_policy, | 1416 request_data.referrer_policy, |
1356 request_data.visiblity_state, | 1417 request_data.visiblity_state, |
1357 resource_context, filter_->GetWeakPtr(), | 1418 resource_context, filter_->GetWeakPtr(), |
1358 report_raw_headers, | 1419 report_raw_headers, |
1359 !is_sync_load, | 1420 !is_sync_load, |
1360 IsUsingLoFi(request_data.lofi_state, delegate_, | 1421 IsUsingLoFi(request_data.lofi_state, delegate_, |
1361 *new_request, resource_context)); | 1422 *new_request, resource_context), |
1423 support_async_revalidation ? request_data.headers : std::string()); | |
1362 // Request takes ownership. | 1424 // Request takes ownership. |
1363 extra_info->AssociateWithRequest(new_request.get()); | 1425 extra_info->AssociateWithRequest(new_request.get()); |
1364 | 1426 |
1365 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 1427 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
1366 // Hang on to a reference to ensure the blob is not released prior | 1428 // Hang on to a reference to ensure the blob is not released prior |
1367 // to the job being started. | 1429 // to the job being started. |
1368 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1430 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
1369 new_request.get(), | 1431 new_request.get(), |
1370 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( | 1432 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( |
1371 new_request->url())); | 1433 new_request->url())); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1638 false, // has_user_gesture | 1700 false, // has_user_gesture |
1639 false, // enable_load_timing | 1701 false, // enable_load_timing |
1640 false, // enable_upload_progress | 1702 false, // enable_upload_progress |
1641 false, // do_not_prompt_for_login | 1703 false, // do_not_prompt_for_login |
1642 blink::WebReferrerPolicyDefault, | 1704 blink::WebReferrerPolicyDefault, |
1643 blink::WebPageVisibilityStateVisible, | 1705 blink::WebPageVisibilityStateVisible, |
1644 context, | 1706 context, |
1645 base::WeakPtr<ResourceMessageFilter>(), // filter | 1707 base::WeakPtr<ResourceMessageFilter>(), // filter |
1646 false, // report_raw_headers | 1708 false, // report_raw_headers |
1647 true, // is_async | 1709 true, // is_async |
1648 false); // is_using_lofi | 1710 false, // is_using_lofi |
1711 std::string()); // original_headers | |
1649 } | 1712 } |
1650 | 1713 |
1651 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, | 1714 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, |
1652 int route_id, | 1715 int route_id, |
1653 bool is_visible, | 1716 bool is_visible, |
1654 bool is_audible) { | 1717 bool is_audible) { |
1655 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); | 1718 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); |
1656 } | 1719 } |
1657 | 1720 |
1658 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( | 1721 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2051 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | 2114 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
2052 .get())); | 2115 .get())); |
2053 } | 2116 } |
2054 | 2117 |
2055 request_id_--; | 2118 request_id_--; |
2056 | 2119 |
2057 // Make extra info and read footer (contains request ID). | 2120 // Make extra info and read footer (contains request ID). |
2058 // | 2121 // |
2059 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so | 2122 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so |
2060 // that IO thread -> UI thread hops will work. | 2123 // that IO thread -> UI thread hops will work. |
2124 // | |
2125 // TODO(ricea): The original_headers field here is just a placeholder | |
2126 // and wouldn't work properly with stale-while-revalidate. crbug.com/561610 | |
kinuko
2015/12/03 07:51:41
This comment isn't feels a bit unclear when reader
Adam Rice
2015/12/03 14:20:43
Done.
| |
2061 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( | 2127 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
2062 PROCESS_TYPE_BROWSER, | 2128 PROCESS_TYPE_BROWSER, |
2063 -1, // child_id | 2129 -1, // child_id |
2064 -1, // route_id | 2130 -1, // route_id |
2065 info.frame_tree_node_id, | 2131 info.frame_tree_node_id, |
2066 -1, // request_data.origin_pid, | 2132 -1, // request_data.origin_pid, |
2067 request_id_, | 2133 request_id_, |
2068 -1, // request_data.render_frame_id, | 2134 -1, // request_data.render_frame_id, |
2069 info.is_main_frame, info.parent_is_main_frame, | 2135 info.is_main_frame, info.parent_is_main_frame, |
2070 -1, // request_data.parent_render_frame_id, | 2136 -1, // request_data.parent_render_frame_id, |
2071 resource_type, info.common_params.transition, | 2137 resource_type, info.common_params.transition, |
2072 // should_replace_current_entry. This was only maintained at layer for | 2138 // should_replace_current_entry. This was only maintained at layer for |
2073 // request transfers and isn't needed for browser-side navigations. | 2139 // request transfers and isn't needed for browser-side navigations. |
2074 false, | 2140 false, |
2075 false, // is download | 2141 false, // is download |
2076 false, // is stream | 2142 false, // is stream |
2077 info.common_params.allow_download, info.begin_params.has_user_gesture, | 2143 info.common_params.allow_download, info.begin_params.has_user_gesture, |
2078 true, // enable_load_timing | 2144 true, // enable_load_timing |
2079 false, // enable_upload_progress | 2145 false, // enable_upload_progress |
2080 false, // do_not_prompt_for_login | 2146 false, // do_not_prompt_for_login |
2081 info.common_params.referrer.policy, | 2147 info.common_params.referrer.policy, |
2082 // TODO(davidben): This is only used for prerenders. Replace | 2148 // TODO(davidben): This is only used for prerenders. Replace |
2083 // is_showing with something for that. Or maybe it just comes from the | 2149 // is_showing with something for that. Or maybe it just comes from the |
2084 // same mechanism as the cookie one. | 2150 // same mechanism as the cookie one. |
2085 blink::WebPageVisibilityStateVisible, resource_context, | 2151 blink::WebPageVisibilityStateVisible, resource_context, |
2086 base::WeakPtr<ResourceMessageFilter>(), // filter | 2152 base::WeakPtr<ResourceMessageFilter>(), // filter |
2087 false, // request_data.report_raw_headers | 2153 false, // request_data.report_raw_headers |
2088 true, | 2154 true, // is_async |
2089 IsUsingLoFi(info.common_params.lofi_state, delegate_, | 2155 IsUsingLoFi(info.common_params.lofi_state, delegate_, |
2090 *new_request, resource_context)); | 2156 *new_request, resource_context), |
2157 std::string()); // original_headers | |
kinuko
2015/12/03 07:51:41
We don't seem to be really aligning comments in th
Adam Rice
2015/12/03 14:20:43
Fixed.
| |
2091 // Request takes ownership. | 2158 // Request takes ownership. |
2092 extra_info->AssociateWithRequest(new_request.get()); | 2159 extra_info->AssociateWithRequest(new_request.get()); |
2093 | 2160 |
2094 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2161 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
2095 // Hang on to a reference to ensure the blob is not released prior | 2162 // Hang on to a reference to ensure the blob is not released prior |
2096 // to the job being started. | 2163 // to the job being started. |
2097 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2164 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
2098 new_request.get(), | 2165 new_request.get(), |
2099 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2166 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
2100 } | 2167 } |
(...skipping 17 matching lines...) Expand all Loading... | |
2118 handler = AddStandardHandlers(new_request.get(), resource_type, | 2185 handler = AddStandardHandlers(new_request.get(), resource_type, |
2119 resource_context, | 2186 resource_context, |
2120 nullptr, // appcache_service | 2187 nullptr, // appcache_service |
2121 -1, // child_id | 2188 -1, // child_id |
2122 -1, // route_id | 2189 -1, // route_id |
2123 handler.Pass()); | 2190 handler.Pass()); |
2124 | 2191 |
2125 BeginRequestInternal(new_request.Pass(), handler.Pass()); | 2192 BeginRequestInternal(new_request.Pass(), handler.Pass()); |
2126 } | 2193 } |
2127 | 2194 |
2195 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { | |
2196 if (!async_revalidation_manager_) | |
2197 async_revalidation_manager_.reset(new AsyncRevalidationManager); | |
2198 } | |
2199 | |
2128 // static | 2200 // static |
2129 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 2201 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
2130 net::URLRequest* request) { | 2202 net::URLRequest* request) { |
2131 // The following fields should be a minor size contribution (experimentally | 2203 // The following fields should be a minor size contribution (experimentally |
2132 // on the order of 100). However since they are variable length, it could | 2204 // on the order of 100). However since they are variable length, it could |
2133 // in theory be a sizeable contribution. | 2205 // in theory be a sizeable contribution. |
2134 int strings_cost = request->extra_request_headers().ToString().size() + | 2206 int strings_cost = request->extra_request_headers().ToString().size() + |
2135 request->original_url().spec().size() + | 2207 request->original_url().spec().size() + |
2136 request->referrer().size() + | 2208 request->referrer().size() + |
2137 request->method().size(); | 2209 request->method().size(); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2440 load_flags |= net::LOAD_PREFETCH; | 2512 load_flags |= net::LOAD_PREFETCH; |
2441 } | 2513 } |
2442 | 2514 |
2443 if (is_sync_load) | 2515 if (is_sync_load) |
2444 load_flags |= net::LOAD_IGNORE_LIMITS; | 2516 load_flags |= net::LOAD_IGNORE_LIMITS; |
2445 | 2517 |
2446 return load_flags; | 2518 return load_flags; |
2447 } | 2519 } |
2448 | 2520 |
2449 } // namespace content | 2521 } // namespace content |
OLD | NEW |