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

Unified Diff: content/browser/net/url_request_slow_download_job.h

Issue 8468028: Restructure URLRequestSlowDownloadJob to avoid races. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge up to LKGR. Created 9 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/net/url_request_slow_download_job.h
diff --git a/content/browser/net/url_request_slow_download_job.h b/content/browser/net/url_request_slow_download_job.h
index 5e70fb82808a9987f31973ba679c2c4a6c9473ed..6d5b66410c4b064362e8a77dd4374d9d2ed1bd3f 100644
--- a/content/browser/net/url_request_slow_download_job.h
+++ b/content/browser/net/url_request_slow_download_job.h
@@ -53,6 +53,25 @@ class URLRequestSlowDownloadJob : public net::URLRequestJob {
explicit URLRequestSlowDownloadJob(net::URLRequest* request);
virtual ~URLRequestSlowDownloadJob();
+ // Enum indicating where we are in the read after a call to
+ // FillBufferHelper.
+ enum ReadStatus {
+ // The buffer was filled with data and may be returned.
+ BUFFER_FILLED,
+
+ // No data was added to the buffer because kFinishDownloadUrl has
+ // not yet been seen and we've already returned the first chunk.
+ REQUEST_BLOCKED,
+
+ // No data was added to the buffer because we've already returned
+ // all the data.
+ REQUEST_COMPLETE
+ };
+ ReadStatus FillBufferHelper(
+ net::IOBuffer* buf,
+ int buf_size,
+ int* bytes_written);
+
void GetResponseInfoConst(net::HttpResponseInfo* info) const;
// Mark all pending requests to be finished. We keep track of pending
@@ -67,7 +86,7 @@ class URLRequestSlowDownloadJob : public net::URLRequestJob {
void set_should_finish_download() { should_finish_download_ = true; }
- int first_download_size_remaining_;
+ int bytes_already_sent_;
bool should_finish_download_;
scoped_refptr<net::IOBuffer> buffer_;
int buffer_size_;

Powered by Google App Engine
This is Rietveld 408576698