| 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_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 if (protocol_negotiated != kProtoUnknown) { | 752 if (protocol_negotiated != kProtoUnknown) { |
| 753 protocol_ = protocol_negotiated; | 753 protocol_ = protocol_negotiated; |
| 754 stream_initial_send_window_size_ = GetDefaultInitialWindowSize(protocol_); | 754 stream_initial_send_window_size_ = GetDefaultInitialWindowSize(protocol_); |
| 755 } | 755 } |
| 756 DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); | 756 DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); |
| 757 DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); | 757 DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); |
| 758 | 758 |
| 759 if (protocol_ == kProtoHTTP2) | 759 if (protocol_ == kProtoHTTP2) |
| 760 send_connection_header_prefix_ = true; | 760 send_connection_header_prefix_ = true; |
| 761 | 761 |
| 762 if (protocol_ >= kProtoSPDY31) { | 762 flow_control_state_ = FLOW_CONTROL_STREAM_AND_SESSION; |
| 763 flow_control_state_ = FLOW_CONTROL_STREAM_AND_SESSION; | 763 session_send_window_size_ = GetDefaultInitialWindowSize(protocol_); |
| 764 session_send_window_size_ = GetDefaultInitialWindowSize(protocol_); | 764 session_recv_window_size_ = GetDefaultInitialWindowSize(protocol_); |
| 765 session_recv_window_size_ = GetDefaultInitialWindowSize(protocol_); | |
| 766 } else { | |
| 767 flow_control_state_ = FLOW_CONTROL_STREAM; | |
| 768 } | |
| 769 | 765 |
| 770 buffered_spdy_framer_.reset( | 766 buffered_spdy_framer_.reset( |
| 771 new BufferedSpdyFramer(NextProtoToSpdyMajorVersion(protocol_), | 767 new BufferedSpdyFramer(NextProtoToSpdyMajorVersion(protocol_), |
| 772 enable_compression_)); | 768 enable_compression_)); |
| 773 buffered_spdy_framer_->set_visitor(this); | 769 buffered_spdy_framer_->set_visitor(this); |
| 774 buffered_spdy_framer_->set_debug_visitor(this); | 770 buffered_spdy_framer_->set_debug_visitor(this); |
| 775 UMA_HISTOGRAM_ENUMERATION( | 771 UMA_HISTOGRAM_ENUMERATION( |
| 776 "Net.SpdyVersion2", | 772 "Net.SpdyVersion2", |
| 777 protocol_ - kProtoSPDYHistogramOffset, | 773 protocol_ - kProtoSPDYHistogramOffset, |
| 778 kProtoSPDYMaximumVersion - kProtoSPDYMinimumVersion + 1); | 774 kProtoSPDYMaximumVersion - kProtoSPDYMinimumVersion + 1); |
| (...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2850 // This condition implies that |session_max_recv_window_size_| - | 2846 // This condition implies that |session_max_recv_window_size_| - |
| 2851 // |session_recv_window_size_| doesn't overflow. | 2847 // |session_recv_window_size_| doesn't overflow. |
| 2852 DCHECK_GE(session_max_recv_window_size_, session_recv_window_size_); | 2848 DCHECK_GE(session_max_recv_window_size_, session_recv_window_size_); |
| 2853 DCHECK_GE(session_recv_window_size_, 0); | 2849 DCHECK_GE(session_recv_window_size_, 0); |
| 2854 if (session_max_recv_window_size_ > session_recv_window_size_) { | 2850 if (session_max_recv_window_size_ > session_recv_window_size_) { |
| 2855 IncreaseRecvWindowSize(session_max_recv_window_size_ - | 2851 IncreaseRecvWindowSize(session_max_recv_window_size_ - |
| 2856 session_recv_window_size_); | 2852 session_recv_window_size_); |
| 2857 } | 2853 } |
| 2858 } | 2854 } |
| 2859 | 2855 |
| 2860 if (protocol_ <= kProtoSPDY31) { | 2856 if (protocol_ == kProtoSPDY31) { |
| 2861 // Finally, notify the server about the settings they have | 2857 // Finally, notify the server about the settings they have |
| 2862 // previously told us to use when communicating with them (after | 2858 // previously told us to use when communicating with them (after |
| 2863 // applying them). | 2859 // applying them). |
| 2864 const SettingsMap& server_settings_map = | 2860 const SettingsMap& server_settings_map = |
| 2865 http_server_properties_->GetSpdySettings(host_port_pair()); | 2861 http_server_properties_->GetSpdySettings(host_port_pair()); |
| 2866 if (server_settings_map.empty()) | 2862 if (server_settings_map.empty()) |
| 2867 return; | 2863 return; |
| 2868 | 2864 |
| 2869 SettingsMap::const_iterator it = | 2865 SettingsMap::const_iterator it = |
| 2870 server_settings_map.find(SETTINGS_CURRENT_CWND); | 2866 server_settings_map.find(SETTINGS_CURRENT_CWND); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3322 if (!queue->empty()) { | 3318 if (!queue->empty()) { |
| 3323 SpdyStreamId stream_id = queue->front(); | 3319 SpdyStreamId stream_id = queue->front(); |
| 3324 queue->pop_front(); | 3320 queue->pop_front(); |
| 3325 return stream_id; | 3321 return stream_id; |
| 3326 } | 3322 } |
| 3327 } | 3323 } |
| 3328 return 0; | 3324 return 0; |
| 3329 } | 3325 } |
| 3330 | 3326 |
| 3331 } // namespace net | 3327 } // namespace net |
| OLD | NEW |