summaryrefslogtreecommitdiffstats
path: root/net/http/http_stream_parser.cc
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 19:55:23 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 19:55:23 +0000
commit5f9205f215b19ab7ee4842fdc9820743b1061de6 (patch)
treec1a0b69293d43c0e47c722409dcc6a23ac47ec14 /net/http/http_stream_parser.cc
parent4e402ec675af5dcff41e206ff9d0d985aceaab07 (diff)
downloadchromium_src-5f9205f215b19ab7ee4842fdc9820743b1061de6.zip
chromium_src-5f9205f215b19ab7ee4842fdc9820743b1061de6.tar.gz
chromium_src-5f9205f215b19ab7ee4842fdc9820743b1061de6.tar.bz2
Make HttpStream take a scoped_ptr<UploadDataStream>, to clearly communicate transfer of ownership
HttpStream assumes ownership of the passed in UploadDataStream when SendRequest is called. However, there existed a few call sites where the passed in UploadDataStream may have been leaked, primarily during error handling. Using scoped_ptr<> & Pass() provide clear API-level contracts as to the ownership of pointers. BUG=none TEST=existing R=willchan@chromium.org Review URL: https://chromiumcodereview.appspot.com/10539137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_parser.cc')
-rw-r--r--net/http/http_stream_parser.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 92f62d3..d368f90 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -189,7 +189,7 @@ HttpStreamParser::~HttpStreamParser() {
int HttpStreamParser::SendRequest(const std::string& request_line,
const HttpRequestHeaders& headers,
- UploadDataStream* request_body,
+ scoped_ptr<UploadDataStream> request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) {
DCHECK_EQ(STATE_NONE, io_state_);
@@ -216,7 +216,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
response_->socket_address = HostPortPair::FromIPEndPoint(ip_endpoint);
std::string request = request_line + headers.ToString();
- request_body_.reset(request_body);
+ request_body_.reset(request_body.release());
if (request_body_ != NULL) {
request_body_buf_ = new SeekableIOBuffer(kRequestBodyBufferSize);
if (request_body_->is_chunked()) {
@@ -234,7 +234,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
// single write.
bool did_merge = false;
if (ShouldMergeRequestHeadersAndBody(request, request_body_.get())) {
- size_t merged_size = request.size() + request_body->size();
+ size_t merged_size = request.size() + request_body_->size();
scoped_refptr<IOBuffer> merged_request_headers_and_body(
new IOBuffer(merged_size));
// We'll repurpose |request_headers_| to store the merged headers and