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

Unified Diff: content/browser/service_worker/service_worker_write_to_cache_job.h

Issue 1315443003: ServiceWorkerWriteToCacheJob: refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Second round Created 5 years, 4 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/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..104da86548ea117108ff2204dab9074f1d2683a4 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,11 +14,13 @@
#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;
Randy Smith (Not in Mondays) 2015/09/01 20:35:42 This doesn't look necessary to me, since it's decl
Elly Fong-Jones 2015/09/09 13:36:09 Done.
class ServiceWorkerVersions;
@@ -57,10 +59,6 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
UpdateAfter24Hours);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest,
UpdateForceBypassCache);
- class NetDataConsumer;
- class PassThroughConsumer;
- class Comparer;
- class Copier;
~ServiceWorkerWriteToCacheJob() override;
@@ -85,14 +83,8 @@ 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);
+ void OnWriteHeadersComplete(net::Error error);
Randy Smith (Not in Mondays) 2015/09/01 20:35:42 I know it's in the private section, and hence part
Elly Fong-Jones 2015/09/09 13:36:09 Done.
+ void OnWriteDataComplete(net::Error error);
// net::URLRequest::Delegate overrides that observe the net request.
void OnReceivedRedirect(net::URLRequest* request,
@@ -112,12 +104,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 +112,9 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
void NotifyFinishedCaching(net::URLRequestStatus status,
const std::string& status_message);
+ scoped_ptr<ServiceWorkerResponseReader> CreateResponseReader();
Randy Smith (Not in Mondays) 2015/09/01 20:35:42 nit, suggestion: Given that the response reader an
Elly Fong-Jones 2015/09/09 13:36:08 Done.
+ scoped_ptr<ServiceWorkerResponseWriter> CreateResponseWriter();
+
ResourceType resource_type_; // Differentiate main script and imports
scoped_refptr<net::IOBuffer> io_buffer_;
int io_buffer_bytes_;
@@ -137,7 +126,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_;

Powered by Google App Engine
This is Rietveld 408576698