summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 00:15:01 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 00:15:01 +0000
commitaf5a855591d424eb992f8888c514b779b966185d (patch)
tree632248f9b2573a7ed60613168b1169d6e3d44b52
parent0e181ca63e2dad0ffa9b74ffca5cc9426112f73f (diff)
downloadchromium_src-af5a855591d424eb992f8888c514b779b966185d.zip
chromium_src-af5a855591d424eb992f8888c514b779b966185d.tar.gz
chromium_src-af5a855591d424eb992f8888c514b779b966185d.tar.bz2
Fix ReadRawData to make the job state match the return value.
The comment for ReadRawData reads: // If returning true, data was read from the job. buf will contain // the data, and bytes_read will receive the number of bytes read. ... // If returning false, an error occurred or an async IO is now pending. // If async IO is pending, the status of the request will be // URLRequestStatus::IO_PENDING, and buf must remain available until the // operation is completed. See comments on URLRequest::Read for more info. I interpret this to mean that an implementer should never set status to IO_PENDING and return true, but that's what the slow download job does: ... SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); DCHECK(!is_done()); return true; ... Unfortunately this class is part of the Download UI tests which are already flaky/broken so it's not possible to verify that this change doesn't further break those tests. But the current implementation is clearly broken and should be fixed. BUG=50399 TEST=ran ui_tests, verified no additional breakage Review URL: http://codereview.chromium.org/3052016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53876 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/net/url_request_slow_download_job.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/chrome/browser/net/url_request_slow_download_job.cc b/chrome/browser/net/url_request_slow_download_job.cc
index 93768ec..138a57c 100644
--- a/chrome/browser/net/url_request_slow_download_job.cc
+++ b/chrome/browser/net/url_request_slow_download_job.cc
@@ -100,7 +100,6 @@ bool URLRequestSlowDownloadJob::ReadRawData(net::IOBuffer* buf, int buf_size,
*bytes_read = send_size;
first_download_size_remaining_ -= send_size;
- SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
DCHECK(!is_done());
return true;
}
@@ -112,6 +111,7 @@ bool URLRequestSlowDownloadJob::ReadRawData(net::IOBuffer* buf, int buf_size,
// If we make it here, the first chunk has been sent and we need to wait
// until a request is made for kFinishDownloadUrl.
+ SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(
this, &URLRequestSlowDownloadJob::CheckDoneStatus), 100);
AddRef();