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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2764683002: Remove stale-while-revalidate from content and chrome (Closed)
Patch Set: rebase Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 2aaa3bec6b342f9e99ea7525a11fed06d65535b5..e0fcc55c9c3b460696efda865e7d0a56dbeddfdb 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -44,7 +44,6 @@
#include "content/browser/frame_host/navigation_request_info.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/loader/async_resource_handler.h"
-#include "content/browser/loader/async_revalidation_manager.h"
#include "content/browser/loader/detachable_resource_handler.h"
#include "content/browser/loader/intercepting_resource_handler.h"
#include "content/browser/loader/loader_delegate.h"
@@ -446,17 +445,6 @@ ResourceDispatcherHostImpl::ResourceDispatcherHostImpl(
base::Unretained(this)));
update_load_states_timer_.reset(new base::RepeatingTimer());
-
- // stale-while-revalidate currently doesn't work with browser-side navigation.
- // Only enable stale-while-revalidate if browser navigation is not enabled.
- //
- // TODO(ricea): Make stale-while-revalidate and browser-side navigation work
- // together. Or disable stale-while-revalidate completely before browser-side
- // navigation becomes the default. crbug.com/561610
- if (!IsBrowserSideNavigationEnabled() &&
- base::FeatureList::IsEnabled(features::kStaleWhileRevalidate)) {
- async_revalidation_manager_.reset(new AsyncRevalidationManager);
- }
}
ResourceDispatcherHostImpl::ResourceDispatcherHostImpl()
@@ -588,13 +576,6 @@ void ResourceDispatcherHostImpl::CancelRequestsForContext(
#endif
loaders_to_cancel.clear();
-
- if (async_revalidation_manager_) {
- // Cancelling async revalidations should not result in the creation of new
- // requests. Do it before the CHECKs to ensure this does not happen.
- async_revalidation_manager_->CancelAsyncRevalidationsForResourceContext(
- context);
- }
}
void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest(
@@ -737,28 +718,6 @@ void ResourceDispatcherHostImpl::DidReceiveRedirect(
new_url, loader->request(), info->GetContext(), response);
}
- net::URLRequest* request = loader->request();
- if (request->response_info().async_revalidation_required) {
- // Async revalidation is only supported for the first redirect leg.
- DCHECK_EQ(request->url_chain().size(), 1u);
- DCHECK(async_revalidation_manager_);
-
- async_revalidation_manager_->BeginAsyncRevalidation(request,
- scheduler_.get());
- }
-
- // Remove the LOAD_SUPPORT_ASYNC_REVALIDATION flag if it is present.
- // It is difficult to create a URLRequest with the correct flags and headers
- // for redirect legs other than the first one. Since stale-while-revalidate in
- // combination with redirects isn't needed for experimental use, punt on it
- // for now.
- // TODO(ricea): Fix this before launching the feature.
- if (request->load_flags() & net::LOAD_SUPPORT_ASYNC_REVALIDATION) {
- int new_load_flags =
- request->load_flags() & ~net::LOAD_SUPPORT_ASYNC_REVALIDATION;
- request->SetLoadFlags(new_load_flags);
- }
-
// Don't notify WebContents observers for requests known to be
// downloads; they aren't really associated with the Webcontents.
// Note that not all downloads are known before content sniffing.
@@ -766,6 +725,7 @@ void ResourceDispatcherHostImpl::DidReceiveRedirect(
return;
// Notify the observers on the UI thread.
+ net::URLRequest* request = loader->request();
std::unique_ptr<ResourceRedirectDetails> detail(new ResourceRedirectDetails(
loader->request(),
!!request->ssl_info().cert,
@@ -786,12 +746,6 @@ void ResourceDispatcherHostImpl::DidReceiveResponse(
info->GetChildID(), info->GetRouteID());
}
- if (request->response_info().async_revalidation_required) {
- DCHECK(async_revalidation_manager_);
- async_revalidation_manager_->BeginAsyncRevalidation(request,
- scheduler_.get());
- }
-
ProcessRequestForLinkHeaders(request);
if (delegate_)
@@ -1487,13 +1441,6 @@ void ResourceDispatcherHostImpl::ContinuePendingBeginRequest(
load_flags |= net::LOAD_DO_NOT_USE_EMBEDDED_IDENTITY;
}
- bool support_async_revalidation =
- !is_sync_load && async_revalidation_manager_ &&
- AsyncRevalidationManager::QualifiesForAsyncRevalidation(request_data);
-
- if (support_async_revalidation)
- load_flags |= net::LOAD_SUPPORT_ASYNC_REVALIDATION;
-
// Sync loads should have maximum priority and should be the only
// requets that have the ignore limits flag set.
if (is_sync_load) {
@@ -1522,7 +1469,6 @@ void ResourceDispatcherHostImpl::ContinuePendingBeginRequest(
GetPreviewsState(request_data.previews_state, delegate_, *new_request,
resource_context,
request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME),
- support_async_revalidation ? request_data.headers : std::string(),
request_data.request_body, request_data.initiated_in_secure_context);
// Request takes ownership.
extra_info->AssociateWithRequest(new_request.get());
@@ -1836,7 +1782,6 @@ ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo(
false, // report_raw_headers
true, // is_async
previews_state, // previews_state
- std::string(), // original_headers
nullptr, // body
false); // initiated_in_secure_context
}
@@ -2203,12 +2148,6 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
true, // is_async
GetPreviewsState(info.common_params.previews_state, delegate_,
*new_request, resource_context, info.is_main_frame),
- // The original_headers field is for stale-while-revalidate but the
- // feature doesn't work with PlzNavigate, so it's just a placeholder
- // here.
- // TODO(ricea): Make the feature work with stale-while-revalidate
- // and clean this up.
- std::string(), // original_headers
info.common_params.post_data,
// TODO(mek): Currently initiated_in_secure_context is only used for
// subresource requests, so it doesn't matter what value it gets here.
@@ -2262,11 +2201,6 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
BeginRequestInternal(std::move(new_request), std::move(handler));
}
-void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
- if (!async_revalidation_manager_)
- async_revalidation_manager_.reset(new AsyncRevalidationManager);
-}
-
void ResourceDispatcherHostImpl::SetLoaderDelegate(
LoaderDelegate* loader_delegate) {
loader_delegate_ = loader_delegate;
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_request_info_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698