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

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

Issue 17760008: [SPDY] Enable tests for SPDY/3.1 and SPDY/4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more tests Created 7 years, 6 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 | Annotate | Revision Log
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_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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } else { 477 } else {
478 flow_control_state_ = FLOW_CONTROL_NONE; 478 flow_control_state_ = FLOW_CONTROL_NONE;
479 } 479 }
480 480
481 buffered_spdy_framer_.reset( 481 buffered_spdy_framer_.reset(
482 new BufferedSpdyFramer(NPNToSpdyVersion(protocol), enable_compression_)); 482 new BufferedSpdyFramer(NPNToSpdyVersion(protocol), enable_compression_));
483 buffered_spdy_framer_->set_visitor(this); 483 buffered_spdy_framer_->set_visitor(this);
484 SendInitialSettings(); 484 SendInitialSettings();
485 UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol, kProtoMaximumVersion); 485 UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol, kProtoMaximumVersion);
486 486
487 if (flow_control_state_ == FLOW_CONTROL_STREAM_AND_SESSION) {
Ryan Hamilton 2013/06/27 17:23:50 How come this moved?
akalin 2013/06/27 20:00:06 This is now part of "initial settings" (since it's
488 // Bump up the receive window size to the real initial value. This
489 // has to go here since the WINDOW_UPDATE frame sent by
490 // IncreaseRecvWindowSize() call uses |buffered_spdy_framer_|.
491 DCHECK_GT(kDefaultInitialRecvWindowSize, session_recv_window_size_);
492 // This condition implies that |kDefaultInitialRecvWindowSize| -
493 // |session_recv_window_size_| doesn't overflow.
494 DCHECK_GT(session_recv_window_size_, 0);
495 IncreaseRecvWindowSize(
496 kDefaultInitialRecvWindowSize - session_recv_window_size_);
497 }
498
499 net_log_.AddEvent( 487 net_log_.AddEvent(
500 NetLog::TYPE_SPDY_SESSION_INITIALIZED, 488 NetLog::TYPE_SPDY_SESSION_INITIALIZED,
501 connection_->socket()->NetLog().source().ToEventParametersCallback()); 489 connection_->socket()->NetLog().source().ToEventParametersCallback());
502 490
503 // Write out any data that we might have to send, such as the settings frame. 491 // Write out any data that we might have to send, such as the settings frame.
504 WriteSocketLater(); 492 WriteSocketLater();
505 int error = DoLoop(OK); 493 int error = DoLoop(OK);
506 if (error == ERR_IO_PENDING) 494 if (error == ERR_IO_PENDING)
507 return OK; 495 return OK;
508 return static_cast<Error>(error); 496 return static_cast<Error>(error);
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 uint32 delta_window_size) { 2064 uint32 delta_window_size) {
2077 CHECK_GE(flow_control_state_, FLOW_CONTROL_STREAM); 2065 CHECK_GE(flow_control_state_, FLOW_CONTROL_STREAM);
2078 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); 2066 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id);
2079 CHECK(it != active_streams_.end()); 2067 CHECK(it != active_streams_.end());
2080 CHECK_EQ(it->second.stream->stream_id(), stream_id); 2068 CHECK_EQ(it->second.stream->stream_id(), stream_id);
2081 SendWindowUpdateFrame( 2069 SendWindowUpdateFrame(
2082 stream_id, delta_window_size, it->second.stream->priority()); 2070 stream_id, delta_window_size, it->second.stream->priority());
2083 } 2071 }
2084 2072
2085 void SpdySession::SendInitialSettings() { 2073 void SpdySession::SendInitialSettings() {
2086 // First notify the server about the settings they should use when 2074 // First, notify the server about the settings they should use when
2087 // communicating with us. 2075 // communicating with us.
2088 if (GetProtocolVersion() >= 2 && enable_sending_initial_settings_) { 2076 if (GetProtocolVersion() >= 2 && enable_sending_initial_settings_) {
2089 SettingsMap settings_map; 2077 SettingsMap settings_map;
2090 // Create a new settings frame notifying the sever of our 2078 // Create a new settings frame notifying the sever of our
2091 // max_concurrent_streams_ and initial window size. 2079 // max_concurrent_streams_ and initial window size.
2092 settings_map[SETTINGS_MAX_CONCURRENT_STREAMS] = 2080 settings_map[SETTINGS_MAX_CONCURRENT_STREAMS] =
2093 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); 2081 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams);
2094 if (GetProtocolVersion() > 2 && 2082 if (GetProtocolVersion() > 2 &&
2095 stream_initial_recv_window_size_ != kSpdyStreamInitialWindowSize) { 2083 stream_initial_recv_window_size_ != kSpdyStreamInitialWindowSize) {
2096 settings_map[SETTINGS_INITIAL_WINDOW_SIZE] = 2084 settings_map[SETTINGS_INITIAL_WINDOW_SIZE] =
2097 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, 2085 SettingsFlagsAndValue(SETTINGS_FLAG_NONE,
2098 stream_initial_recv_window_size_); 2086 stream_initial_recv_window_size_);
2099 } 2087 }
2100 SendSettings(settings_map); 2088 SendSettings(settings_map);
2101 } 2089 }
2102 2090
2103 // Next notify the server about the settings they have previously 2091 // Next, notify the server about our initial recv window size.
2092 if (flow_control_state_ == FLOW_CONTROL_STREAM_AND_SESSION &&
2093 enable_sending_initial_settings_) {
2094 // Bump up the receive window size to the real initial value. This
2095 // has to go here since the WINDOW_UPDATE frame sent by
2096 // IncreaseRecvWindowSize() call uses |buffered_spdy_framer_|.
2097 DCHECK_GT(kDefaultInitialRecvWindowSize, session_recv_window_size_);
2098 // This condition implies that |kDefaultInitialRecvWindowSize| -
2099 // |session_recv_window_size_| doesn't overflow.
2100 DCHECK_GT(session_recv_window_size_, 0);
2101 IncreaseRecvWindowSize(
2102 kDefaultInitialRecvWindowSize - session_recv_window_size_);
2103 }
2104
2105 // Finally, notify the server about the settings they have previously
2104 // told us to use when communicating with them. 2106 // told us to use when communicating with them.
2105 const SettingsMap& settings_map = 2107 const SettingsMap& settings_map =
2106 http_server_properties_->GetSpdySettings(host_port_pair()); 2108 http_server_properties_->GetSpdySettings(host_port_pair());
2107 if (settings_map.empty()) 2109 if (settings_map.empty())
2108 return; 2110 return;
2109 2111
2110 const SpdySettingsIds id = SETTINGS_CURRENT_CWND; 2112 const SpdySettingsIds id = SETTINGS_CURRENT_CWND;
2111 SettingsMap::const_iterator it = settings_map.find(id); 2113 SettingsMap::const_iterator it = settings_map.find(id);
2112 uint32 value = 0; 2114 uint32 value = 0;
2113 if (it != settings_map.end()) 2115 if (it != settings_map.end())
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 if (!queue->empty()) { 2577 if (!queue->empty()) {
2576 SpdyStreamId stream_id = queue->front(); 2578 SpdyStreamId stream_id = queue->front();
2577 queue->pop_front(); 2579 queue->pop_front();
2578 return stream_id; 2580 return stream_id;
2579 } 2581 }
2580 } 2582 }
2581 return 0; 2583 return 0;
2582 } 2584 }
2583 2585
2584 } // namespace net 2586 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698