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

Unified Diff: net/http/http_network_transaction.h

Issue 87073: Extend the use of IOBuffers to the code underneath... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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/base/tcp_client_socket_win.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.h
===================================================================
--- net/http/http_network_transaction.h (revision 14682)
+++ net/http/http_network_transaction.h (working copy)
@@ -55,6 +55,38 @@
private:
FRIEND_TEST(HttpNetworkTransactionTest, ResetStateForRestart);
+ // This version of IOBuffer lets us use a string as the real storage and
+ // "move" the data pointer inside the string before using it to do actual IO.
+ class RequestHeaders : public net::IOBuffer {
+ public:
+ RequestHeaders() : net::IOBuffer() {}
+ ~RequestHeaders() { data_ = NULL; }
+
+ void SetDataOffset(size_t offset) {
+ data_ = const_cast<char*>(headers_.data()) + offset;
+ }
+
+ // This is intentionally a public member.
+ std::string headers_;
+ };
+
+ // This version of IOBuffer lets us use a malloc'ed buffer as the real storage
+ // and "move" the data pointer inside the buffer before using it to do actual
+ // IO.
+ class ResponseHeaders : public net::IOBuffer {
+ public:
+ ResponseHeaders() : net::IOBuffer() {}
+ ~ResponseHeaders() { data_ = NULL; }
+
+ void set_data(size_t offset) { data_ = headers_.get() + offset; }
+ char* headers() { return headers_.get(); }
+ void Reset() { headers_.reset(); }
+ void Realloc(size_t new_size);
+
+ private:
+ scoped_ptr_malloc<char> headers_;
+ };
+
void BuildRequestHeaders();
void BuildTunnelRequest();
void DoCallback(int result);
@@ -272,15 +304,16 @@
SSLConfig ssl_config_;
- std::string request_headers_;
+ scoped_refptr<RequestHeaders> request_headers_;
size_t request_headers_bytes_sent_;
scoped_ptr<UploadDataStream> request_body_stream_;
+ scoped_refptr<IOBuffer> write_buffer_;
// The read buffer may be larger than it is full. The 'capacity' indicates
// the allocation size of the buffer, and the 'len' indicates how much data
// is in the buffer already. The 'body offset' indicates the offset of the
// start of the response body within the read buffer.
- scoped_ptr_malloc<char> header_buf_;
+ scoped_refptr<ResponseHeaders> header_buf_;
int header_buf_capacity_;
int header_buf_len_;
int header_buf_body_offset_;
« no previous file with comments | « net/base/tcp_client_socket_win.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698