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

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

Issue 2354653003: Implements BidirectionalStreamQuicImpl::GetLoadTimingInfo (Closed)
Patch Set: Rebased Created 4 years, 3 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
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 14 matching lines...) Expand all
25 stream_(nullptr), 25 stream_(nullptr),
26 request_info_(nullptr), 26 request_info_(nullptr),
27 delegate_(nullptr), 27 delegate_(nullptr),
28 response_status_(OK), 28 response_status_(OK),
29 negotiated_protocol_(kProtoUnknown), 29 negotiated_protocol_(kProtoUnknown),
30 read_buffer_len_(0), 30 read_buffer_len_(0),
31 headers_bytes_received_(0), 31 headers_bytes_received_(0),
32 headers_bytes_sent_(0), 32 headers_bytes_sent_(0),
33 closed_stream_received_bytes_(0), 33 closed_stream_received_bytes_(0),
34 closed_stream_sent_bytes_(0), 34 closed_stream_sent_bytes_(0),
35 closed_is_first_stream_(false),
35 has_sent_headers_(false), 36 has_sent_headers_(false),
36 has_received_headers_(false), 37 has_received_headers_(false),
37 send_request_headers_automatically_(true), 38 send_request_headers_automatically_(true),
38 waiting_for_confirmation_(false), 39 waiting_for_confirmation_(false),
39 weak_factory_(this) { 40 weak_factory_(this) {
40 DCHECK(session_); 41 DCHECK(session_);
41 session_->AddObserver(this); 42 session_->AddObserver(this);
42 } 43 }
43 44
44 BidirectionalStreamQuicImpl::~BidirectionalStreamQuicImpl() { 45 BidirectionalStreamQuicImpl::~BidirectionalStreamQuicImpl() {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 211 }
211 212
212 int64_t BidirectionalStreamQuicImpl::GetTotalSentBytes() const { 213 int64_t BidirectionalStreamQuicImpl::GetTotalSentBytes() const {
213 if (stream_) 214 if (stream_)
214 return headers_bytes_sent_ + stream_->stream_bytes_written(); 215 return headers_bytes_sent_ + stream_->stream_bytes_written();
215 return headers_bytes_sent_ + closed_stream_sent_bytes_; 216 return headers_bytes_sent_ + closed_stream_sent_bytes_;
216 } 217 }
217 218
218 bool BidirectionalStreamQuicImpl::GetLoadTimingInfo( 219 bool BidirectionalStreamQuicImpl::GetLoadTimingInfo(
219 LoadTimingInfo* load_timing_info) const { 220 LoadTimingInfo* load_timing_info) const {
220 // TODO(xunjieli): implement this crbug.com/648346. 221 bool is_first_stream = closed_is_first_stream_;
222 if (stream_)
223 is_first_stream = stream_->IsFirstStream();
224 if (is_first_stream) {
225 load_timing_info->socket_reused = false;
226 load_timing_info->connect_timing = connect_timing_;
227 } else {
228 load_timing_info->socket_reused = true;
229 }
221 return true; 230 return true;
222 } 231 }
223 232
224 void BidirectionalStreamQuicImpl::OnHeadersAvailable( 233 void BidirectionalStreamQuicImpl::OnHeadersAvailable(
225 const SpdyHeaderBlock& headers, 234 const SpdyHeaderBlock& headers,
226 size_t frame_len) { 235 size_t frame_len) {
227 headers_bytes_received_ += frame_len; 236 headers_bytes_received_ += frame_len;
228 negotiated_protocol_ = kProtoQUIC1SPDY3; 237 negotiated_protocol_ = kProtoQUIC1SPDY3;
229 if (!has_received_headers_) { 238 if (!has_received_headers_) {
230 has_received_headers_ = true; 239 has_received_headers_ = true;
240 connect_timing_ = session_->GetConnectTiming();
231 if (delegate_) 241 if (delegate_)
232 delegate_->OnHeadersReceived(headers); 242 delegate_->OnHeadersReceived(headers);
233 } else { 243 } else {
234 if (stream_->IsDoneReading()) { 244 if (stream_->IsDoneReading()) {
235 // If the write side is closed, OnFinRead() will call 245 // If the write side is closed, OnFinRead() will call
236 // BidirectionalStreamQuicImpl::OnClose(). 246 // BidirectionalStreamQuicImpl::OnClose().
237 stream_->OnFinRead(); 247 stream_->OnFinRead();
238 } 248 }
239 if (delegate_) 249 if (delegate_)
240 delegate_->OnTrailersReceived(headers); 250 delegate_->OnTrailersReceived(headers);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 350 }
341 if (delegate_) 351 if (delegate_)
342 delegate_->OnStreamReady(has_sent_headers_); 352 delegate_->OnStreamReady(has_sent_headers_);
343 } 353 }
344 354
345 void BidirectionalStreamQuicImpl::ResetStream() { 355 void BidirectionalStreamQuicImpl::ResetStream() {
346 if (!stream_) 356 if (!stream_)
347 return; 357 return;
348 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 358 closed_stream_received_bytes_ = stream_->stream_bytes_read();
349 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 359 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
360 closed_is_first_stream_ = stream_->IsFirstStream();
350 stream_->SetDelegate(nullptr); 361 stream_->SetDelegate(nullptr);
351 stream_ = nullptr; 362 stream_ = nullptr;
352 } 363 }
353 364
354 } // namespace net 365 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/bidirectional_stream_quic_impl.h ('k') | net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698