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

Side by Side Diff: net/quic/chromium/bidirectional_stream_quic_impl.cc

Issue 2409273002: QuicChromiumClientStream handle Read() after trailers are received but not yet delivered (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | net/quic/chromium/bidirectional_stream_quic_impl_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/quic/chromium/bidirectional_stream_quic_impl.h" 5 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 const SpdyHeaderBlock& headers, 234 const SpdyHeaderBlock& headers,
235 size_t frame_len) { 235 size_t frame_len) {
236 headers_bytes_received_ += frame_len; 236 headers_bytes_received_ += frame_len;
237 negotiated_protocol_ = kProtoQUIC1SPDY3; 237 negotiated_protocol_ = kProtoQUIC1SPDY3;
238 if (!has_received_headers_) { 238 if (!has_received_headers_) {
239 has_received_headers_ = true; 239 has_received_headers_ = true;
240 connect_timing_ = session_->GetConnectTiming(); 240 connect_timing_ = session_->GetConnectTiming();
241 if (delegate_) 241 if (delegate_)
242 delegate_->OnHeadersReceived(headers); 242 delegate_->OnHeadersReceived(headers);
243 } else { 243 } else {
244 if (stream_->IsDoneReading()) { 244 if (delegate_)
245 // If the write side is closed, OnFinRead() will call 245 delegate_->OnTrailersReceived(headers);
246 // BidirectionalStreamQuicImpl::OnClose().
247 stream_->OnFinRead();
248 }
249 if (!delegate_)
250 return;
251 // Complete any remaining read. The task is posted because
252 // |delegate_|->OnTrailersReceived() might destroy |this|.
253 base::ThreadTaskRunnerHandle::Get()->PostTask(
254 FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::OnDataAvailable,
255 weak_factory_.GetWeakPtr()));
256 delegate_->OnTrailersReceived(headers);
257 // |this| can be destroyed after this point. 246 // |this| can be destroyed after this point.
258 } 247 }
259 } 248 }
260 249
261 void BidirectionalStreamQuicImpl::OnDataAvailable() { 250 void BidirectionalStreamQuicImpl::OnDataAvailable() {
262 // Return early if ReadData has not been called. 251 // Return early if ReadData has not been called.
263 if (!read_buffer_) 252 if (!read_buffer_)
264 return; 253 return;
265 254
266 int rv = ReadData(read_buffer_.get(), read_buffer_len_); 255 int rv = ReadData(read_buffer_.get(), read_buffer_len_);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 if (!stream_) 350 if (!stream_)
362 return; 351 return;
363 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 352 closed_stream_received_bytes_ = stream_->stream_bytes_read();
364 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 353 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
365 closed_is_first_stream_ = stream_->IsFirstStream(); 354 closed_is_first_stream_ = stream_->IsFirstStream();
366 stream_->SetDelegate(nullptr); 355 stream_->SetDelegate(nullptr);
367 stream_ = nullptr; 356 stream_ = nullptr;
368 } 357 }
369 358
370 } // namespace net 359 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698