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

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

Issue 2227083002: Remove net::BidirectionalStream::Cancel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo 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/bidirectional_stream.h ('k') | net/http/bidirectional_stream_impl.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bidirectional_stream.h" 5 #include "net/http/bidirectional_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 http_request_info, request_info_->priority, server_ssl_config, 119 http_request_info, request_info_->priority, server_ssl_config,
120 server_ssl_config, this, net_log_)); 120 server_ssl_config, this, net_log_));
121 // Check that this call cannot fail to set a non-NULL |stream_request_|. 121 // Check that this call cannot fail to set a non-NULL |stream_request_|.
122 DCHECK(stream_request_); 122 DCHECK(stream_request_);
123 // Check that HttpStreamFactory does not invoke OnBidirectionalStreamImplReady 123 // Check that HttpStreamFactory does not invoke OnBidirectionalStreamImplReady
124 // synchronously. 124 // synchronously.
125 DCHECK(!stream_impl_); 125 DCHECK(!stream_impl_);
126 } 126 }
127 127
128 BidirectionalStream::~BidirectionalStream() { 128 BidirectionalStream::~BidirectionalStream() {
129 Cancel();
130 if (net_log_.IsCapturing()) { 129 if (net_log_.IsCapturing()) {
131 net_log_.EndEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_ALIVE); 130 net_log_.EndEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_ALIVE);
132 } 131 }
133 } 132 }
134 133
135 void BidirectionalStream::SendRequestHeaders() { 134 void BidirectionalStream::SendRequestHeaders() {
136 DCHECK(stream_impl_); 135 DCHECK(stream_impl_);
137 DCHECK(!request_headers_sent_); 136 DCHECK(!request_headers_sent_);
138 DCHECK(!send_request_headers_automatically_); 137 DCHECK(!send_request_headers_automatically_);
139 138
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_SENDV_DATA, 185 net_log_.AddEvent(NetLog::TYPE_BIDIRECTIONAL_STREAM_SENDV_DATA,
187 NetLog::IntCallback("num_buffers", buffers.size())); 186 NetLog::IntCallback("num_buffers", buffers.size()));
188 } 187 }
189 stream_impl_->SendvData(buffers, lengths, end_stream); 188 stream_impl_->SendvData(buffers, lengths, end_stream);
190 for (size_t i = 0; i < buffers.size(); ++i) { 189 for (size_t i = 0; i < buffers.size(); ++i) {
191 write_buffer_list_.push_back(buffers[i]); 190 write_buffer_list_.push_back(buffers[i]);
192 write_buffer_len_list_.push_back(lengths[i]); 191 write_buffer_len_list_.push_back(lengths[i]);
193 } 192 }
194 } 193 }
195 194
196 void BidirectionalStream::Cancel() {
197 stream_request_.reset();
198 if (stream_impl_) {
199 stream_impl_->Cancel();
200 stream_impl_.reset();
201 }
202 }
203
204 NextProto BidirectionalStream::GetProtocol() const { 195 NextProto BidirectionalStream::GetProtocol() const {
205 if (!stream_impl_) 196 if (!stream_impl_)
206 return kProtoUnknown; 197 return kProtoUnknown;
207 198
208 return stream_impl_->GetProtocol(); 199 return stream_impl_->GetProtocol();
209 } 200 }
210 201
211 int64_t BidirectionalStream::GetTotalReceivedBytes() const { 202 int64_t BidirectionalStream::GetTotalReceivedBytes() const {
212 if (!stream_impl_) 203 if (!stream_impl_)
213 return 0; 204 return 0;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 NotifyFailed(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); 366 NotifyFailed(ERR_HTTPS_PROXY_TUNNEL_RESPONSE);
376 } 367 }
377 368
378 void BidirectionalStream::OnQuicBroken() {} 369 void BidirectionalStream::OnQuicBroken() {}
379 370
380 void BidirectionalStream::NotifyFailed(int error) { 371 void BidirectionalStream::NotifyFailed(int error) {
381 delegate_->OnFailed(error); 372 delegate_->OnFailed(error);
382 } 373 }
383 374
384 } // namespace net 375 } // namespace net
OLDNEW
« no previous file with comments | « net/http/bidirectional_stream.h ('k') | net/http/bidirectional_stream_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698