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

Side by Side Diff: net/http/http_basic_stream.cc

Issue 2255883002: Pass ClientSocketHandle ownership around in unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « net/http/http_basic_stream.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_basic_stream.h" 5 #include "net/http/http_basic_stream.h"
6 6
7 #include <memory> 7 #include <utility>
8 8
9 #include "net/http/http_request_info.h" 9 #include "net/http/http_request_info.h"
10 #include "net/http/http_response_body_drainer.h" 10 #include "net/http/http_response_body_drainer.h"
11 #include "net/http/http_stream_parser.h" 11 #include "net/http/http_stream_parser.h"
12 #include "net/socket/client_socket_handle.h" 12 #include "net/socket/client_socket_handle.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 HttpBasicStream::HttpBasicStream(ClientSocketHandle* connection, 16 HttpBasicStream::HttpBasicStream(std::unique_ptr<ClientSocketHandle> connection,
17 bool using_proxy) 17 bool using_proxy)
18 : state_(connection, using_proxy) {} 18 : state_(std::move(connection), using_proxy) {}
19 19
20 HttpBasicStream::~HttpBasicStream() {} 20 HttpBasicStream::~HttpBasicStream() {}
21 21
22 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, 22 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info,
23 RequestPriority priority, 23 RequestPriority priority,
24 const BoundNetLog& net_log, 24 const BoundNetLog& net_log,
25 const CompletionCallback& callback) { 25 const CompletionCallback& callback) {
26 state_.Initialize(request_info, priority, net_log, callback); 26 state_.Initialize(request_info, priority, net_log, callback);
27 return OK; 27 return OK;
28 } 28 }
(...skipping 24 matching lines...) Expand all
53 parser()->Close(not_reusable); 53 parser()->Close(not_reusable);
54 } 54 }
55 55
56 HttpStream* HttpBasicStream::RenewStreamForAuth() { 56 HttpStream* HttpBasicStream::RenewStreamForAuth() {
57 DCHECK(IsResponseBodyComplete()); 57 DCHECK(IsResponseBodyComplete());
58 DCHECK(!parser()->IsMoreDataBuffered()); 58 DCHECK(!parser()->IsMoreDataBuffered());
59 // The HttpStreamParser object still has a pointer to the connection. Just to 59 // The HttpStreamParser object still has a pointer to the connection. Just to
60 // be extra-sure it doesn't touch the connection again, delete it here rather 60 // be extra-sure it doesn't touch the connection again, delete it here rather
61 // than leaving it until the destructor is called. 61 // than leaving it until the destructor is called.
62 state_.DeleteParser(); 62 state_.DeleteParser();
63 return new HttpBasicStream(state_.ReleaseConnection().release(), 63 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy());
64 state_.using_proxy());
65 } 64 }
66 65
67 bool HttpBasicStream::IsResponseBodyComplete() const { 66 bool HttpBasicStream::IsResponseBodyComplete() const {
68 return parser()->IsResponseBodyComplete(); 67 return parser()->IsResponseBodyComplete();
69 } 68 }
70 69
71 bool HttpBasicStream::IsConnectionReused() const { 70 bool HttpBasicStream::IsConnectionReused() const {
72 return parser()->IsConnectionReused(); 71 return parser()->IsConnectionReused();
73 } 72 }
74 73
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // like the right version should be reported, if headers were received. 127 // like the right version should be reported, if headers were received.
129 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1; 128 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1;
130 return; 129 return;
131 } 130 }
132 131
133 void HttpBasicStream::SetPriority(RequestPriority priority) { 132 void HttpBasicStream::SetPriority(RequestPriority priority) {
134 // TODO(akalin): Plumb this through to |connection_|. 133 // TODO(akalin): Plumb this through to |connection_|.
135 } 134 }
136 135
137 } // namespace net 136 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_basic_stream.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698