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

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

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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_auth_handler_negotiate.h ('k') | net/http/http_cache.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>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
9 #include "net/http/http_request_info.h" 11 #include "net/http/http_request_info.h"
10 #include "net/http/http_response_body_drainer.h" 12 #include "net/http/http_response_body_drainer.h"
11 #include "net/http/http_stream_parser.h" 13 #include "net/http/http_stream_parser.h"
12 #include "net/http/http_util.h" 14 #include "net/http/http_util.h"
13 #include "net/socket/client_socket_handle.h" 15 #include "net/socket/client_socket_handle.h"
14 #include "url/gurl.h" 16 #include "url/gurl.h"
15 17
16 namespace net { 18 namespace net {
(...skipping 11 matching lines...) Expand all
28 const BoundNetLog& net_log, 30 const BoundNetLog& net_log,
29 const CompletionCallback& callback) { 31 const CompletionCallback& callback) {
30 DCHECK(!parser_.get()); 32 DCHECK(!parser_.get());
31 request_info_ = request_info; 33 request_info_ = request_info;
32 parser_.reset(new HttpStreamParser( 34 parser_.reset(new HttpStreamParser(
33 connection_.get(), request_info, read_buf_.get(), net_log)); 35 connection_.get(), request_info, read_buf_.get(), net_log));
34 return OK; 36 return OK;
35 } 37 }
36 38
37 scoped_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() { 39 scoped_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() {
38 return connection_.Pass(); 40 return std::move(connection_);
39 } 41 }
40 42
41 scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const { 43 scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const {
42 return read_buf_; 44 return read_buf_;
43 } 45 }
44 46
45 void HttpBasicState::DeleteParser() { parser_.reset(); } 47 void HttpBasicState::DeleteParser() { parser_.reset(); }
46 48
47 std::string HttpBasicState::GenerateRequestLine() const { 49 std::string HttpBasicState::GenerateRequestLine() const {
48 static const char kSuffix[] = " HTTP/1.1\r\n"; 50 static const char kSuffix[] = " HTTP/1.1\r\n";
49 const size_t kSuffixLen = arraysize(kSuffix) - 1; 51 const size_t kSuffixLen = arraysize(kSuffix) - 1;
50 DCHECK(request_info_); 52 DCHECK(request_info_);
51 const GURL& url = request_info_->url; 53 const GURL& url = request_info_->url;
52 const std::string path = 54 const std::string path =
53 using_proxy_ ? HttpUtil::SpecForRequest(url) : url.PathForRequest(); 55 using_proxy_ ? HttpUtil::SpecForRequest(url) : url.PathForRequest();
54 // Don't use StringPrintf for concatenation because it is very inefficient. 56 // Don't use StringPrintf for concatenation because it is very inefficient.
55 std::string request_line; 57 std::string request_line;
56 const size_t expected_size = request_info_->method.size() + 1 + path.size() + 58 const size_t expected_size = request_info_->method.size() + 1 + path.size() +
57 kSuffixLen; 59 kSuffixLen;
58 request_line.reserve(expected_size); 60 request_line.reserve(expected_size);
59 request_line.append(request_info_->method); 61 request_line.append(request_info_->method);
60 request_line.append(1, ' '); 62 request_line.append(1, ' ');
61 request_line.append(path); 63 request_line.append(path);
62 request_line.append(kSuffix, kSuffixLen); 64 request_line.append(kSuffix, kSuffixLen);
63 DCHECK_EQ(expected_size, request_line.size()); 65 DCHECK_EQ(expected_size, request_line.size());
64 return request_line; 66 return request_line;
65 } 67 }
66 68
67 } // namespace net 69 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_negotiate.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698