| 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 3d526c9b05fb7057ccd68a405db3bca390ba4f5b..6436b7981e460fbaf43dc9bd8021384418c7259e 100644
|
| --- a/content/browser/appcache/appcache_url_loader_job.h
|
| +++ b/content/browser/appcache/appcache_url_loader_job.h
|
| @@ -6,9 +6,19 @@
|
| #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_JOB_H_
|
|
|
| #include "base/logging.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/strings/string16.h"
|
| +#include "base/time/time.h"
|
| +#include "content/browser/appcache/appcache_entry.h"
|
| #include "content/browser/appcache/appcache_job.h"
|
| +#include "content/browser/appcache/appcache_response.h"
|
| +#include "content/browser/appcache/appcache_storage.h"
|
| #include "content/common/content_export.h"
|
| +#include "content/common/resource_request.h"
|
| +
|
| +namespace net {
|
| +class IOBuffer;
|
| +} // namespace net
|
|
|
| namespace content {
|
|
|
| @@ -18,18 +28,31 @@ class AppCacheStorage;
|
|
|
| // AppCacheJob wrapper for a mojom::URLLoader implementation which returns
|
| // responses stored in the AppCache.
|
| -class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob {
|
| +class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
|
| + public AppCacheStorage::Delegate {
|
| public:
|
| + class Delegate {
|
| + public:
|
| + // Generally called when we don't have an AppCache response for the
|
| + // ongoing request.
|
| + virtual void SendNetworkResponse() {}
|
| +
|
| + // Called when we want to send out an error response to the client.
|
| + virtual void SendErrorResponse() {}
|
| +
|
| + // Called when we have a valid response from the AppCache.
|
| + virtual void HandleAppCacheResponseStart(
|
| + AppCacheResponseInfo* response_info) {}
|
| +
|
| + // Called when we have valid AppCache data to send to the client.
|
| + virtual void HandleAppCacheData(net::IOBuffer* buffer, int buffer_fsize) {}
|
| + };
|
| +
|
| ~AppCacheURLLoaderJob() override;
|
|
|
| // AppCacheJob overrides.
|
| void Kill() override;
|
| bool IsStarted() const override;
|
| - bool IsWaiting() const override;
|
| - bool IsDeliveringAppCacheResponse() const override;
|
| - bool IsDeliveringNetworkResponse() const override;
|
| - bool IsDeliveringErrorResponse() const override;
|
| - bool IsCacheEntryNotFound() const override;
|
| void DeliverAppCachedResponse(const GURL& manifest_url,
|
| int64_t cache_id,
|
| const AppCacheEntry& entry,
|
| @@ -37,14 +60,56 @@ class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob {
|
| void DeliverNetworkResponse() override;
|
| void DeliverErrorResponse() override;
|
| const GURL& GetURL() const override;
|
| + AppCacheURLLoaderJob* AsURLLoaderJob() override;
|
| +
|
| + void set_delegate(Delegate* delegate) { delegate_ = delegate; }
|
|
|
| protected:
|
| // AppCacheJob::Create() creates this instance.
|
| friend class AppCacheJob;
|
|
|
| - AppCacheURLLoaderJob();
|
| + AppCacheURLLoaderJob(const ResourceRequest& request,
|
| + AppCacheStorage* storage);
|
| +
|
| + // AppCacheStorage::Delegate methods
|
| + void OnResponseInfoLoaded(AppCacheResponseInfo* response_info,
|
| + int64_t response_id) override;
|
| + void OnCacheLoaded(AppCache* cache, int64_t cache_id) override;
|
| +
|
| + // AppCacheResponseReader completion callback
|
| + void OnReadComplete(int result);
|
| +
|
| + // The current request.
|
| + ResourceRequest request_;
|
| +
|
| + // The delegate is invoked when we have data to report from the AppCache,
|
| + // or if the request is to be sent directly to the n/w, etc.
|
| + Delegate* delegate_;
|
| +
|
| + AppCacheStorage* storage_;
|
| +
|
| + // The response details.
|
| + scoped_refptr<AppCacheResponseInfo> info_;
|
| +
|
| + // Used to read the cache.
|
| + std::unique_ptr<AppCacheResponseReader> reader_;
|
| +
|
| + // Time when the request started.
|
| + base::TimeTicks start_time_tick_;
|
| +
|
| + // The AppCache manifest URL.
|
| + GURL manifest_url_;
|
| +
|
| + // The AppCache id.
|
| + int64_t cache_id_;
|
| +
|
| + AppCacheEntry entry_;
|
| +
|
| + // Set to true if we are loading fallback content.
|
| + bool is_fallback_;
|
|
|
| - GURL url_;
|
| + // The buffer used to read AppCache data.
|
| + scoped_refptr<net::IOBuffer> buffer_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderJob);
|
| };
|
|
|