Chromium Code Reviews| 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" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 ANNOTATE_BENIGN_RACE( | 476 ANNOTATE_BENIGN_RACE( |
| 476 &last_user_gesture_time_, | 477 &last_user_gesture_time_, |
| 477 "We don't care about the precise value, see http://crbug.com/92889"); | 478 "We don't care about the precise value, see http://crbug.com/92889"); |
| 478 | 479 |
| 479 BrowserThread::PostTask(BrowserThread::IO, | 480 BrowserThread::PostTask(BrowserThread::IO, |
| 480 FROM_HERE, | 481 FROM_HERE, |
| 481 base::Bind(&ResourceDispatcherHostImpl::OnInit, | 482 base::Bind(&ResourceDispatcherHostImpl::OnInit, |
| 482 base::Unretained(this))); | 483 base::Unretained(this))); |
| 483 | 484 |
| 484 update_load_states_timer_.reset(new base::RepeatingTimer()); | 485 update_load_states_timer_.reset(new base::RepeatingTimer()); |
| 486 | |
| 487 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 488 if (base::FieldTrialList::FindFullName("StaleWhileRevalidate") == "Enabled" || | |
| 489 command_line->HasSwitch(switches::kEnableStaleWhileRevalidate)) { | |
| 490 async_revalidation_manager_.reset(new AsyncRevalidationManager); | |
| 491 } | |
| 485 } | 492 } |
| 486 | 493 |
| 487 ResourceDispatcherHostImpl::~ResourceDispatcherHostImpl() { | 494 ResourceDispatcherHostImpl::~ResourceDispatcherHostImpl() { |
| 488 DCHECK(outstanding_requests_stats_map_.empty()); | 495 DCHECK(outstanding_requests_stats_map_.empty()); |
| 496 // It's not safe to destroy this object while AsyncRevalidationDriver objects | |
| 497 // have callbacks referencing it. | |
|
davidben
2015/11/23 23:40:43
What are "this object" and "it" here? RDH? ARM?
I
Adam Rice
2015/11/25 19:39:40
Sorry, the comment was out-of-date, and there's no
| |
| 498 async_revalidation_manager_.reset(); | |
| 489 DCHECK(g_resource_dispatcher_host); | 499 DCHECK(g_resource_dispatcher_host); |
| 490 g_resource_dispatcher_host = NULL; | 500 g_resource_dispatcher_host = NULL; |
| 491 } | 501 } |
| 492 | 502 |
| 493 // static | 503 // static |
| 494 ResourceDispatcherHostImpl* ResourceDispatcherHostImpl::Get() { | 504 ResourceDispatcherHostImpl* ResourceDispatcherHostImpl::Get() { |
| 495 return g_resource_dispatcher_host; | 505 return g_resource_dispatcher_host; |
| 496 } | 506 } |
| 497 | 507 |
| 498 void ResourceDispatcherHostImpl::SetDelegate( | 508 void ResourceDispatcherHostImpl::SetDelegate( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 (*i)->GetRequestInfo()->is_stream() || | 590 (*i)->GetRequestInfo()->is_stream() || |
| 581 ((*i)->GetRequestInfo()->detachable_handler() && | 591 ((*i)->GetRequestInfo()->detachable_handler() && |
| 582 (*i)->GetRequestInfo()->detachable_handler()->is_detached()) || | 592 (*i)->GetRequestInfo()->detachable_handler()->is_detached()) || |
| 583 (*i)->GetRequestInfo()->GetProcessType() == PROCESS_TYPE_BROWSER || | 593 (*i)->GetRequestInfo()->GetProcessType() == PROCESS_TYPE_BROWSER || |
| 584 (*i)->is_transferring()); | 594 (*i)->is_transferring()); |
| 585 } | 595 } |
| 586 #endif | 596 #endif |
| 587 | 597 |
| 588 loaders_to_cancel.clear(); | 598 loaders_to_cancel.clear(); |
| 589 | 599 |
| 600 if (async_revalidation_manager_) { | |
| 601 // Cancelling async revalidations should not result in the creation of new | |
| 602 // requests, but do it before the checks just to be on the safe side. | |
|
davidben
2015/11/23 23:40:42
checks -> CHECKs and "just to be on the safe side"
Adam Rice
2015/11/25 19:39:40
Sorry about that. It should be clearer now.
| |
| 603 async_revalidation_manager_->CancelAsyncRevalidationsForResourceContext( | |
| 604 context); | |
| 605 } | |
| 606 | |
| 590 // Validate that no more requests for this context were added. | 607 // Validate that no more requests for this context were added. |
| 591 for (LoaderMap::const_iterator i = pending_loaders_.begin(); | 608 for (LoaderMap::const_iterator i = pending_loaders_.begin(); |
| 592 i != pending_loaders_.end(); ++i) { | 609 i != pending_loaders_.end(); ++i) { |
| 593 // http://crbug.com/90971 | 610 // http://crbug.com/90971 |
| 594 CHECK_NE(i->second->GetRequestInfo()->GetContext(), context); | 611 CHECK_NE(i->second->GetRequestInfo()->GetContext(), context); |
| 595 } | 612 } |
| 596 | 613 |
| 597 for (BlockedLoadersMap::const_iterator i = blocked_loaders_map_.begin(); | 614 for (BlockedLoadersMap::const_iterator i = blocked_loaders_map_.begin(); |
| 598 i != blocked_loaders_map_.end(); ++i) { | 615 i != blocked_loaders_map_.end(); ++i) { |
| 599 BlockedLoadersList* loaders = i->second; | 616 BlockedLoadersList* loaders = i->second; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 828 } | 845 } |
| 829 | 846 |
| 830 void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader, | 847 void ResourceDispatcherHostImpl::DidReceiveRedirect(ResourceLoader* loader, |
| 831 const GURL& new_url) { | 848 const GURL& new_url) { |
| 832 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 849 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
| 833 | 850 |
| 834 int render_process_id, render_frame_host; | 851 int render_process_id, render_frame_host; |
| 835 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) | 852 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) |
| 836 return; | 853 return; |
| 837 | 854 |
| 855 net::URLRequest* request = loader->request(); | |
| 856 if (request->response_info().async_revalidation_required && !is_shutdown_) { | |
|
davidben
2015/11/23 23:40:43
In what situation could is_shutdown_ be true here?
Adam Rice
2015/11/25 19:39:40
It can't. Removed.
| |
| 857 // Async revalidation is only supported for the first redirect leg. | |
| 858 DCHECK_EQ(request->url_chain().size(), 1u); | |
| 859 DCHECK(async_revalidation_manager_); | |
| 860 | |
| 861 async_revalidation_manager_->BeginAsyncRevalidation(request, | |
| 862 scheduler_.get()); | |
| 863 } | |
| 864 | |
| 865 // Remove the LOAD_SUPPORT_ASYNC_REVALIDATION flag if it is present. | |
| 866 // It is difficult to create a URLRequest with the correct flags and headers | |
| 867 // for redirect legs other than the first one. Since stale-while-revalidate in | |
| 868 // combination with redirects isn't needed for experimental use, punt on it | |
| 869 // for now. | |
| 870 // TODO(ricea): Fix this before launching the feature. | |
| 871 if (request->load_flags() & net::LOAD_SUPPORT_ASYNC_REVALIDATION) { | |
| 872 int new_load_flags = | |
| 873 request->load_flags() & ~net::LOAD_SUPPORT_ASYNC_REVALIDATION; | |
| 874 request->SetLoadFlags(new_load_flags); | |
| 875 } | |
| 876 | |
| 838 // Don't notify WebContents observers for requests known to be | 877 // Don't notify WebContents observers for requests known to be |
| 839 // downloads; they aren't really associated with the Webcontents. | 878 // downloads; they aren't really associated with the Webcontents. |
| 840 // Note that not all downloads are known before content sniffing. | 879 // Note that not all downloads are known before content sniffing. |
| 841 if (info->IsDownload()) | 880 if (info->IsDownload()) |
| 842 return; | 881 return; |
| 843 | 882 |
| 844 // Notify the observers on the UI thread. | 883 // Notify the observers on the UI thread. |
| 845 scoped_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails( | 884 scoped_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails( |
| 846 loader->request(), | 885 loader->request(), |
| 847 GetCertID(loader->request(), info->GetChildID()), | 886 GetCertID(loader->request(), info->GetChildID()), |
| 848 new_url)); | 887 new_url)); |
| 849 BrowserThread::PostTask( | 888 BrowserThread::PostTask( |
| 850 BrowserThread::UI, FROM_HERE, | 889 BrowserThread::UI, FROM_HERE, |
| 851 base::Bind( | 890 base::Bind( |
| 852 &NotifyRedirectOnUI, | 891 &NotifyRedirectOnUI, |
| 853 render_process_id, render_frame_host, base::Passed(&detail))); | 892 render_process_id, render_frame_host, base::Passed(&detail))); |
| 854 } | 893 } |
| 855 | 894 |
| 856 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { | 895 void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) { |
| 857 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); | 896 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
| 858 net::URLRequest* request = loader->request(); | 897 net::URLRequest* request = loader->request(); |
| 859 if (request->was_fetched_via_proxy() && | 898 if (request->was_fetched_via_proxy() && |
| 860 request->was_fetched_via_spdy() && | 899 request->was_fetched_via_spdy() && |
| 861 request->url().SchemeIs(url::kHttpScheme)) { | 900 request->url().SchemeIs(url::kHttpScheme)) { |
| 862 scheduler_->OnReceivedSpdyProxiedHttpResponse( | 901 scheduler_->OnReceivedSpdyProxiedHttpResponse( |
| 863 info->GetChildID(), info->GetRouteID()); | 902 info->GetChildID(), info->GetRouteID()); |
| 864 } | 903 } |
| 865 | 904 |
| 905 if (request->response_info().async_revalidation_required && !is_shutdown_) { | |
|
davidben
2015/11/23 23:40:42
In what situation can is_shutdown_ be true here?
Adam Rice
2015/11/25 19:39:40
Removed.
| |
| 906 DCHECK(async_revalidation_manager_); | |
| 907 async_revalidation_manager_->BeginAsyncRevalidation(request, | |
| 908 scheduler_.get()); | |
| 909 } | |
| 910 | |
| 866 int render_process_id, render_frame_host; | 911 int render_process_id, render_frame_host; |
| 867 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) | 912 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host)) |
| 868 return; | 913 return; |
| 869 | 914 |
| 870 // Don't notify WebContents observers for requests known to be | 915 // Don't notify WebContents observers for requests known to be |
| 871 // downloads; they aren't really associated with the Webcontents. | 916 // downloads; they aren't really associated with the Webcontents. |
| 872 // Note that not all downloads are known before content sniffing. | 917 // Note that not all downloads are known before content sniffing. |
| 873 if (info->IsDownload()) | 918 if (info->IsDownload()) |
| 874 return; | 919 return; |
| 875 | 920 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1314 // Only block image loads, as the attack applies largely to the "src" | 1359 // 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 | 1360 // 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 | 1361 // 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 | 1362 // HTML sanitizer to do. Conversely, any HTML sanitizer that didn't |
| 1318 // filter sources for <script>, <link>, <embed>, <object>, <iframe> tags | 1363 // filter sources for <script>, <link>, <embed>, <object>, <iframe> tags |
| 1319 // would be considered vulnerable in and of itself. | 1364 // would be considered vulnerable in and of itself. |
| 1320 do_not_prompt_for_login = true; | 1365 do_not_prompt_for_login = true; |
| 1321 load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; | 1366 load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; |
| 1322 } | 1367 } |
| 1323 | 1368 |
| 1369 bool support_async_revalidation = | |
| 1370 (!is_sync_load && async_revalidation_manager_ && | |
| 1371 AsyncRevalidationManager::QualifiesForAsyncRevalidation(request_data)); | |
| 1372 | |
| 1373 if (support_async_revalidation) | |
| 1374 load_flags |= net::LOAD_SUPPORT_ASYNC_REVALIDATION; | |
| 1375 | |
| 1324 // Sync loads should have maximum priority and should be the only | 1376 // Sync loads should have maximum priority and should be the only |
| 1325 // requets that have the ignore limits flag set. | 1377 // requets that have the ignore limits flag set. |
| 1326 if (is_sync_load) { | 1378 if (is_sync_load) { |
| 1327 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); | 1379 DCHECK_EQ(request_data.priority, net::MAXIMUM_PRIORITY); |
| 1328 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1380 DCHECK_NE(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
| 1329 } else { | 1381 } else { |
| 1330 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); | 1382 DCHECK_EQ(load_flags & net::LOAD_IGNORE_LIMITS, 0); |
| 1331 } | 1383 } |
| 1332 new_request->SetLoadFlags(load_flags); | 1384 new_request->SetLoadFlags(load_flags); |
| 1333 | 1385 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1350 request_data.has_user_gesture, | 1402 request_data.has_user_gesture, |
| 1351 request_data.enable_load_timing, | 1403 request_data.enable_load_timing, |
| 1352 request_data.enable_upload_progress, | 1404 request_data.enable_upload_progress, |
| 1353 do_not_prompt_for_login, | 1405 do_not_prompt_for_login, |
| 1354 request_data.referrer_policy, | 1406 request_data.referrer_policy, |
| 1355 request_data.visiblity_state, | 1407 request_data.visiblity_state, |
| 1356 resource_context, filter_->GetWeakPtr(), | 1408 resource_context, filter_->GetWeakPtr(), |
| 1357 report_raw_headers, | 1409 report_raw_headers, |
| 1358 !is_sync_load, | 1410 !is_sync_load, |
| 1359 IsUsingLoFi(request_data.lofi_state, delegate_, | 1411 IsUsingLoFi(request_data.lofi_state, delegate_, |
| 1360 *new_request, resource_context)); | 1412 *new_request, resource_context), |
| 1413 support_async_revalidation ? request_data.headers : std::string()); | |
| 1361 // Request takes ownership. | 1414 // Request takes ownership. |
| 1362 extra_info->AssociateWithRequest(new_request.get()); | 1415 extra_info->AssociateWithRequest(new_request.get()); |
| 1363 | 1416 |
| 1364 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 1417 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 1365 // Hang on to a reference to ensure the blob is not released prior | 1418 // Hang on to a reference to ensure the blob is not released prior |
| 1366 // to the job being started. | 1419 // to the job being started. |
| 1367 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1420 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 1368 new_request.get(), | 1421 new_request.get(), |
| 1369 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( | 1422 filter_->blob_storage_context()->context()->GetBlobDataFromPublicURL( |
| 1370 new_request->url())); | 1423 new_request->url())); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1637 false, // has_user_gesture | 1690 false, // has_user_gesture |
| 1638 false, // enable_load_timing | 1691 false, // enable_load_timing |
| 1639 false, // enable_upload_progress | 1692 false, // enable_upload_progress |
| 1640 false, // do_not_prompt_for_login | 1693 false, // do_not_prompt_for_login |
| 1641 blink::WebReferrerPolicyDefault, | 1694 blink::WebReferrerPolicyDefault, |
| 1642 blink::WebPageVisibilityStateVisible, | 1695 blink::WebPageVisibilityStateVisible, |
| 1643 context, | 1696 context, |
| 1644 base::WeakPtr<ResourceMessageFilter>(), // filter | 1697 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 1645 false, // report_raw_headers | 1698 false, // report_raw_headers |
| 1646 true, // is_async | 1699 true, // is_async |
| 1647 false); // is_using_lofi | 1700 false, // is_using_lofi |
| 1701 std::string()); // original_headers | |
| 1648 } | 1702 } |
| 1649 | 1703 |
| 1650 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, | 1704 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, |
| 1651 int route_id, | 1705 int route_id, |
| 1652 bool is_visible, | 1706 bool is_visible, |
| 1653 bool is_audible) { | 1707 bool is_audible) { |
| 1654 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); | 1708 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); |
| 1655 } | 1709 } |
| 1656 | 1710 |
| 1657 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( | 1711 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2080 true, // enable_load_timing | 2134 true, // enable_load_timing |
| 2081 false, // enable_upload_progress | 2135 false, // enable_upload_progress |
| 2082 false, // do_not_prompt_for_login | 2136 false, // do_not_prompt_for_login |
| 2083 info.common_params.referrer.policy, | 2137 info.common_params.referrer.policy, |
| 2084 // TODO(davidben): This is only used for prerenders. Replace | 2138 // TODO(davidben): This is only used for prerenders. Replace |
| 2085 // is_showing with something for that. Or maybe it just comes from the | 2139 // is_showing with something for that. Or maybe it just comes from the |
| 2086 // same mechanism as the cookie one. | 2140 // same mechanism as the cookie one. |
| 2087 blink::WebPageVisibilityStateVisible, resource_context, | 2141 blink::WebPageVisibilityStateVisible, resource_context, |
| 2088 base::WeakPtr<ResourceMessageFilter>(), // filter | 2142 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 2089 false, // request_data.report_raw_headers | 2143 false, // request_data.report_raw_headers |
| 2090 true, | |
| 2091 IsUsingLoFi(info.common_params.lofi_state, delegate_, | 2144 IsUsingLoFi(info.common_params.lofi_state, delegate_, |
| 2092 *new_request, resource_context)); | 2145 *new_request, resource_context), |
| 2146 true, // is_async | |
|
davidben
2015/11/23 23:40:42
BUG: You switched two parameters here.
Adam Rice
2015/11/25 19:39:40
Fixed.
| |
| 2147 std::string()); // original_headers | |
|
davidben
2015/11/23 23:40:42
Please leave at least a TODO, preferably a bug, th
Adam Rice
2015/11/25 19:39:40
Done.
| |
| 2093 // Request takes ownership. | 2148 // Request takes ownership. |
| 2094 extra_info->AssociateWithRequest(new_request.get()); | 2149 extra_info->AssociateWithRequest(new_request.get()); |
| 2095 | 2150 |
| 2096 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2151 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 2097 // Hang on to a reference to ensure the blob is not released prior | 2152 // Hang on to a reference to ensure the blob is not released prior |
| 2098 // to the job being started. | 2153 // to the job being started. |
| 2099 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2154 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 2100 new_request.get(), | 2155 new_request.get(), |
| 2101 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2156 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
| 2102 } | 2157 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2120 handler = AddStandardHandlers(new_request.get(), resource_type, | 2175 handler = AddStandardHandlers(new_request.get(), resource_type, |
| 2121 resource_context, | 2176 resource_context, |
| 2122 nullptr, // appcache_service | 2177 nullptr, // appcache_service |
| 2123 -1, // child_id | 2178 -1, // child_id |
| 2124 -1, // route_id | 2179 -1, // route_id |
| 2125 handler.Pass()); | 2180 handler.Pass()); |
| 2126 | 2181 |
| 2127 BeginRequestInternal(new_request.Pass(), handler.Pass()); | 2182 BeginRequestInternal(new_request.Pass(), handler.Pass()); |
| 2128 } | 2183 } |
| 2129 | 2184 |
| 2185 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { | |
| 2186 if (!async_revalidation_manager_) | |
| 2187 async_revalidation_manager_.reset(new AsyncRevalidationManager); | |
| 2188 } | |
| 2189 | |
| 2130 // static | 2190 // static |
| 2131 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 2191 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
| 2132 net::URLRequest* request) { | 2192 net::URLRequest* request) { |
| 2133 // The following fields should be a minor size contribution (experimentally | 2193 // The following fields should be a minor size contribution (experimentally |
| 2134 // on the order of 100). However since they are variable length, it could | 2194 // on the order of 100). However since they are variable length, it could |
| 2135 // in theory be a sizeable contribution. | 2195 // in theory be a sizeable contribution. |
| 2136 int strings_cost = request->extra_request_headers().ToString().size() + | 2196 int strings_cost = request->extra_request_headers().ToString().size() + |
| 2137 request->original_url().spec().size() + | 2197 request->original_url().spec().size() + |
| 2138 request->referrer().size() + | 2198 request->referrer().size() + |
| 2139 request->method().size(); | 2199 request->method().size(); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2442 load_flags |= net::LOAD_PREFETCH; | 2502 load_flags |= net::LOAD_PREFETCH; |
| 2443 } | 2503 } |
| 2444 | 2504 |
| 2445 if (is_sync_load) | 2505 if (is_sync_load) |
| 2446 load_flags |= net::LOAD_IGNORE_LIMITS; | 2506 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2447 | 2507 |
| 2448 return load_flags; | 2508 return load_flags; |
| 2449 } | 2509 } |
| 2450 | 2510 |
| 2451 } // namespace content | 2511 } // namespace content |
| OLD | NEW |