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..d7ea502709cfebbcc07536d13c23b72f4c0cdc1b 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* appcache_request, |
AppCacheStorage* storage); |
// AppCacheStorage::Delegate methods |
@@ -120,6 +141,10 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob, |
// Notifies the client about request completion. |
void NotifyCompleted(int error_code); |
+ // Disconnects the mojo pipe to the network loader and releases related |
+ // resources. |
+ void DisconnectFromNetworkLoader(); |
+ |
// The current request. |
ResourceRequest request_; |
@@ -147,7 +172,7 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob, |
// The URLLoaderClient pointer. We call this interface with notifications |
// about the URL load |
- mojom::URLLoaderClientPtr client_info_; |
+ mojom::URLLoaderClientPtr client_; |
// mojo data pipe entities. |
mojo::ScopedDataPipeProducerHandle response_body_stream_; |
@@ -173,7 +198,7 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob, |
net::LoadTimingInfo load_timing_info_; |
// Used for subresource requests which go to the network. |
- mojom::URLLoaderAssociatedPtr network_loader_request_; |
+ mojom::URLLoaderAssociatedPtr network_loader_; |
// Binds the subresource URLLoaderClient with us. We can use the regular |
// binding_ member above when we remove the need for the associated requests |
@@ -181,6 +206,13 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob, |
std::unique_ptr<mojo::AssociatedBinding<mojom::URLLoader>> |
associated_binding_; |
+ // Network URLLoaderClient binding for subresource requests. |
+ mojo::Binding<mojom::URLLoaderClient> network_loader_client_binding_; |
+ |
+ // The AppCacheURLLoaderRequest instance. We use this to set the response |
+ // info when we receive it. |
+ AppCacheURLLoaderRequest* appcache_request_; |
+ |
DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderJob); |
}; |