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

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

Issue 9252029: SPDY - default to SPDY/2.1 protocol in unittests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: SPDY - changes to make SPDY/2.1 as default protocol Created 8 years, 11 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyGoAwayParameter); 221 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyGoAwayParameter);
222 }; 222 };
223 223
224 } // namespace 224 } // namespace
225 225
226 // static 226 // static
227 bool SpdySession::use_ssl_ = true; 227 bool SpdySession::use_ssl_ = true;
228 228
229 // static 229 // static
230 bool SpdySession::use_flow_control_ = false; 230 SpdySession::FlowControl SpdySession::use_flow_control_ =
231 SpdySession::kFlowControlBasedOnNPN;
231 232
232 // static 233 // static
233 size_t SpdySession::init_max_concurrent_streams_ = 10; 234 size_t SpdySession::init_max_concurrent_streams_ = 10;
234 235
235 // static 236 // static
236 size_t SpdySession::max_concurrent_stream_limit_ = 256; 237 size_t SpdySession::max_concurrent_stream_limit_ = 256;
237 238
238 // static 239 // static
239 bool SpdySession::enable_ping_based_connection_checking_ = true; 240 bool SpdySession::enable_ping_based_connection_checking_ = true;
240 241
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 bytes_received_(0), 276 bytes_received_(0),
276 sent_settings_(false), 277 sent_settings_(false),
277 received_settings_(false), 278 received_settings_(false),
278 stalled_streams_(0), 279 stalled_streams_(0),
279 pings_in_flight_(0), 280 pings_in_flight_(0),
280 next_ping_id_(1), 281 next_ping_id_(1),
281 received_data_time_(base::TimeTicks::Now()), 282 received_data_time_(base::TimeTicks::Now()),
282 trailing_ping_pending_(false), 283 trailing_ping_pending_(false),
283 check_ping_status_pending_(false), 284 check_ping_status_pending_(false),
284 need_to_send_ping_(false), 285 need_to_send_ping_(false),
285 flow_control_(use_flow_control_), 286 flow_control_(false),
286 initial_send_window_size_(spdy::kSpdyStreamInitialWindowSize), 287 initial_send_window_size_(spdy::kSpdyStreamInitialWindowSize),
287 initial_recv_window_size_(spdy::kSpdyStreamInitialWindowSize), 288 initial_recv_window_size_(spdy::kSpdyStreamInitialWindowSize),
288 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)), 289 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)),
289 verify_domain_authentication_(verify_domain_authentication) { 290 verify_domain_authentication_(verify_domain_authentication) {
290 DCHECK(HttpStreamFactory::spdy_enabled()); 291 DCHECK(HttpStreamFactory::spdy_enabled());
291 net_log_.BeginEvent( 292 net_log_.BeginEvent(
292 NetLog::TYPE_SPDY_SESSION, 293 NetLog::TYPE_SPDY_SESSION,
293 make_scoped_refptr( 294 make_scoped_refptr(
294 new NetLogSpdySessionParameter(host_port_proxy_pair_))); 295 new NetLogSpdySessionParameter(host_port_proxy_pair_)));
295 296
297 // In unittests, check if use_flow_control_ is enabled or disabled.
wtc 2012/01/26 00:13:26 Nit: change all occurrences of "unittests" to "uni
ramant (doing other things) 2012/01/26 18:58:48 Done. Until the server is ready to support flow c
298 if (use_flow_control_ == SpdySession::kEnableFlowControl)
299 flow_control_ = true;
300
296 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. 301 // TODO(mbelshe): consider randomization of the stream_hi_water_mark.
297 302
298 buffered_spdy_framer_.set_visitor(this); 303 buffered_spdy_framer_.set_visitor(this);
299 304
300 SendSettings(); 305 SendSettings();
301 } 306 }
302 307
303 SpdySession::PendingCreateStream::~PendingCreateStream() {} 308 SpdySession::PendingCreateStream::~PendingCreateStream() {}
304 309
305 SpdySession::CallbackResultPair::~CallbackResultPair() {} 310 SpdySession::CallbackResultPair::~CallbackResultPair() {}
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 342
338 state_ = CONNECTED; 343 state_ = CONNECTED;
339 connection_.reset(connection); 344 connection_.reset(connection);
340 is_secure_ = is_secure; 345 is_secure_ = is_secure;
341 certificate_error_code_ = certificate_error_code; 346 certificate_error_code_ = certificate_error_code;
342 347
343 if (is_secure_) { 348 if (is_secure_) {
344 SSLClientSocket* ssl_socket = 349 SSLClientSocket* ssl_socket =
345 reinterpret_cast<SSLClientSocket*>(connection_->socket()); 350 reinterpret_cast<SSLClientSocket*>(connection_->socket());
346 DCHECK(ssl_socket); 351 DCHECK(ssl_socket);
347 if (ssl_socket->protocol_negotiated() == SSLClientSocket::kProtoSPDY21) 352 if (ssl_socket->protocol_negotiated() == SSLClientSocket::kProtoSPDY21) {
348 flow_control_ = true; 353 flow_control_ = true;
354
355 // In unittests, check if use_flow_control_ is enabled or disabled.
356 if (use_flow_control_ == SpdySession::kDisableFlowControl)
357 flow_control_ = false;
358
wtc 2012/01/26 00:13:26 Delete this blank line.
ramant (doing other things) 2012/01/26 18:58:48 Done.
359 } else {
360 flow_control_ = false;
361
362 // In unittests, check if use_flow_control_ is enabled or disabled.
363 if (use_flow_control_ == SpdySession::kEnableFlowControl)
364 flow_control_ = true;
365 }
wtc 2012/01/26 00:13:26 This logic is hard to understand. It would be nic
ramant (doing other things) 2012/01/26 18:58:48 Done.
349 } 366 }
350 367
351 // Write out any data that we might have to send, such as the settings frame. 368 // Write out any data that we might have to send, such as the settings frame.
352 WriteSocketLater(); 369 WriteSocketLater();
353 net::Error error = ReadSocket(); 370 net::Error error = ReadSocket();
354 if (error == ERR_IO_PENDING) 371 if (error == ERR_IO_PENDING)
355 return OK; 372 return OK;
356 return error; 373 return error;
357 } 374 }
358 375
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 if (it == pending_callback_map_.end()) 1768 if (it == pending_callback_map_.end())
1752 return; 1769 return;
1753 1770
1754 CompletionCallback callback = it->second.callback; 1771 CompletionCallback callback = it->second.callback;
1755 int result = it->second.result; 1772 int result = it->second.result;
1756 pending_callback_map_.erase(it); 1773 pending_callback_map_.erase(it);
1757 callback.Run(result); 1774 callback.Run(result);
1758 } 1775 }
1759 1776
1760 } // namespace net 1777 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698