Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #ifdef TEMP_INSTRUMENTATION_468529 | 8 #ifdef TEMP_INSTRUMENTATION_468529 |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #endif | 10 #endif |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 session_error_(OK), | 34 session_error_(OK), |
| 35 was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()), | 35 was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()), |
| 36 stream_(nullptr), | 36 stream_(nullptr), |
| 37 request_info_(nullptr), | 37 request_info_(nullptr), |
| 38 request_body_stream_(nullptr), | 38 request_body_stream_(nullptr), |
| 39 priority_(MINIMUM_PRIORITY), | 39 priority_(MINIMUM_PRIORITY), |
| 40 response_info_(nullptr), | 40 response_info_(nullptr), |
| 41 response_status_(OK), | 41 response_status_(OK), |
| 42 response_headers_received_(false), | 42 response_headers_received_(false), |
| 43 closed_stream_received_bytes_(0), | 43 closed_stream_received_bytes_(0), |
| 44 closed_stream_sent_bytes_(0), | |
| 44 user_buffer_len_(0), | 45 user_buffer_len_(0), |
| 45 weak_factory_(this) { | 46 weak_factory_(this) { |
| 46 DCHECK(session_); | 47 DCHECK(session_); |
| 47 session_->AddObserver(this); | 48 session_->AddObserver(this); |
| 48 } | 49 } |
| 49 | 50 |
| 50 QuicHttpStream::~QuicHttpStream() { | 51 QuicHttpStream::~QuicHttpStream() { |
| 51 #ifdef TEMP_INSTRUMENTATION_468529 | 52 #ifdef TEMP_INSTRUMENTATION_468529 |
| 52 liveness_ = DEAD; | 53 liveness_ = DEAD; |
| 53 stack_trace_ = base::debug::StackTrace(); | 54 stack_trace_ = base::debug::StackTrace(); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 | 259 |
| 259 int64 QuicHttpStream::GetTotalReceivedBytes() const { | 260 int64 QuicHttpStream::GetTotalReceivedBytes() const { |
| 260 if (stream_) { | 261 if (stream_) { |
| 261 return stream_->stream_bytes_read(); | 262 return stream_->stream_bytes_read(); |
| 262 } | 263 } |
| 263 | 264 |
| 264 return closed_stream_received_bytes_; | 265 return closed_stream_received_bytes_; |
| 265 } | 266 } |
| 266 | 267 |
| 267 int64_t QuicHttpStream::GetTotalSentBytes() const { | 268 int64_t QuicHttpStream::GetTotalSentBytes() const { |
| 268 // TODO(sclittle): Implement this for real. http://crbug.com/518897. | 269 if (stream_) { |
|
bengr
2015/09/01 17:16:06
Is it always the case that stream_ is non-null whe
sclittle
2015/09/02 00:06:23
What do you mean? |stream_| will be null after it'
| |
| 269 return 0; | 270 return stream_->stream_bytes_written(); |
| 271 } | |
| 272 | |
| 273 return closed_stream_sent_bytes_; | |
| 270 } | 274 } |
| 271 | 275 |
| 272 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { | 276 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { |
| 273 // TODO(mmenke): Figure out what to do here. | 277 // TODO(mmenke): Figure out what to do here. |
| 274 return true; | 278 return true; |
| 275 } | 279 } |
| 276 | 280 |
| 277 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { | 281 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { |
| 278 DCHECK(stream_); | 282 DCHECK(stream_); |
| 279 session_->GetSSLInfo(ssl_info); | 283 session_->GetSSLInfo(ssl_info); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 } | 551 } |
| 548 | 552 |
| 549 SpdyMajorVersion QuicHttpStream::GetSpdyVersion() { | 553 SpdyMajorVersion QuicHttpStream::GetSpdyVersion() { |
| 550 return SpdyUtils::GetSpdyVersionForQuicVersion(stream_->version()); | 554 return SpdyUtils::GetSpdyVersionForQuicVersion(stream_->version()); |
| 551 } | 555 } |
| 552 | 556 |
| 553 void QuicHttpStream::ResetStream() { | 557 void QuicHttpStream::ResetStream() { |
| 554 if (!stream_) | 558 if (!stream_) |
| 555 return; | 559 return; |
| 556 closed_stream_received_bytes_ = stream_->stream_bytes_read(); | 560 closed_stream_received_bytes_ = stream_->stream_bytes_read(); |
| 561 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | |
| 557 stream_ = nullptr; | 562 stream_ = nullptr; |
| 558 } | 563 } |
| 559 | 564 |
| 560 void QuicHttpStream::CrashIfInvalid() const { | 565 void QuicHttpStream::CrashIfInvalid() const { |
| 561 #ifdef TEMP_INSTRUMENTATION_468529 | 566 #ifdef TEMP_INSTRUMENTATION_468529 |
| 562 Liveness liveness = liveness_; | 567 Liveness liveness = liveness_; |
| 563 | 568 |
| 564 if (liveness == ALIVE) | 569 if (liveness == ALIVE) |
| 565 return; | 570 return; |
| 566 | 571 |
| 567 // Copy relevant variables onto the stack to guarantee they will be available | 572 // Copy relevant variables onto the stack to guarantee they will be available |
| 568 // in minidumps, and then crash. | 573 // in minidumps, and then crash. |
| 569 base::debug::StackTrace stack_trace = stack_trace_; | 574 base::debug::StackTrace stack_trace = stack_trace_; |
| 570 | 575 |
| 571 base::debug::Alias(&liveness); | 576 base::debug::Alias(&liveness); |
| 572 base::debug::Alias(&stack_trace); | 577 base::debug::Alias(&stack_trace); |
| 573 | 578 |
| 574 CHECK_EQ(ALIVE, liveness); | 579 CHECK_EQ(ALIVE, liveness); |
| 575 #endif | 580 #endif |
| 576 } | 581 } |
| 577 | 582 |
| 578 } // namespace net | 583 } // namespace net |
| OLD | NEW |