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

Unified Diff: net/http/http_network_transaction.cc

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months 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
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_transaction.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.cc
===================================================================
--- net/http/http_network_transaction.cc (revision 8565)
+++ net/http/http_network_transaction.cc (working copy)
@@ -52,7 +52,6 @@
header_buf_http_offset_(-1),
content_length_(-1), // -1 means unspecified.
content_read_(0),
- read_buf_(NULL),
read_buf_len_(0),
next_state_(STATE_NONE) {
#if defined(OS_WIN)
@@ -134,7 +133,7 @@
ResetStateForRestart();
}
-int HttpNetworkTransaction::Read(char* buf, int buf_len,
+int HttpNetworkTransaction::Read(IOBuffer* buf, int buf_len,
CompletionCallback* callback) {
DCHECK(response_.headers);
DCHECK(buf);
@@ -726,7 +725,7 @@
// We may have some data remaining in the header buffer.
if (header_buf_.get() && header_buf_body_offset_ < header_buf_len_) {
int n = std::min(read_buf_len_, header_buf_len_ - header_buf_body_offset_);
- memcpy(read_buf_, header_buf_.get() + header_buf_body_offset_, n);
+ memcpy(read_buf_->data(), header_buf_.get() + header_buf_body_offset_, n);
header_buf_body_offset_ += n;
if (header_buf_body_offset_ == header_buf_len_) {
header_buf_.reset();
@@ -737,7 +736,8 @@
return n;
}
- return connection_.socket()->Read(read_buf_, read_buf_len_, &io_callback_);
+ return connection_.socket()->Read(read_buf_->data(), read_buf_len_,
+ &io_callback_);
}
int HttpNetworkTransaction::DoReadBodyComplete(int result) {
@@ -747,7 +747,7 @@
// Filter incoming data if appropriate. FilterBuf may return an error.
if (result > 0 && chunked_decoder_.get()) {
- result = chunked_decoder_->FilterBuf(read_buf_, result);
+ result = chunked_decoder_->FilterBuf(read_buf_->data(), result);
if (result == 0 && !chunked_decoder_->reached_eof()) {
// Don't signal completion of the Read call yet or else it'll look like
// we received end-of-file. Wait for more data.
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698