Chromium Code Reviews| Index: net/http/bidirectional_stream.cc |
| diff --git a/net/http/bidirectional_stream.cc b/net/http/bidirectional_stream.cc |
| index 8b83c1e93515f06efaa4db3b5aaca903b35ec1ca..546e3651a7e7583fd99a64569ecce2f4de2df427 100644 |
| --- a/net/http/bidirectional_stream.cc |
| +++ b/net/http/bidirectional_stream.cc |
| @@ -59,32 +59,31 @@ std::unique_ptr<base::Value> NetLogCallback(const GURL* url, |
| BidirectionalStream::Delegate::Delegate() {} |
| -void BidirectionalStream::Delegate::OnStreamReady() {} |
| - |
| BidirectionalStream::Delegate::~Delegate() {} |
| BidirectionalStream::BidirectionalStream( |
| std::unique_ptr<BidirectionalStreamRequestInfo> request_info, |
| HttpNetworkSession* session, |
| - bool disable_auto_flush, |
| + bool send_request_headers_automatically, |
| Delegate* delegate) |
| : BidirectionalStream(std::move(request_info), |
| session, |
| - disable_auto_flush, |
| + send_request_headers_automatically, |
| delegate, |
| base::WrapUnique(new base::Timer(false, false))) {} |
| BidirectionalStream::BidirectionalStream( |
| std::unique_ptr<BidirectionalStreamRequestInfo> request_info, |
| HttpNetworkSession* session, |
| - bool disable_auto_flush, |
| + bool send_request_headers_automatically, |
| Delegate* delegate, |
| std::unique_ptr<base::Timer> timer) |
| : request_info_(std::move(request_info)), |
| net_log_(BoundNetLog::Make(session->net_log(), |
| NetLog::SOURCE_BIDIRECTIONAL_STREAM)), |
| session_(session), |
| - disable_auto_flush_(disable_auto_flush), |
| + send_request_headers_automatically_(send_request_headers_automatically), |
| + request_headers_sent_(false), |
| delegate_(delegate), |
| timer_(std::move(timer)) { |
| DCHECK(delegate_); |
| @@ -131,6 +130,13 @@ BidirectionalStream::~BidirectionalStream() { |
| } |
| } |
| +void BidirectionalStream::SendRequestHeaders() { |
| + DCHECK(stream_impl_); |
| + DCHECK(!request_headers_sent_); |
|
mef
2016/06/01 21:33:21
add DCHECK(!send_request_headers_automatically_);
xunjieli
2016/06/01 22:27:16
Done.
|
| + |
| + stream_impl_->SendRequestHeaders(); |
| +} |
| + |
| int BidirectionalStream::ReadData(IOBuffer* buf, int buf_len) { |
| DCHECK(stream_impl_); |
| @@ -202,8 +208,9 @@ int64_t BidirectionalStream::GetTotalSentBytes() const { |
| return stream_impl_->GetTotalSentBytes(); |
| } |
| -void BidirectionalStream::OnStreamReady() { |
| - delegate_->OnStreamReady(); |
| +void BidirectionalStream::OnStreamReady(bool request_headers_sent) { |
| + request_headers_sent_ = request_headers_sent; |
| + delegate_->OnStreamReady(request_headers_sent); |
| } |
| void BidirectionalStream::OnHeadersReceived( |
| @@ -278,7 +285,8 @@ void BidirectionalStream::OnBidirectionalStreamImplReady( |
| stream_request_.reset(); |
| stream_impl_.reset(stream); |
| - stream_impl_->Start(request_info_.get(), net_log_, disable_auto_flush_, this, |
| + stream_impl_->Start(request_info_.get(), net_log_, |
| + send_request_headers_automatically_, this, |
| std::move(timer_)); |
| } |