diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 10:15:17 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 10:15:17 +0000 |
commit | 5b76814bebad53ca9e1adab0ae5cc36f351ace42 (patch) | |
tree | df7731e315de587515a487638e8f9a6d0946682a /net/http/http_stream_parser.cc | |
parent | 9b5dc52f6ae610f987a2989a8bbf006143870b24 (diff) | |
download | chromium_src-5b76814bebad53ca9e1adab0ae5cc36f351ace42.zip chromium_src-5b76814bebad53ca9e1adab0ae5cc36f351ace42.tar.gz chromium_src-5b76814bebad53ca9e1adab0ae5cc36f351ace42.tar.bz2 |
net: Make UploadDataStream::Read() asynchronous
Rename existing Read() to ReadSync()
Change type of |buf| from char* to scoped_refptr<IOBuffer> so that async operation is always performed safely
Add an asynchronous implementation, Read()
The newly added Read() is not used yet, all users still use the old version ReadSync()
BUG=72001
TEST=net_unittests
Review URL: https://chromiumcodereview.appspot.com/10910268
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162343 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_parser.cc')
-rw-r--r-- | net/http/http_stream_parser.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 3f538eb9..84a160c 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -260,7 +260,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line, size_t todo = request_body_->size(); while (todo) { - int consumed = request_body_->Read(request_headers_, todo); + int consumed = request_body_->ReadSync(request_headers_, todo); DCHECK_GT(consumed, 0); // Read() won't fail if not chunked. request_headers_->DidConsume(consumed); todo -= consumed; @@ -490,7 +490,7 @@ int HttpStreamParser::DoSendChunkedBody(int result) { return OK; } - const int consumed = request_body_->Read(chunk_buf_, chunk_buf_->size()); + const int consumed = request_body_->ReadSync(chunk_buf_, chunk_buf_->size()); if (consumed == 0) { // Reached the end. DCHECK(request_body_->IsEOF()); request_body_buf_->Clear(); @@ -534,8 +534,8 @@ int HttpStreamParser::DoSendNonChunkedBody(int result) { } request_body_buf_->Clear(); - const int consumed = request_body_->Read(request_body_buf_, - request_body_buf_->capacity()); + const int consumed = request_body_->ReadSync(request_body_buf_, + request_body_buf_->capacity()); if (consumed == 0) { // Reached the end. io_state_ = STATE_REQUEST_SENT; } else if (consumed > 0) { |