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

Unified Diff: content/browser/appcache/appcache_url_loader_job.h

Issue 2956373002: Add support for subresource request loads in AppCache for the network service. (Closed)
Patch Set: Moved the SubresourceLoadInfo structure to the appcache_url_loader_job.h/.cc files. Created 3 years, 6 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/appcache/appcache_url_loader_job.h
diff --git a/content/browser/appcache/appcache_url_loader_job.h b/content/browser/appcache/appcache_url_loader_job.h
index 8d16a2473b036237f6b4f4a31786a4ae3c9524a3..613e198295cf0df5b1f7097a27f7f13c08a21b7c 100644
--- a/content/browser/appcache/appcache_url_loader_job.h
+++ b/content/browser/appcache/appcache_url_loader_job.h
@@ -12,12 +12,14 @@
#include "base/time/time.h"
#include "content/browser/appcache/appcache_entry.h"
#include "content/browser/appcache/appcache_job.h"
+#include "content/browser/appcache/appcache_request_handler.h"
#include "content/browser/appcache/appcache_response.h"
#include "content/browser/appcache/appcache_storage.h"
#include "content/browser/loader/url_loader_request_handler.h"
#include "content/common/content_export.h"
#include "content/common/resource_request.h"
#include "content/common/url_loader.mojom.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/system/data_pipe.h"
@@ -25,6 +27,23 @@ namespace content {
class AppCacheRequest;
class NetToMojoPendingBuffer;
+class URLLoaderFactoryGetter;
+struct SubresourceLoadInfo;
+
+// Holds information about the subresource load request like the routing id,
+// request id, the client pointer, etc.
+struct SubresourceLoadInfo {
+ SubresourceLoadInfo();
+ ~SubresourceLoadInfo();
+
+ mojom::URLLoaderAssociatedRequest url_loader_request;
+ int32_t routing_id;
+ int32_t request_id;
+ uint32_t options;
+ ResourceRequest request;
+ mojom::URLLoaderClientPtr client;
+ net::MutableNetworkTrafficAnnotationTag traffic_annotation;
+};
// AppCacheJob wrapper for a mojom::URLLoader implementation which returns
// responses stored in the AppCache.
@@ -58,6 +77,18 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
loader_callback_ = std::move(callback);
}
+ // Subresource request load information is passed in the
+ // |subresource_load_info| parameter. This includes the request id, the
+ // client pointer, etc.
+ // |handler| points to the AppCacheRequestHandler instance handling this
+ // request. The job controls the lifetime of the handler.
+ // |default_url_loader| is used to retrieve the network loader for requests
+ // intended to be sent to the network.
+ void SetSubresourceLoadInfo(
+ std::unique_ptr<SubresourceLoadInfo> subresource_load_info,
+ AppCacheRequestHandler* handler,
+ URLLoaderFactoryGetter* default_url_loader);
+
protected:
// AppCacheJob::Create() creates this instance.
friend class AppCacheJob;
@@ -126,6 +157,27 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
// the request can be serviced via the AppCache.
LoaderCallback loader_callback_;
+ // We own the AppCacheRequestHandler instance for subresource requests.
+ std::unique_ptr<AppCacheRequestHandler> handler_;
+
+ scoped_refptr<URLLoaderFactoryGetter> default_url_loader_factory_getter_;
+
+ // Holds subresource url loader information.
+ std::unique_ptr<SubresourceLoadInfo> subresource_load_info_;
+
+ // Timing information for the most recent request. Its start times are
+ // populated in DeliverAppCachedResponse().
+ net::LoadTimingInfo load_timing_info_;
+
+ // Used for subresource requests which go to the network.
+ mojom::URLLoaderAssociatedPtr network_loader_request_;
+
+ // Binds the subresource URLLoaderClient with us. We can use the regular
+ // binding_ member above when we remove the need for the associated requests
+ // issue with URLLoaderFactory.
+ std::unique_ptr<mojo::AssociatedBinding<mojom::URLLoader>>
+ associated_binding_;
+
DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderJob);
};

Powered by Google App Engine
This is Rietveld 408576698