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/spdy/spdy_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 SpdyFrame* header_frame = session_->CreateHeadersFrame( | 154 SpdyFrame* header_frame = session_->CreateHeadersFrame( |
| 155 stream_id_, *frame.header_block, SpdyControlFlags()); | 155 stream_id_, *frame.header_block, SpdyControlFlags()); |
| 156 delete frame.header_block; | 156 delete frame.header_block; |
| 157 return header_frame; | 157 return header_frame; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 NOTREACHED(); | 160 NOTREACHED(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 SpdyStream::~SpdyStream() { | 163 SpdyStream::~SpdyStream() { |
| 164 if (domain_bound_cert_request_handle_ != NULL) { | |
| 165 ServerBoundCertService* sbc_service = session_->GetServerBoundCertService(); | |
| 166 sbc_service->CancelRequest(domain_bound_cert_request_handle_); | |
| 167 domain_bound_cert_request_handle_ = NULL; | |
|
Ryan Hamilton
2012/12/28 16:30:53
This seems like a reasonable place to put this log
mattm
2013/01/09 04:27:51
Done.
Ryan Hamilton
2013/01/09 04:48:03
Nice! A bit more code to implement the RequestHan
| |
| 168 } | |
| 164 UpdateHistograms(); | 169 UpdateHistograms(); |
| 165 while (!pending_frames_.empty()) { | 170 while (!pending_frames_.empty()) { |
| 166 PendingFrame frame = pending_frames_.back(); | 171 PendingFrame frame = pending_frames_.back(); |
| 167 pending_frames_.pop_back(); | 172 pending_frames_.pop_back(); |
| 168 if (frame.type == TYPE_DATA) | 173 if (frame.type == TYPE_DATA) |
| 169 delete frame.data_frame; | 174 delete frame.data_frame; |
| 170 else | 175 else |
| 171 delete frame.header_block; | 176 delete frame.header_block; |
| 172 } | 177 } |
| 173 } | 178 } |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 Delegate* delegate = delegate_; | 552 Delegate* delegate = delegate_; |
| 548 delegate_ = NULL; | 553 delegate_ = NULL; |
| 549 if (delegate) | 554 if (delegate) |
| 550 delegate->OnClose(status); | 555 delegate->OnClose(status); |
| 551 } | 556 } |
| 552 | 557 |
| 553 void SpdyStream::Cancel() { | 558 void SpdyStream::Cancel() { |
| 554 if (cancelled()) | 559 if (cancelled()) |
| 555 return; | 560 return; |
| 556 | 561 |
| 562 if (domain_bound_cert_request_handle_ != NULL) { | |
| 563 ServerBoundCertService* sbc_service = session_->GetServerBoundCertService(); | |
| 564 sbc_service->CancelRequest(domain_bound_cert_request_handle_); | |
| 565 domain_bound_cert_request_handle_ = NULL; | |
| 566 } | |
| 567 | |
| 557 cancelled_ = true; | 568 cancelled_ = true; |
| 558 if (session_->IsStreamActive(stream_id_)) | 569 if (session_->IsStreamActive(stream_id_)) |
| 559 session_->ResetStream(stream_id_, CANCEL, ""); | 570 session_->ResetStream(stream_id_, CANCEL, ""); |
| 560 else if (stream_id_ == 0) | 571 else if (stream_id_ == 0) |
| 561 session_->CloseCreatedStream(this, CANCEL); | 572 session_->CloseCreatedStream(this, CANCEL); |
| 562 } | 573 } |
| 563 | 574 |
| 564 void SpdyStream::Close() { | 575 void SpdyStream::Close() { |
| 565 if (stream_id_ != 0) | 576 if (stream_id_ != 0) |
| 566 session_->CloseStream(stream_id_, net::OK); | 577 session_->CloseStream(stream_id_, net::OK); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 | 651 |
| 641 GURL SpdyStream::GetUrl() const { | 652 GURL SpdyStream::GetUrl() const { |
| 642 DCHECK(HasUrl()); | 653 DCHECK(HasUrl()); |
| 643 | 654 |
| 644 const SpdyHeaderBlock& headers = (pushed_) ? *response_ : *request_; | 655 const SpdyHeaderBlock& headers = (pushed_) ? *response_ : *request_; |
| 645 return GetUrlFromHeaderBlock(headers, GetProtocolVersion(), pushed_); | 656 return GetUrlFromHeaderBlock(headers, GetProtocolVersion(), pushed_); |
| 646 } | 657 } |
| 647 | 658 |
| 648 void SpdyStream::OnGetDomainBoundCertComplete(int result) { | 659 void SpdyStream::OnGetDomainBoundCertComplete(int result) { |
| 649 DCHECK_EQ(STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, io_state_); | 660 DCHECK_EQ(STATE_GET_DOMAIN_BOUND_CERT_COMPLETE, io_state_); |
| 661 domain_bound_cert_request_handle_ = NULL; | |
| 650 DoLoop(result); | 662 DoLoop(result); |
| 651 } | 663 } |
| 652 | 664 |
| 653 int SpdyStream::DoLoop(int result) { | 665 int SpdyStream::DoLoop(int result) { |
| 654 do { | 666 do { |
| 655 State state = io_state_; | 667 State state = io_state_; |
| 656 io_state_ = STATE_NONE; | 668 io_state_ = STATE_NONE; |
| 657 switch (state) { | 669 switch (state) { |
| 658 // State machine 1: Send headers and body. | 670 // State machine 1: Send headers and body. |
| 659 case STATE_GET_DOMAIN_BOUND_CERT: | 671 case STATE_GET_DOMAIN_BOUND_CERT: |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", | 870 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", |
| 859 recv_last_byte_time_ - recv_first_byte_time_); | 871 recv_last_byte_time_ - recv_first_byte_time_); |
| 860 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", | 872 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", |
| 861 recv_last_byte_time_ - send_time_); | 873 recv_last_byte_time_ - send_time_); |
| 862 | 874 |
| 863 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); | 875 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); |
| 864 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); | 876 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); |
| 865 } | 877 } |
| 866 | 878 |
| 867 } // namespace net | 879 } // namespace net |
| OLD | NEW |