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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 // has to go here since the WINDOW_UPDATE frame sent by | 2728 // has to go here since the WINDOW_UPDATE frame sent by |
2729 // IncreaseRecvWindowSize() call uses |buffered_spdy_framer_|. | 2729 // IncreaseRecvWindowSize() call uses |buffered_spdy_framer_|. |
2730 DCHECK_GT(kDefaultInitialRecvWindowSize, session_recv_window_size_); | 2730 DCHECK_GT(kDefaultInitialRecvWindowSize, session_recv_window_size_); |
2731 // This condition implies that |kDefaultInitialRecvWindowSize| - | 2731 // This condition implies that |kDefaultInitialRecvWindowSize| - |
2732 // |session_recv_window_size_| doesn't overflow. | 2732 // |session_recv_window_size_| doesn't overflow. |
2733 DCHECK_GT(session_recv_window_size_, 0); | 2733 DCHECK_GT(session_recv_window_size_, 0); |
2734 IncreaseRecvWindowSize( | 2734 IncreaseRecvWindowSize( |
2735 kDefaultInitialRecvWindowSize - session_recv_window_size_); | 2735 kDefaultInitialRecvWindowSize - session_recv_window_size_); |
2736 } | 2736 } |
2737 | 2737 |
2738 // Finally, notify the server about the settings they have | 2738 if (protocol_ <= kProtoSPDY31) { |
2739 // previously told us to use when communicating with them (after | 2739 // Finally, notify the server about the settings they have |
2740 // applying them). | 2740 // previously told us to use when communicating with them (after |
2741 const SettingsMap& server_settings_map = | 2741 // applying them). |
2742 http_server_properties_->GetSpdySettings(host_port_pair()); | 2742 const SettingsMap& server_settings_map = |
2743 if (server_settings_map.empty()) | 2743 http_server_properties_->GetSpdySettings(host_port_pair()); |
2744 return; | 2744 if (server_settings_map.empty()) |
| 2745 return; |
2745 | 2746 |
2746 SettingsMap::const_iterator it = | 2747 SettingsMap::const_iterator it = |
2747 server_settings_map.find(SETTINGS_CURRENT_CWND); | 2748 server_settings_map.find(SETTINGS_CURRENT_CWND); |
2748 uint32 cwnd = (it != server_settings_map.end()) ? it->second.second : 0; | 2749 uint32 cwnd = (it != server_settings_map.end()) ? it->second.second : 0; |
2749 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", cwnd, 1, 200, 100); | 2750 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", cwnd, 1, 200, 100); |
2750 | 2751 |
2751 for (SettingsMap::const_iterator it = server_settings_map.begin(); | 2752 for (SettingsMap::const_iterator it = server_settings_map.begin(); |
2752 it != server_settings_map.end(); ++it) { | 2753 it != server_settings_map.end(); ++it) { |
2753 const SpdySettingsIds new_id = it->first; | 2754 const SpdySettingsIds new_id = it->first; |
2754 const uint32 new_val = it->second.second; | 2755 const uint32 new_val = it->second.second; |
2755 HandleSetting(new_id, new_val); | 2756 HandleSetting(new_id, new_val); |
| 2757 } |
| 2758 |
| 2759 SendSettings(server_settings_map); |
2756 } | 2760 } |
2757 | |
2758 SendSettings(server_settings_map); | |
2759 } | 2761 } |
2760 | 2762 |
2761 | 2763 |
2762 void SpdySession::SendSettings(const SettingsMap& settings) { | 2764 void SpdySession::SendSettings(const SettingsMap& settings) { |
2763 net_log_.AddEvent( | 2765 net_log_.AddEvent( |
2764 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, | 2766 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, |
2765 base::Bind(&NetLogSpdySendSettingsCallback, &settings)); | 2767 base::Bind(&NetLogSpdySendSettingsCallback, &settings)); |
2766 | 2768 |
2767 // Create the SETTINGS frame and send it. | 2769 // Create the SETTINGS frame and send it. |
2768 DCHECK(buffered_spdy_framer_.get()); | 2770 DCHECK(buffered_spdy_framer_.get()); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3207 if (!queue->empty()) { | 3209 if (!queue->empty()) { |
3208 SpdyStreamId stream_id = queue->front(); | 3210 SpdyStreamId stream_id = queue->front(); |
3209 queue->pop_front(); | 3211 queue->pop_front(); |
3210 return stream_id; | 3212 return stream_id; |
3211 } | 3213 } |
3212 } | 3214 } |
3213 return 0; | 3215 return 0; |
3214 } | 3216 } |
3215 | 3217 |
3216 } // namespace net | 3218 } // namespace net |
OLD | NEW |