Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1041993004: content::ResourceDispatcherHostImpl changes for stale-while-revalidate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s-w-r-yhirano-patch
Patch Set: Fixes from davidben review. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 // Only block image loads, as the attack applies largely to the "src" 1368 // Only block image loads, as the attack applies largely to the "src"
1315 // property of the <img> tag. It is common for web properties to allow 1369 // property of the <img> tag. It is common for web properties to allow
1316 // untrusted values for <img src>; this is considered a fair thing for an 1370 // untrusted values for <img src>; this is considered a fair thing for an
1317 // HTML sanitizer to do. Conversely, any HTML sanitizer that didn't 1371 // HTML sanitizer to do. Conversely, any HTML sanitizer that didn't
1318 // filter sources for <script>, <link>, <embed>, <object>, <iframe> tags 1372 // filter sources for <script>, <link>, <embed>, <object>, <iframe> tags
1319 // would be considered vulnerable in and of itself. 1373 // would be considered vulnerable in and of itself.
1320 do_not_prompt_for_login = true; 1374 do_not_prompt_for_login = true;
1321 load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; 1375 load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY;
1322 } 1376 }
1323 1377
1378 bool support_async_revalidation =
1379 (!is_sync_load && async_revalidation_manager_ &&
1380 AsyncRevalidationManager::QualifiesForAsyncRevalidation(request_data));
1381
1382 if (support_async_revalidation)
1383 load_flags |= net::LOAD_SUPPORT_ASYNC_REVALIDATION;
1384
1324 // Sync loads should have maximum priority and should be the only 1385 // Sync loads should have maximum priority and should be the only
1325 // requets that have the ignore limits flag set. 1386 // requets that have the ignore limits flag set.
1326 if (is_sync_load) { 1387 if (is_sync_load) {
1327 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); 1388 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY);
1328 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1389 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1329 } else { 1390 } else {
1330 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); 1391 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0);
1331 } 1392 }
1332 new_request->SetLoadFlags(load_flags); 1393 new_request->SetLoadFlags(load_flags);
1333 1394
(...skipping 16 matching lines...) Expand all
1350 request_data.has_user_gesture, 1411 request_data.has_user_gesture,
1351 request_data.enable_load_timing, 1412 request_data.enable_load_timing,
1352 request_data.enable_upload_progress, 1413 request_data.enable_upload_progress,
1353 do_not_prompt_for_login, 1414 do_not_prompt_for_login,
1354 request_data.referrer_policy, 1415 request_data.referrer_policy,
1355 request_data.visiblity_state, 1416 request_data.visiblity_state,
1356 resource_context, filter_->GetWeakPtr(), 1417 resource_context, filter_->GetWeakPtr(),
1357 report_raw_headers, 1418 report_raw_headers,
1358 !is_sync_load, 1419 !is_sync_load,
1359 IsUsingLoFi(request_data.lofi_state, delegate_, 1420 IsUsingLoFi(request_data.lofi_state, delegate_,
1360 *new_request, resource_context)); 1421 *new_request, resource_context),
1422 support_async_revalidation ? request_data.headers : std::string());
1361 // Request takes ownership. 1423 // Request takes ownership.
1362 extra_info->AssociateWithRequest(new_request.get()); 1424 extra_info->AssociateWithRequest(new_request.get());
1363 1425
1364 if (new_request->url().SchemeIs(url::kBlobScheme)) { 1426 if (new_request->url().SchemeIs(url::kBlobScheme)) {
1365 // Hang on to a reference to ensure the blob is not released prior 1427 // Hang on to a reference to ensure the blob is not released prior
1366 // to the job being started. 1428 // to the job being started.
1367 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 1429 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
1368 new_request.get(), 1430 new_request.get(),
1369 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( 1431 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL(
1370 new_request->url())); 1432 new_request->url()));
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 false, // has_user_gesture 1699 false, // has_user_gesture
1638 false, // enable_load_timing 1700 false, // enable_load_timing
1639 false, // enable_upload_progress 1701 false, // enable_upload_progress
1640 false, // do_not_prompt_for_login 1702 false, // do_not_prompt_for_login
1641 blink::WebReferrerPolicyDefault, 1703 blink::WebReferrerPolicyDefault,
1642 blink::WebPageVisibilityStateVisible, 1704 blink::WebPageVisibilityStateVisible,
1643 context, 1705 context,
1644 base::WeakPtr<ResourceMessageFilter>(), // filter 1706 base::WeakPtr<ResourceMessageFilter>(), // filter
1645 false, // report_raw_headers 1707 false, // report_raw_headers
1646 true, // is_async 1708 true, // is_async
1647 false); // is_using_lofi 1709 false, // is_using_lofi
1710 std::string()); // original_headers
1648 } 1711 }
1649 1712
1650 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, 1713 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
1651 int route_id, 1714 int route_id,
1652 bool is_visible, 1715 bool is_visible,
1653 bool is_audible) { 1716 bool is_audible) {
1654 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); 1717 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
1655 } 1718 }
1656 1719
1657 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( 1720 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 2116 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
2054 .get())); 2117 .get()));
2055 } 2118 }
2056 2119
2057 request_id_--; 2120 request_id_--;
2058 2121
2059 // Make extra info and read footer (contains request ID). 2122 // Make extra info and read footer (contains request ID).
2060 // 2123 //
2061 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so 2124 // TODO(davidben): Associate the request with the FrameTreeNode and/or tab so
2062 // that IO thread -> UI thread hops will work. 2125 // that IO thread -> UI thread hops will work.
2126 //
2127 // TODO(ricea): The original_headers field here is just a placeholder
2128 // and wouldn't work properly with stale-while-revalidate. crbug.com/561610
2063 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( 2129 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl(
2064 PROCESS_TYPE_BROWSER, 2130 PROCESS_TYPE_BROWSER,
2065 -1, // child_id 2131 -1, // child_id
2066 -1, // route_id 2132 -1, // route_id
2067 info.frame_tree_node_id, 2133 info.frame_tree_node_id,
2068 -1, // request_data.origin_pid, 2134 -1, // request_data.origin_pid,
2069 request_id_, 2135 request_id_,
2070 -1, // request_data.render_frame_id, 2136 -1, // request_data.render_frame_id,
2071 info.is_main_frame, info.parent_is_main_frame, 2137 info.is_main_frame, info.parent_is_main_frame,
2072 -1, // request_data.parent_render_frame_id, 2138 -1, // request_data.parent_render_frame_id,
2073 resource_type, info.common_params.transition, 2139 resource_type, info.common_params.transition,
2074 // should_replace_current_entry. This was only maintained at layer for 2140 // should_replace_current_entry. This was only maintained at layer for
2075 // request transfers and isn't needed for browser-side navigations. 2141 // request transfers and isn't needed for browser-side navigations.
2076 false, 2142 false,
2077 false, // is download 2143 false, // is download
2078 false, // is stream 2144 false, // is stream
2079 info.common_params.allow_download, info.begin_params.has_user_gesture, 2145 info.common_params.allow_download, info.begin_params.has_user_gesture,
2080 true, // enable_load_timing 2146 true, // enable_load_timing
2081 false, // enable_upload_progress 2147 false, // enable_upload_progress
2082 false, // do_not_prompt_for_login 2148 false, // do_not_prompt_for_login
2083 info.common_params.referrer.policy, 2149 info.common_params.referrer.policy,
2084 // TODO(davidben): This is only used for prerenders. Replace 2150 // TODO(davidben): This is only used for prerenders. Replace
2085 // is_showing with something for that. Or maybe it just comes from the 2151 // is_showing with something for that. Or maybe it just comes from the
2086 // same mechanism as the cookie one. 2152 // same mechanism as the cookie one.
2087 blink::WebPageVisibilityStateVisible, resource_context, 2153 blink::WebPageVisibilityStateVisible, resource_context,
2088 base::WeakPtr<ResourceMessageFilter>(), // filter 2154 base::WeakPtr<ResourceMessageFilter>(), // filter
2089 false, // request_data.report_raw_headers 2155 false, // request_data.report_raw_headers
2090 true, 2156 true, // is_async
2091 IsUsingLoFi(info.common_params.lofi_state, delegate_, 2157 IsUsingLoFi(info.common_params.lofi_state, delegate_,
2092 *new_request, resource_context)); 2158 *new_request, resource_context),
2159 std::string()); // original_headers
2093 // Request takes ownership. 2160 // Request takes ownership.
2094 extra_info->AssociateWithRequest(new_request.get()); 2161 extra_info->AssociateWithRequest(new_request.get());
2095 2162
2096 if (new_request->url().SchemeIs(url::kBlobScheme)) { 2163 if (new_request->url().SchemeIs(url::kBlobScheme)) {
2097 // Hang on to a reference to ensure the blob is not released prior 2164 // Hang on to a reference to ensure the blob is not released prior
2098 // to the job being started. 2165 // to the job being started.
2099 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( 2166 storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
2100 new_request.get(), 2167 new_request.get(),
2101 blob_context->GetBlobDataFromPublicURL(new_request->url())); 2168 blob_context->GetBlobDataFromPublicURL(new_request->url()));
2102 } 2169 }
(...skipping 17 matching lines...) Expand all
2120 handler = AddStandardHandlers(new_request.get(), resource_type, 2187 handler = AddStandardHandlers(new_request.get(), resource_type,
2121 resource_context, 2188 resource_context,
2122 nullptr, // appcache_service 2189 nullptr, // appcache_service
2123 -1, // child_id 2190 -1, // child_id
2124 -1, // route_id 2191 -1, // route_id
2125 handler.Pass()); 2192 handler.Pass());
2126 2193
2127 BeginRequestInternal(new_request.Pass(), handler.Pass()); 2194 BeginRequestInternal(new_request.Pass(), handler.Pass());
2128 } 2195 }
2129 2196
2197 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
2198 if (!async_revalidation_manager_)
2199 async_revalidation_manager_.reset(new AsyncRevalidationManager);
2200 }
2201
2130 // static 2202 // static
2131 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( 2203 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(
2132 net::URLRequest* request) { 2204 net::URLRequest* request) {
2133 // The following fields should be a minor size contribution (experimentally 2205 // The following fields should be a minor size contribution (experimentally
2134 // on the order of 100). However since they are variable length, it could 2206 // on the order of 100). However since they are variable length, it could
2135 // in theory be a sizeable contribution. 2207 // in theory be a sizeable contribution.
2136 int strings_cost = request->extra_request_headers().ToString().size() + 2208 int strings_cost = request->extra_request_headers().ToString().size() +
2137 request->original_url().spec().size() + 2209 request->original_url().spec().size() +
2138 request->referrer().size() + 2210 request->referrer().size() +
2139 request->method().size(); 2211 request->method().size();
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 load_flags |= net::LOAD_PREFETCH; 2514 load_flags |= net::LOAD_PREFETCH;
2443 } 2515 }
2444 2516
2445 if (is_sync_load) 2517 if (is_sync_load)
2446 load_flags |= net::LOAD_IGNORE_LIMITS; 2518 load_flags |= net::LOAD_IGNORE_LIMITS;
2447 2519
2448 return load_flags; 2520 return load_flags;
2449 } 2521 }
2450 2522
2451 } // namespace content 2523 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698