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

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

Issue 1459333002: Revert "Reland: URLRequestJob: change ReadRawData contract" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 e614912282b17827bba311030e8adab313b1ebc0..92272399b820393fe46a6f121caf4010e4692e2b 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
@@ -64,7 +64,6 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
// net::URLRequestJob overrides
void Start() override;
- void StartAsync();
void Kill() override;
net::LoadState GetLoadState() const override;
bool GetCharset(std::string* charset) override;
@@ -72,7 +71,7 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
void GetResponseInfo(net::HttpResponseInfo* info) override;
int GetResponseCode() const override;
void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
- int ReadRawData(net::IOBuffer* buf, int buf_size) override;
+ bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override;
const net::HttpResponseInfo* http_info() const;
@@ -110,22 +109,18 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
bool CheckPathRestriction(net::URLRequest* request);
// Writes network data back to the script cache if needed, and notifies the
- // script cache of fetch completion at EOF. This function returns
- // net::IO_PENDING if the IO is to be completed asynchronously, returns a
- // negative number that represents a corresponding net error code (other than
- // net::IO_PENDING) if an error occurred, or returns a non-negative number
- // that represents the number of network bytes read. If the return value is
- // non-negative, all of the data in |io_buffer_| has been written back to the
- // script cache if necessary.
- int HandleNetData(int bytes_read);
-
- void NotifyStartErrorHelper(const net::URLRequestStatus& status,
- const std::string& status_message);
-
- // Returns an error code that is passed in through |status| or a new one if an
- // additional error is found.
- net::Error NotifyFinishedCaching(net::URLRequestStatus status,
- const std::string& status_message);
+ // script cache of fetch completion at EOF. This function might need to do
+ // asynchronous IO; if so, it signals this through setting the URLRequestJob's
+ // status to IO_PENDING. After this function returns, if the URLRequestJob
+ // isn't IO_PENDING, all of the data in |io_buffer_| has been written back to
+ // the script cache if necessary.
+ void HandleNetData(int bytes_read);
+
+ void NotifyDoneHelper(const net::URLRequestStatus& status,
+ const std::string& status_message);
+
+ void NotifyFinishedCaching(net::URLRequestStatus status,
+ const std::string& status_message);
scoped_ptr<ServiceWorkerResponseReader> CreateCacheResponseReader();
scoped_ptr<ServiceWorkerResponseWriter> CreateCacheResponseWriter();
@@ -145,7 +140,6 @@ class CONTENT_EXPORT ServiceWorkerWriteToCacheJob
bool has_been_killed_;
bool did_notify_started_;
bool did_notify_finished_;
-
base::WeakPtrFactory<ServiceWorkerWriteToCacheJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerWriteToCacheJob);

Powered by Google App Engine
This is Rietveld 408576698