diff options
author | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-10 04:30:02 +0000 |
---|---|---|
committer | asanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-10 04:30:02 +0000 |
commit | 17b674e0f0410a51f1742d75eae413d38e858780 (patch) | |
tree | 97cec613051e3e6a11db1932a44fc91630dd8f36 /content/browser/loader/resource_handler.h | |
parent | 32295330ea418782c7331c69e97fcc75a123cd4b (diff) | |
download | chromium_src-17b674e0f0410a51f1742d75eae413d38e858780.zip chromium_src-17b674e0f0410a51f1742d75eae413d38e858780.tar.gz chromium_src-17b674e0f0410a51f1742d75eae413d38e858780.tar.bz2 |
Avoid issuing a Read() after draining a request.
A URLRequest can signal the end of a stream by calling OnReadCompleted()
with a byte count of zero. No further reads should be issued after this.
However, ResourceLoader could issue a second Read() if the
ResourceHandler::OnReadCompleted() handler sets defer to true. I.e.
When a read completes:
URLRequest calls
-> ResourceLoader::OnReadCompleted(request, 0)
-> ResourceHandler::OnReadCompleted(id, 0, &defer)
(ResourceHandler sets defer to true)
Prior to this CL, the behavior on resumption was:
ResourceHandler calls
-> ResourceLoader::Resume()
-> ResourceLoader::ResumeReading()
-> ResourceLoader::StartReading()
-> ResourceLoader::ReadMore()
-> URLRequest::Read()
The new behavior is:
ResourceHandler calls
-> ResourceLoader::Resume()
-> ResourceLoader::ResponseCompleted()
The new behavior is parallel to what happens if the ResourceHandler
didn't defer.
BUG=320394
Review URL: https://codereview.chromium.org/267563004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/resource_handler.h')
-rw-r--r-- | content/browser/loader/resource_handler.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/content/browser/loader/resource_handler.h b/content/browser/loader/resource_handler.h index 0b942bb..ded3a35 100644 --- a/content/browser/loader/resource_handler.h +++ b/content/browser/loader/resource_handler.h @@ -97,7 +97,8 @@ class CONTENT_EXPORT ResourceHandler // Data (*bytes_read bytes) was written into the buffer provided by // OnWillRead. A return value of false cancels the request, true continues // reading data. Set |*defer| to true to defer reading more response data. - // Call controller()->Resume() to continue reading response data. + // Call controller()->Resume() to continue reading response data. A zero + // |bytes_read| signals that no further data is available. virtual bool OnReadCompleted(int request_id, int bytes_read, bool* defer) = 0; |