Chromium Code Reviews| Index: net/quic/chromium/bidirectional_stream_quic_impl.cc |
| diff --git a/net/quic/chromium/bidirectional_stream_quic_impl.cc b/net/quic/chromium/bidirectional_stream_quic_impl.cc |
| index a21f4251bd9e390a4291fadb8b98f6a4c93aacc6..607bd3be095ca892b57b747c49c147d4303fab79 100644 |
| --- a/net/quic/chromium/bidirectional_stream_quic_impl.cc |
| +++ b/net/quic/chromium/bidirectional_stream_quic_impl.cc |
| @@ -232,15 +232,6 @@ bool BidirectionalStreamQuicImpl::GetLoadTimingInfo( |
| return true; |
| } |
| -void BidirectionalStreamQuicImpl::OnTrailingHeadersAvailable( |
| - const SpdyHeaderBlock& headers, |
| - size_t frame_len) { |
| - headers_bytes_received_ += frame_len; |
| - if (delegate_) |
| - delegate_->OnTrailersReceived(headers); |
| - // |this| can be destroyed after this point. |
| -} |
| - |
| void BidirectionalStreamQuicImpl::OnClose() { |
| DCHECK(stream_); |
| @@ -310,6 +301,32 @@ void BidirectionalStreamQuicImpl::OnReadInitialHeadersComplete(int rv) { |
| connect_timing_ = session_->GetConnectTiming(); |
| if (delegate_) |
| delegate_->OnHeadersReceived(initial_headers_); |
| + base::ThreadTaskRunnerHandle::Get()->PostTask( |
| + FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::ReadTrailingHeaders, |
| + weak_factory_.GetWeakPtr())); |
|
xunjieli
2017/05/26 15:53:05
Should we post this task before calling into the |
Ryan Hamilton
2017/05/26 22:35:50
Indeed! I noticed this in a followup, but forgot t
|
| +} |
| + |
| +void BidirectionalStreamQuicImpl::ReadTrailingHeaders() { |
| + int rv = stream_->ReadTrailingHeaders( |
| + &trailing_headers_, |
| + base::Bind(&BidirectionalStreamQuicImpl::OnReadTrailingHeadersComplete, |
| + weak_factory_.GetWeakPtr())); |
| + |
| + if (rv != ERR_IO_PENDING) |
| + OnReadTrailingHeadersComplete(rv); |
| +} |
| + |
| +void BidirectionalStreamQuicImpl::OnReadTrailingHeadersComplete(int rv) { |
| + DCHECK_NE(ERR_IO_PENDING, rv); |
| + if (rv < 0) { |
| + NotifyError(rv); |
| + return; |
| + } |
| + |
| + headers_bytes_received_ += rv; |
| + |
| + if (delegate_) |
| + delegate_->OnTrailersReceived(trailing_headers_); |
| } |
| void BidirectionalStreamQuicImpl::OnReadDataComplete(int rv) { |