Index: content/browser/service_worker/service_worker_write_to_cache_job.h |
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.h b/content/browser/service_worker/service_worker_write_to_cache_job.h |
index 38b040d3168ea09c4ba714b6bbd441f766249e94..5102b3454727491910e24e992fab91febece5c04 100644 |
--- a/content/browser/service_worker/service_worker_write_to_cache_job.h |
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.h |
@@ -14,13 +14,14 @@ |
#include "content/common/service_worker/service_worker_status_code.h" |
#include "content/common/service_worker/service_worker_types.h" |
#include "content/public/common/resource_type.h" |
+#include "net/base/net_errors.h" |
#include "net/url_request/url_request.h" |
#include "net/url_request/url_request_job.h" |
namespace content { |
+class ServiceWorkerCacheWriter; |
class ServiceWorkerContextCore; |
-class ServiceWorkerResponseWriter; |
class ServiceWorkerVersions; |
// A URLRequestJob derivative used to cache the main script |
@@ -57,10 +58,6 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob |
UpdateAfter24Hours); |
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
UpdateForceBypassCache); |
- class NetDataConsumer; |
- class PassThroughConsumer; |
- class Comparer; |
- class Copier; |
~ServiceWorkerWriteToCacheJob() override; |
@@ -85,14 +82,12 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob |
int buf_size, |
int* bytes_read); |
- void CommitHeadersAndNotifyHeadersComplete(); |
- void WriteHeaders(const base::Closure& callback); |
- void OnWriteHeadersComplete(const base::Closure& callback, int result); |
- void WriteData(net::IOBuffer* buf, |
- int amount_to_write, |
- const base::Callback<void(int result)>& callback); |
- void OnWriteDataComplete(const base::Callback<void(int result)>& callback, |
- int result); |
+ // Callbacks for writing headers and data via |cache_writer_|. Note that since |
+ // the MaybeWriteHeaders and MaybeWriteData methods on |cache_writer_| are |
+ // guaranteed not to do short writes, these functions only receive a |
+ // net::Error indicating success or failure, not a count of bytes written. |
+ void OnWriteHeadersComplete(net::Error error); |
+ void OnWriteDataComplete(net::Error error); |
// net::URLRequest::Delegate overrides that observe the net request. |
void OnReceivedRedirect(net::URLRequest* request, |
@@ -112,12 +107,6 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob |
bool CheckPathRestriction(net::URLRequest* request); |
- void SetPendingIO(); |
- void ClearPendingIO(); |
- void OnPassThroughComplete(); |
- void OnCompareComplete(int bytes_matched, bool is_equal); |
- void CopyIncumbent(int bytes_to_copy); |
- void OnCopyComplete(ServiceWorkerStatusCode status); |
void HandleNetData(int bytes_read); |
void AsyncNotifyDoneHelper(const net::URLRequestStatus& status, |
@@ -126,6 +115,9 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob |
void NotifyFinishedCaching(net::URLRequestStatus status, |
const std::string& status_message); |
+ scoped_ptr<ServiceWorkerResponseReader> CreateCacheResponseReader(); |
+ scoped_ptr<ServiceWorkerResponseWriter> CreateCacheResponseWriter(); |
+ |
ResourceType resource_type_; // Differentiate main script and imports |
scoped_refptr<net::IOBuffer> io_buffer_; |
int io_buffer_bytes_; |
@@ -137,7 +129,7 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob |
scoped_ptr<net::HttpResponseInfo> http_info_; |
scoped_ptr<ServiceWorkerResponseWriter> writer_; |
scoped_refptr<ServiceWorkerVersion> version_; |
- scoped_ptr<NetDataConsumer> consumer_; |
+ scoped_ptr<ServiceWorkerCacheWriter> cache_writer_; |
bool has_been_killed_; |
bool did_notify_started_; |
bool did_notify_finished_; |