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

Side by Side Diff: net/http/http_basic_state.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_state.h ('k') | net/http/http_basic_state_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_state.h" 5 #include "net/http/http_basic_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/http/http_request_info.h" 11 #include "net/http/http_request_info.h"
12 #include "net/http/http_response_body_drainer.h" 12 #include "net/http/http_response_body_drainer.h"
13 #include "net/http/http_stream_parser.h" 13 #include "net/http/http_stream_parser.h"
14 #include "net/http/http_util.h" 14 #include "net/http/http_util.h"
15 #include "net/socket/client_socket_handle.h" 15 #include "net/socket/client_socket_handle.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 HttpBasicState::HttpBasicState(ClientSocketHandle* connection, bool using_proxy) 20 HttpBasicState::HttpBasicState(std::unique_ptr<ClientSocketHandle> connection,
21 bool using_proxy)
21 : read_buf_(new GrowableIOBuffer()), 22 : read_buf_(new GrowableIOBuffer()),
22 connection_(connection), 23 connection_(std::move(connection)),
23 using_proxy_(using_proxy), 24 using_proxy_(using_proxy),
24 request_info_(NULL) {} 25 request_info_(NULL) {}
25 26
26 HttpBasicState::~HttpBasicState() {} 27 HttpBasicState::~HttpBasicState() {}
27 28
28 int HttpBasicState::Initialize(const HttpRequestInfo* request_info, 29 int HttpBasicState::Initialize(const HttpRequestInfo* request_info,
29 RequestPriority priority, 30 RequestPriority priority,
30 const BoundNetLog& net_log, 31 const BoundNetLog& net_log,
31 const CompletionCallback& callback) { 32 const CompletionCallback& callback) {
32 DCHECK(!parser_.get()); 33 DCHECK(!parser_.get());
(...skipping 27 matching lines...) Expand all
60 request_line.reserve(expected_size); 61 request_line.reserve(expected_size);
61 request_line.append(request_info_->method); 62 request_line.append(request_info_->method);
62 request_line.append(1, ' '); 63 request_line.append(1, ' ');
63 request_line.append(path); 64 request_line.append(path);
64 request_line.append(kSuffix, kSuffixLen); 65 request_line.append(kSuffix, kSuffixLen);
65 DCHECK_EQ(expected_size, request_line.size()); 66 DCHECK_EQ(expected_size, request_line.size());
66 return request_line; 67 return request_line;
67 } 68 }
68 69
69 } // namespace net 70 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_basic_state.h ('k') | net/http/http_basic_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698