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

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

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: Workaround iwyu bug in prerender_resource Created 5 years, 4 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.h
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h
index 4951416730339897670b865961385f478e516c08..2def36031fa8cffe077c609bea46dd80c0cb2e8c 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -25,6 +25,7 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "content/browser/download/download_resource_handler.h"
+#include "content/browser/loader/async_revalidation_driver.h"
#include "content/browser/loader/global_routing_id.h"
#include "content/browser/loader/resource_loader.h"
#include "content/browser/loader/resource_loader_delegate.h"
@@ -51,10 +52,12 @@ class FilePath;
}
namespace net {
+class URLRequestContext;
class URLRequestJobFactory;
}
namespace storage {
+class BlobStorageContext;
class ShareableFileReference;
}
@@ -304,9 +307,28 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
uint64 upload_size;
};
+ // Request parameters that are not included in ResourceHostMsg_Request. Used
+ // as an argument to ConstructRequest();
+ struct ExtraRequestParams {
+ ExtraRequestParams();
+
+ storage::BlobStorageContext* blob_context;
+ int child_id;
+ bool is_sync_load;
+ bool use_embedded_identity;
+ bool support_async_revalidation;
+ const net::HttpRequestHeaders* extra_headers;
+ };
+
// Map from ProcessID+RouteID pair to the "most interesting" LoadState.
typedef std::map<GlobalRoutingID, LoadInfo> LoadInfoMap;
+ // Map from ResourceContext, HttpCache and url key to AsyncRevalidationDriver
+ // object.
+ typedef std::map<AsyncRevalidationKey,
+ AsyncRevalidationDriver*,
+ AsyncRevalidationKey::LessThan> AsyncRevalidationMap;
+
// ResourceLoaderDelegate implementation:
ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
ResourceLoader* loader,
@@ -435,6 +457,11 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
IPC::Message* sync_result, // only valid for sync
int route_id); // only valid for async
+ scoped_ptr<net::URLRequest> ConstructRequest(
+ net::URLRequestContext* request_context,
+ const ResourceHostMsg_Request& request_data,
+ const ExtraRequestParams& extra_params);
+
// Creates a ResourceHandler to be used by BeginRequest() for normal resource
// loading.
scoped_ptr<ResourceHandler> CreateResourceHandler(
@@ -507,6 +534,11 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
int child_id,
bool is_sync_load);
+ void BeginAsyncRevalidation(net::URLRequest* for_request);
+ void OnAsyncRevalidationComplete(const AsyncRevalidationKey& key);
+ void CancelAsyncRevalidationsForResourceContext(
+ ResourceContext* resource_context);
+
LoaderMap pending_loaders_;
// Collection of temp files downloaded for child processes via
@@ -585,6 +617,14 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
bool allow_cross_origin_auth_prompt_;
+ // stale-while-revalidate is enabled either via experiment or command-line
+ // flag.
+ bool async_revalidation_enabled_;
+
+ // Async revalidations that are currently in-flight: either waiting to be
+ // scheduled or active on the network.
+ AsyncRevalidationMap in_progress_async_revalidations_;
+
// http://crbug.com/90971 - Assists in tracking down use-after-frees on
// shutdown.
std::set<const ResourceContext*> active_resource_contexts_;

Powered by Google App Engine
This is Rietveld 408576698