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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 SpdyStream::SpdyStream(SpdySession* session, | 70 SpdyStream::SpdyStream(SpdySession* session, |
71 SpdyStreamId stream_id, | 71 SpdyStreamId stream_id, |
72 bool pushed, | 72 bool pushed, |
73 const BoundNetLog& net_log) | 73 const BoundNetLog& net_log) |
74 : continue_buffering_data_(true), | 74 : continue_buffering_data_(true), |
75 stream_id_(stream_id), | 75 stream_id_(stream_id), |
76 priority_(0), | 76 priority_(HIGHEST), |
77 slot_(0), | 77 slot_(0), |
78 stalled_by_flow_control_(false), | 78 stalled_by_flow_control_(false), |
79 send_window_size_(kSpdyStreamInitialWindowSize), | 79 send_window_size_(kSpdyStreamInitialWindowSize), |
80 recv_window_size_(kSpdyStreamInitialWindowSize), | 80 recv_window_size_(kSpdyStreamInitialWindowSize), |
81 unacked_recv_window_bytes_(0), | 81 unacked_recv_window_bytes_(0), |
82 pushed_(pushed), | 82 pushed_(pushed), |
83 response_received_(false), | 83 response_received_(false), |
84 session_(session), | 84 session_(session), |
85 delegate_(NULL), | 85 delegate_(NULL), |
86 request_time_(base::Time::Now()), | 86 request_time_(base::Time::Now()), |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 return OK; | 656 return OK; |
657 } | 657 } |
658 | 658 |
659 int SpdyStream::DoSendDomainBoundCert() { | 659 int SpdyStream::DoSendDomainBoundCert() { |
660 io_state_ = STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE; | 660 io_state_ = STATE_SEND_DOMAIN_BOUND_CERT_COMPLETE; |
661 CHECK(request_.get()); | 661 CHECK(request_.get()); |
662 std::string origin = GetUrl().GetOrigin().spec(); | 662 std::string origin = GetUrl().GetOrigin().spec(); |
663 origin.erase(origin.length() - 1); // trim trailing slash | 663 origin.erase(origin.length() - 1); // trim trailing slash |
664 int rv = session_->WriteCredentialFrame( | 664 int rv = session_->WriteCredentialFrame( |
665 origin, domain_bound_cert_type_, domain_bound_private_key_, | 665 origin, domain_bound_cert_type_, domain_bound_private_key_, |
666 domain_bound_cert_, static_cast<RequestPriority>(priority_)); | 666 domain_bound_cert_, priority_); |
667 if (rv != ERR_IO_PENDING) | 667 if (rv != ERR_IO_PENDING) |
668 return rv; | 668 return rv; |
669 return OK; | 669 return OK; |
670 } | 670 } |
671 | 671 |
672 int SpdyStream::DoSendDomainBoundCertComplete(int result) { | 672 int SpdyStream::DoSendDomainBoundCertComplete(int result) { |
673 if (result < 0) | 673 if (result < 0) |
674 return result; | 674 return result; |
675 | 675 |
676 io_state_ = STATE_SEND_HEADERS; | 676 io_state_ = STATE_SEND_HEADERS; |
677 return OK; | 677 return OK; |
678 } | 678 } |
679 | 679 |
680 int SpdyStream::DoSendHeaders() { | 680 int SpdyStream::DoSendHeaders() { |
681 CHECK(!cancelled_); | 681 CHECK(!cancelled_); |
682 | 682 |
683 SpdyControlFlags flags = CONTROL_FLAG_NONE; | 683 SpdyControlFlags flags = CONTROL_FLAG_NONE; |
684 if (!has_upload_data_) | 684 if (!has_upload_data_) |
685 flags = CONTROL_FLAG_FIN; | 685 flags = CONTROL_FLAG_FIN; |
686 | 686 |
687 CHECK(request_.get()); | 687 CHECK(request_.get()); |
688 int result = session_->WriteSynStream( | 688 int result = session_->WriteSynStream( |
689 stream_id_, static_cast<RequestPriority>(priority_), slot_, flags, | 689 stream_id_, priority_, slot_, flags, |
690 request_); | 690 request_); |
691 if (result != ERR_IO_PENDING) | 691 if (result != ERR_IO_PENDING) |
692 return result; | 692 return result; |
693 | 693 |
694 send_time_ = base::TimeTicks::Now(); | 694 send_time_ = base::TimeTicks::Now(); |
695 io_state_ = STATE_SEND_HEADERS_COMPLETE; | 695 io_state_ = STATE_SEND_HEADERS_COMPLETE; |
696 return ERR_IO_PENDING; | 696 return ERR_IO_PENDING; |
697 } | 697 } |
698 | 698 |
699 int SpdyStream::DoSendHeadersComplete(int result) { | 699 int SpdyStream::DoSendHeadersComplete(int result) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", | 764 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", |
765 recv_last_byte_time_ - recv_first_byte_time_); | 765 recv_last_byte_time_ - recv_first_byte_time_); |
766 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", | 766 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", |
767 recv_last_byte_time_ - send_time_); | 767 recv_last_byte_time_ - send_time_); |
768 | 768 |
769 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); | 769 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); |
770 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); | 770 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); |
771 } | 771 } |
772 | 772 |
773 } // namespace net | 773 } // namespace net |
OLD | NEW |