summaryrefslogtreecommitdiffstats
path: root/net/http/http_stream.h
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.h
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.h')
-rw-r--r--net/http/http_stream.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/http/http_stream.h b/net/http/http_stream.h
index e52b957..c343b2d 100644
--- a/net/http/http_stream.h
+++ b/net/http/http_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -17,6 +17,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
@@ -46,10 +47,9 @@ class NET_EXPORT_PRIVATE HttpStream {
// Writes the headers and uploads body data to the underlying socket.
// ERR_IO_PENDING is returned if the operation could not be completed
// synchronously, in which case the result will be passed to the callback
- // when available. Returns OK on success. The HttpStream takes ownership
- // of the request_body.
+ // when available. Returns OK on success.
virtual int SendRequest(const HttpRequestHeaders& request_headers,
- UploadDataStream* request_body,
+ scoped_ptr<UploadDataStream> request_body,
HttpResponseInfo* response,
const CompletionCallback& callback) = 0;