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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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_pipelined_stream.h" 5 #include "net/http/http_pipelined_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/http/http_pipelined_connection_impl.h" 10 #include "net/http/http_pipelined_connection_impl.h"
11 #include "net/http/http_request_headers.h" 11 #include "net/http/http_request_headers.h"
12 #include "net/http/http_request_info.h" 12 #include "net/http/http_request_info.h"
13 #include "net/http/http_util.h" 13 #include "net/http/http_util.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 HttpPipelinedStream::HttpPipelinedStream(HttpPipelinedConnectionImpl* pipeline, 17 HttpPipelinedStream::HttpPipelinedStream(HttpPipelinedConnectionImpl* pipeline,
18 int pipeline_id) 18 int pipeline_id)
19 : pipeline_(pipeline), 19 : pipeline_(pipeline), pipeline_id_(pipeline_id), request_info_(NULL) {
20 pipeline_id_(pipeline_id),
21 request_info_(NULL) {
22 } 20 }
23 21
24 HttpPipelinedStream::~HttpPipelinedStream() { 22 HttpPipelinedStream::~HttpPipelinedStream() {
25 pipeline_->OnStreamDeleted(pipeline_id_); 23 pipeline_->OnStreamDeleted(pipeline_id_);
26 } 24 }
27 25
28 int HttpPipelinedStream::InitializeStream( 26 int HttpPipelinedStream::InitializeStream(const HttpRequestInfo* request_info,
29 const HttpRequestInfo* request_info, 27 RequestPriority priority,
30 RequestPriority priority, 28 const BoundNetLog& net_log,
31 const BoundNetLog& net_log, 29 const CompletionCallback& callback) {
32 const CompletionCallback& callback) {
33 request_info_ = request_info; 30 request_info_ = request_info;
34 pipeline_->InitializeParser(pipeline_id_, request_info, net_log); 31 pipeline_->InitializeParser(pipeline_id_, request_info, net_log);
35 return OK; 32 return OK;
36 } 33 }
37 34
38
39 int HttpPipelinedStream::SendRequest(const HttpRequestHeaders& headers, 35 int HttpPipelinedStream::SendRequest(const HttpRequestHeaders& headers,
40 HttpResponseInfo* response, 36 HttpResponseInfo* response,
41 const CompletionCallback& callback) { 37 const CompletionCallback& callback) {
42 CHECK(pipeline_id_); 38 CHECK(pipeline_id_);
43 CHECK(request_info_); 39 CHECK(request_info_);
44 // TODO(simonjam): Proxy support will be needed here. 40 // TODO(simonjam): Proxy support will be needed here.
45 const std::string path = HttpUtil::PathForRequest(request_info_->url); 41 const std::string path = HttpUtil::PathForRequest(request_info_->url);
46 std::string request_line_ = base::StringPrintf("%s %s HTTP/1.1\r\n", 42 std::string request_line_ = base::StringPrintf(
47 request_info_->method.c_str(), 43 "%s %s HTTP/1.1\r\n", request_info_->method.c_str(), path.c_str());
48 path.c_str()); 44 return pipeline_->SendRequest(
49 return pipeline_->SendRequest(pipeline_id_, request_line_, headers, response, 45 pipeline_id_, request_line_, headers, response, callback);
50 callback);
51 } 46 }
52 47
53 UploadProgress HttpPipelinedStream::GetUploadProgress() const { 48 UploadProgress HttpPipelinedStream::GetUploadProgress() const {
54 return pipeline_->GetUploadProgress(pipeline_id_); 49 return pipeline_->GetUploadProgress(pipeline_id_);
55 } 50 }
56 51
57 int HttpPipelinedStream::ReadResponseHeaders( 52 int HttpPipelinedStream::ReadResponseHeaders(
58 const CompletionCallback& callback) { 53 const CompletionCallback& callback) {
59 return pipeline_->ReadResponseHeaders(pipeline_id_, callback); 54 return pipeline_->ReadResponseHeaders(pipeline_id_, callback);
60 } 55 }
61 56
62 const HttpResponseInfo* HttpPipelinedStream::GetResponseInfo() const { 57 const HttpResponseInfo* HttpPipelinedStream::GetResponseInfo() const {
63 return pipeline_->GetResponseInfo(pipeline_id_); 58 return pipeline_->GetResponseInfo(pipeline_id_);
64 } 59 }
65 60
66 int HttpPipelinedStream::ReadResponseBody(IOBuffer* buf, int buf_len, 61 int HttpPipelinedStream::ReadResponseBody(IOBuffer* buf,
62 int buf_len,
67 const CompletionCallback& callback) { 63 const CompletionCallback& callback) {
68 return pipeline_->ReadResponseBody(pipeline_id_, buf, buf_len, callback); 64 return pipeline_->ReadResponseBody(pipeline_id_, buf, buf_len, callback);
69 } 65 }
70 66
71 void HttpPipelinedStream::Close(bool not_reusable) { 67 void HttpPipelinedStream::Close(bool not_reusable) {
72 pipeline_->Close(pipeline_id_, not_reusable); 68 pipeline_->Close(pipeline_id_, not_reusable);
73 } 69 }
74 70
75 HttpStream* HttpPipelinedStream::RenewStreamForAuth() { 71 HttpStream* HttpPipelinedStream::RenewStreamForAuth() {
76 if (pipeline_->usable()) { 72 if (pipeline_->usable()) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 140
145 bool HttpPipelinedStream::was_npn_negotiated() const { 141 bool HttpPipelinedStream::was_npn_negotiated() const {
146 return pipeline_->was_npn_negotiated(); 142 return pipeline_->was_npn_negotiated();
147 } 143 }
148 144
149 NextProto HttpPipelinedStream::protocol_negotiated() const { 145 NextProto HttpPipelinedStream::protocol_negotiated() const {
150 return pipeline_->protocol_negotiated(); 146 return pipeline_->protocol_negotiated();
151 } 147 }
152 148
153 } // namespace net 149 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698