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

Side by Side Diff: net/spdy/spdy_stream.cc

Issue 2141993002: Remove many-many SpdyMajorVersion and NextProto arguments and members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove OnSynStream() and OnSynReply(). Created 4 years, 5 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 | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_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 (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 <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 pending_send_data_->DidConsume(frame_payload_size); 624 pending_send_data_->DidConsume(frame_payload_size);
625 if (pending_send_data_->BytesRemaining() > 0) { 625 if (pending_send_data_->BytesRemaining() > 0) {
626 QueueNextDataFrame(); 626 QueueNextDataFrame();
627 return ERR_IO_PENDING; 627 return ERR_IO_PENDING;
628 } else { 628 } else {
629 pending_send_data_ = NULL; 629 pending_send_data_ = NULL;
630 return OK; 630 return OK;
631 } 631 }
632 } 632 }
633 633
634 SpdyMajorVersion SpdyStream::GetProtocolVersion() const {
635 return session_->GetProtocolVersion();
636 }
637
638 void SpdyStream::LogStreamError(int status, const std::string& description) { 634 void SpdyStream::LogStreamError(int status, const std::string& description) {
639 net_log_.AddEvent(NetLog::TYPE_HTTP2_STREAM_ERROR, 635 net_log_.AddEvent(NetLog::TYPE_HTTP2_STREAM_ERROR,
640 base::Bind(&NetLogSpdyStreamErrorCallback, stream_id_, 636 base::Bind(&NetLogSpdyStreamErrorCallback, stream_id_,
641 status, &description)); 637 status, &description));
642 } 638 }
643 639
644 void SpdyStream::OnClose(int status) { 640 void SpdyStream::OnClose(int status) {
645 // In most cases, the stream should already be CLOSED. The exception is when a 641 // In most cases, the stream should already be CLOSED. The exception is when a
646 // SpdySession is shutting down while the stream is in an intermediate state. 642 // SpdySession is shutting down while the stream is in an intermediate state.
647 io_state_ = STATE_CLOSED; 643 io_state_ = STATE_CLOSED;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 } 744 }
749 745
750 bool SpdyStream::IsOpen() const { 746 bool SpdyStream::IsOpen() const {
751 return io_state_ == STATE_OPEN; 747 return io_state_ == STATE_OPEN;
752 } 748 }
753 749
754 bool SpdyStream::IsReservedRemote() const { 750 bool SpdyStream::IsReservedRemote() const {
755 return io_state_ == STATE_RESERVED_REMOTE; 751 return io_state_ == STATE_RESERVED_REMOTE;
756 } 752 }
757 753
758 NextProto SpdyStream::GetProtocol() const {
759 return session_->protocol();
760 }
761
762 void SpdyStream::AddRawReceivedBytes(size_t received_bytes) { 754 void SpdyStream::AddRawReceivedBytes(size_t received_bytes) {
763 raw_received_bytes_ += received_bytes; 755 raw_received_bytes_ += received_bytes;
764 } 756 }
765 757
766 void SpdyStream::AddRawSentBytes(size_t sent_bytes) { 758 void SpdyStream::AddRawSentBytes(size_t sent_bytes) {
767 raw_sent_bytes_ += sent_bytes; 759 raw_sent_bytes_ += sent_bytes;
768 } 760 }
769 761
770 bool SpdyStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { 762 bool SpdyStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const {
771 if (stream_id_ == 0) 763 if (stream_id_ == 0)
772 return false; 764 return false;
773 bool result = session_->GetLoadTimingInfo(stream_id_, load_timing_info); 765 bool result = session_->GetLoadTimingInfo(stream_id_, load_timing_info);
774 if (type_ == SPDY_PUSH_STREAM) { 766 if (type_ == SPDY_PUSH_STREAM) {
775 load_timing_info->push_start = recv_first_byte_time_; 767 load_timing_info->push_start = recv_first_byte_time_;
776 bool done_receiving = IsClosed() || (!pending_recv_data_.empty() && 768 bool done_receiving = IsClosed() || (!pending_recv_data_.empty() &&
777 !pending_recv_data_.back()); 769 !pending_recv_data_.back());
778 if (done_receiving) 770 if (done_receiving)
779 load_timing_info->push_end = recv_last_byte_time_; 771 load_timing_info->push_end = recv_last_byte_time_;
780 } 772 }
781 return result; 773 return result;
782 } 774 }
783 775
784 GURL SpdyStream::GetUrlFromHeaders() const { 776 GURL SpdyStream::GetUrlFromHeaders() const {
785 if (!request_headers_) 777 if (!request_headers_)
786 return GURL(); 778 return GURL();
787 779
788 return GetUrlFromHeaderBlock(*request_headers_, GetProtocolVersion()); 780 return GetUrlFromHeaderBlock(*request_headers_);
789 } 781 }
790 782
791 bool SpdyStream::HasUrlFromHeaders() const { 783 bool SpdyStream::HasUrlFromHeaders() const {
792 return !GetUrlFromHeaders().is_empty(); 784 return !GetUrlFromHeaders().is_empty();
793 } 785 }
794 786
795 void SpdyStream::UpdateHistograms() { 787 void SpdyStream::UpdateHistograms() {
796 // We need at least the receive timers to be filled in, as otherwise 788 // We need at least the receive timers to be filled in, as otherwise
797 // metrics can be bogus. 789 // metrics can be bogus.
798 if (recv_first_byte_time_.is_null() || recv_last_byte_time_.is_null()) 790 if (recv_first_byte_time_.is_null() || recv_last_byte_time_.is_null())
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 937 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
946 state); 938 state);
947 break; 939 break;
948 } 940 }
949 return description; 941 return description;
950 } 942 }
951 943
952 #undef STATE_CASE 944 #undef STATE_CASE
953 945
954 } // namespace net 946 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698