| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/linked_ptr.h" | 8 #include "base/linked_ptr.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 error_(OK), | 241 error_(OK), |
| 242 state_(IDLE), | 242 state_(IDLE), |
| 243 max_concurrent_streams_(kDefaultMaxConcurrentStreams), | 243 max_concurrent_streams_(kDefaultMaxConcurrentStreams), |
| 244 streams_initiated_count_(0), | 244 streams_initiated_count_(0), |
| 245 streams_pushed_count_(0), | 245 streams_pushed_count_(0), |
| 246 streams_pushed_and_claimed_count_(0), | 246 streams_pushed_and_claimed_count_(0), |
| 247 streams_abandoned_count_(0), | 247 streams_abandoned_count_(0), |
| 248 frames_received_(0), | 248 frames_received_(0), |
| 249 sent_settings_(false), | 249 sent_settings_(false), |
| 250 received_settings_(false), | 250 received_settings_(false), |
| 251 stalled_streams_(0), |
| 251 initial_send_window_size_(spdy::kSpdyStreamInitialWindowSize), | 252 initial_send_window_size_(spdy::kSpdyStreamInitialWindowSize), |
| 252 initial_recv_window_size_(spdy::kSpdyStreamInitialWindowSize), | 253 initial_recv_window_size_(spdy::kSpdyStreamInitialWindowSize), |
| 253 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)) { | 254 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SPDY_SESSION)) { |
| 254 DCHECK(HttpStreamFactory::spdy_enabled()); | 255 DCHECK(HttpStreamFactory::spdy_enabled()); |
| 255 net_log_.BeginEvent( | 256 net_log_.BeginEvent( |
| 256 NetLog::TYPE_SPDY_SESSION, | 257 NetLog::TYPE_SPDY_SESSION, |
| 257 make_scoped_refptr( | 258 make_scoped_refptr( |
| 258 new NetLogSpdySessionParameter(host_port_proxy_pair_))); | 259 new NetLogSpdySessionParameter(host_port_proxy_pair_))); |
| 259 | 260 |
| 260 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. | 261 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 const GURL& url, | 340 const GURL& url, |
| 340 RequestPriority priority, | 341 RequestPriority priority, |
| 341 scoped_refptr<SpdyStream>* spdy_stream, | 342 scoped_refptr<SpdyStream>* spdy_stream, |
| 342 const BoundNetLog& stream_net_log, | 343 const BoundNetLog& stream_net_log, |
| 343 CompletionCallback* callback) { | 344 CompletionCallback* callback) { |
| 344 if (!max_concurrent_streams_ || | 345 if (!max_concurrent_streams_ || |
| 345 active_streams_.size() < max_concurrent_streams_) { | 346 active_streams_.size() < max_concurrent_streams_) { |
| 346 return CreateStreamImpl(url, priority, spdy_stream, stream_net_log); | 347 return CreateStreamImpl(url, priority, spdy_stream, stream_net_log); |
| 347 } | 348 } |
| 348 | 349 |
| 350 stalled_streams_++; |
| 349 net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_STALLED_MAX_STREAMS, NULL); | 351 net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_STALLED_MAX_STREAMS, NULL); |
| 350 create_stream_queues_[priority].push( | 352 create_stream_queues_[priority].push( |
| 351 PendingCreateStream(url, priority, spdy_stream, | 353 PendingCreateStream(url, priority, spdy_stream, |
| 352 stream_net_log, callback)); | 354 stream_net_log, callback)); |
| 353 return ERR_IO_PENDING; | 355 return ERR_IO_PENDING; |
| 354 } | 356 } |
| 355 | 357 |
| 356 void SpdySession::ProcessPendingCreateStreams() { | 358 void SpdySession::ProcessPendingCreateStreams() { |
| 357 while (!max_concurrent_streams_ || | 359 while (!max_concurrent_streams_ || |
| 358 active_streams_.size() < max_concurrent_streams_) { | 360 active_streams_.size() < max_concurrent_streams_) { |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPushedAndClaimedPerSession", | 1370 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPushedAndClaimedPerSession", |
| 1369 streams_pushed_and_claimed_count_, | 1371 streams_pushed_and_claimed_count_, |
| 1370 0, 300, 50); | 1372 0, 300, 50); |
| 1371 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsAbandonedPerSession", | 1373 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsAbandonedPerSession", |
| 1372 streams_abandoned_count_, | 1374 streams_abandoned_count_, |
| 1373 0, 300, 50); | 1375 0, 300, 50); |
| 1374 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsSent", | 1376 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsSent", |
| 1375 sent_settings_ ? 1 : 0, 2); | 1377 sent_settings_ ? 1 : 0, 2); |
| 1376 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsReceived", | 1378 UMA_HISTOGRAM_ENUMERATION("Net.SpdySettingsReceived", |
| 1377 received_settings_ ? 1 : 0, 2); | 1379 received_settings_ ? 1 : 0, 2); |
| 1380 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession", |
| 1381 stalled_streams_, |
| 1382 0, 300, 50); |
| 1383 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls", |
| 1384 stalled_streams_ > 0 ? 1 : 0, 2); |
| 1378 | 1385 |
| 1379 if (received_settings_) { | 1386 if (received_settings_) { |
| 1380 // Enumerate the saved settings, and set histograms for it. | 1387 // Enumerate the saved settings, and set histograms for it. |
| 1381 const spdy::SpdySettings& settings = spdy_settings_->Get(host_port_pair()); | 1388 const spdy::SpdySettings& settings = spdy_settings_->Get(host_port_pair()); |
| 1382 | 1389 |
| 1383 spdy::SpdySettings::const_iterator it; | 1390 spdy::SpdySettings::const_iterator it; |
| 1384 for (it = settings.begin(); it != settings.end(); ++it) { | 1391 for (it = settings.begin(); it != settings.end(); ++it) { |
| 1385 const spdy::SpdySetting setting = *it; | 1392 const spdy::SpdySetting setting = *it; |
| 1386 switch (setting.first.id()) { | 1393 switch (setting.first.id()) { |
| 1387 case spdy::SETTINGS_CURRENT_CWND: | 1394 case spdy::SETTINGS_CURRENT_CWND: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1412 if (it == pending_callback_map_.end()) | 1419 if (it == pending_callback_map_.end()) |
| 1413 return; | 1420 return; |
| 1414 | 1421 |
| 1415 CompletionCallback* callback = it->second.callback; | 1422 CompletionCallback* callback = it->second.callback; |
| 1416 int result = it->second.result; | 1423 int result = it->second.result; |
| 1417 pending_callback_map_.erase(it); | 1424 pending_callback_map_.erase(it); |
| 1418 callback->Run(result); | 1425 callback->Run(result); |
| 1419 } | 1426 } |
| 1420 | 1427 |
| 1421 } // namespace net | 1428 } // namespace net |
| OLD | NEW |