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

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

Issue 2974733002: Add support for subresource request fallback in AppCache for the network service.. (Closed)
Patch Set: Close the network service binding handle when we are delivering a fallback Created 3 years, 5 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 59f620358389a313326dc7a1f09a7413e72402ce..b84324a37d721c346412d2d83e26f9fb7715bd19 100644
--- a/content/browser/appcache/appcache_url_loader_job.h
+++ b/content/browser/appcache/appcache_url_loader_job.h
@@ -26,9 +26,9 @@
namespace content {
class AppCacheRequest;
+class AppCacheURLLoaderRequest;
class NetToMojoPendingBuffer;
class URLLoaderFactoryGetter;
-struct SubresourceLoadInfo;
// Holds information about the subresource load request like the routing id,
// request id, the client pointer, etc.
@@ -49,7 +49,8 @@ struct SubresourceLoadInfo {
// responses stored in the AppCache.
class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
public AppCacheStorage::Delegate,
- public mojom::URLLoader {
+ public mojom::URLLoader,
+ public mojom::URLLoaderClient {
public:
~AppCacheURLLoaderJob() override;
@@ -73,6 +74,25 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
+ // mojom::URLLoaderClient implementation.
+ // These methods are called by the network loader for subresource requests
+ // which go to the network. We serve fallback content in these methods
+ // if applicable.
+ void OnReceiveResponse(const ResourceResponseHead& response_head,
+ const base::Optional<net::SSLInfo>& ssl_info,
+ mojom::DownloadedTempFilePtr downloaded_file) override;
+ void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
+ const ResourceResponseHead& response_head) override;
+ void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override;
+ void OnUploadProgress(int64_t current_position,
+ int64_t total_size,
+ OnUploadProgressCallback ack_callback) override;
+ void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override;
+ void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
+ void OnStartLoadingResponseBody(
+ mojo::ScopedDataPipeConsumerHandle body) override;
+ void OnComplete(const ResourceRequestCompletionStatus& status) override;
+
void set_main_resource_loader_callback(LoaderCallback callback) {
main_resource_loader_callback_ = std::move(callback);
}
@@ -97,6 +117,7 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
friend class AppCacheJob;
AppCacheURLLoaderJob(const ResourceRequest& request,
+ AppCacheURLLoaderRequest* url_loader_request,
AppCacheStorage* storage);
// AppCacheStorage::Delegate methods
@@ -120,6 +141,11 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
// Notifies the client about request completion.
void NotifyCompleted(int error_code);
+ // Creates the URLLoaderClient proxy. Used to setup the proxy URLLoaderClient
+ // which enables us to inspect responses coming back from the network service
+ // for AppCache fallback.
+ mojom::URLLoaderClientPtr CreateLoaderClientProxy();
+
// The current request.
ResourceRequest request_;
@@ -181,6 +207,13 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
std::unique_ptr<mojo::AssociatedBinding<mojom::URLLoader>>
associated_binding_;
+ // Proxy URLLoaderClient binding for subresource requests.
+ mojo::Binding<mojom::URLLoaderClient> loader_client_proxy_binding_;
michaeln 2017/07/18 19:19:22 naming: network_loader_client_binding_
ananta 2017/07/18 19:52:40 Done.
+
+ // The AppCacheURLLoaderRequest instance. We use this to set the response
+ // info when we receive it.
+ AppCacheURLLoaderRequest* url_loader_request_instance_;
michaeln 2017/07/18 19:19:22 naming: appcache_request_
ananta 2017/07/18 19:52:40 Done.
+
DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderJob);
};

Powered by Google App Engine
This is Rietveld 408576698