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

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

Issue 11644088: SPDY - implement greedy approach to read all the data and process it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 <map> 7 #include <map>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 http_server_properties_(http_server_properties), 233 http_server_properties_(http_server_properties),
234 connection_(new ClientSocketHandle), 234 connection_(new ClientSocketHandle),
235 read_buffer_(new IOBuffer(kReadBufferSize)), 235 read_buffer_(new IOBuffer(kReadBufferSize)),
236 read_pending_(false), 236 read_pending_(false),
237 stream_hi_water_mark_(kFirstStreamId), 237 stream_hi_water_mark_(kFirstStreamId),
238 write_pending_(false), 238 write_pending_(false),
239 delayed_write_pending_(false), 239 delayed_write_pending_(false),
240 is_secure_(false), 240 is_secure_(false),
241 certificate_error_code_(OK), 241 certificate_error_code_(OK),
242 error_(OK), 242 error_(OK),
243 state_(IDLE), 243 state_(STATE_IDLE),
244 max_concurrent_streams_(initial_max_concurrent_streams == 0 ? 244 max_concurrent_streams_(initial_max_concurrent_streams == 0 ?
245 kInitialMaxConcurrentStreams : 245 kInitialMaxConcurrentStreams :
246 initial_max_concurrent_streams), 246 initial_max_concurrent_streams),
247 max_concurrent_streams_limit_(max_concurrent_streams_limit == 0 ? 247 max_concurrent_streams_limit_(max_concurrent_streams_limit == 0 ?
248 kMaxConcurrentStreamLimit : 248 kMaxConcurrentStreamLimit :
249 max_concurrent_streams_limit), 249 max_concurrent_streams_limit),
250 streams_initiated_count_(0), 250 streams_initiated_count_(0),
251 streams_pushed_count_(0), 251 streams_pushed_count_(0),
252 streams_pushed_and_claimed_count_(0), 252 streams_pushed_and_claimed_count_(0),
253 streams_abandoned_count_(0), 253 streams_abandoned_count_(0),
254 bytes_received_(0), 254 total_bytes_received_(0),
255 bytes_read_(0),
255 sent_settings_(false), 256 sent_settings_(false),
256 received_settings_(false), 257 received_settings_(false),
257 stalled_streams_(0), 258 stalled_streams_(0),
258 pings_in_flight_(0), 259 pings_in_flight_(0),
259 next_ping_id_(1), 260 next_ping_id_(1),
260 last_activity_time_(base::TimeTicks::Now()), 261 last_activity_time_(base::TimeTicks::Now()),
261 check_ping_status_pending_(false), 262 check_ping_status_pending_(false),
262 flow_control_(false), 263 flow_control_(false),
263 initial_send_window_size_(kSpdyStreamInitialWindowSize), 264 initial_send_window_size_(kSpdyStreamInitialWindowSize),
264 initial_recv_window_size_(initial_recv_window_size == 0 ? 265 initial_recv_window_size_(initial_recv_window_size == 0 ?
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 305
305 SpdySession::CallbackResultPair::CallbackResultPair( 306 SpdySession::CallbackResultPair::CallbackResultPair(
306 const CompletionCallback& callback_in, int result_in) 307 const CompletionCallback& callback_in, int result_in)
307 : callback(callback_in), 308 : callback(callback_in),
308 result(result_in) { 309 result(result_in) {
309 } 310 }
310 311
311 SpdySession::CallbackResultPair::~CallbackResultPair() {} 312 SpdySession::CallbackResultPair::~CallbackResultPair() {}
312 313
313 SpdySession::~SpdySession() { 314 SpdySession::~SpdySession() {
314 if (state_ != CLOSED) { 315 if (state_ != STATE_CLOSED) {
315 state_ = CLOSED; 316 state_ = STATE_CLOSED;
316 317
317 // Cleanup all the streams. 318 // Cleanup all the streams.
318 CloseAllStreams(net::ERR_ABORTED); 319 CloseAllStreams(net::ERR_ABORTED);
319 } 320 }
320 321
321 if (connection_->is_initialized()) { 322 if (connection_->is_initialized()) {
322 // With SPDY we can't recycle sockets. 323 // With SPDY we can't recycle sockets.
323 connection_->socket()->Disconnect(); 324 connection_->socket()->Disconnect();
324 } 325 }
325 326
326 // Streams should all be gone now. 327 // Streams should all be gone now.
327 DCHECK_EQ(0u, num_active_streams()); 328 DCHECK_EQ(0u, num_active_streams());
328 DCHECK_EQ(0u, num_unclaimed_pushed_streams()); 329 DCHECK_EQ(0u, num_unclaimed_pushed_streams());
329 330
330 DCHECK(pending_callback_map_.empty()); 331 DCHECK(pending_callback_map_.empty());
331 332
332 RecordHistograms(); 333 RecordHistograms();
333 334
334 net_log_.EndEvent(NetLog::TYPE_SPDY_SESSION); 335 net_log_.EndEvent(NetLog::TYPE_SPDY_SESSION);
335 } 336 }
336 337
337 net::Error SpdySession::InitializeWithSocket( 338 net::Error SpdySession::InitializeWithSocket(
338 ClientSocketHandle* connection, 339 ClientSocketHandle* connection,
339 bool is_secure, 340 bool is_secure,
340 int certificate_error_code) { 341 int certificate_error_code) {
341 base::StatsCounter spdy_sessions("spdy.sessions"); 342 base::StatsCounter spdy_sessions("spdy.sessions");
342 spdy_sessions.Increment(); 343 spdy_sessions.Increment();
343 344
344 state_ = CONNECTED; 345 state_ = STATE_DO_READ;
345 connection_.reset(connection); 346 connection_.reset(connection);
346 is_secure_ = is_secure; 347 is_secure_ = is_secure;
347 certificate_error_code_ = certificate_error_code; 348 certificate_error_code_ = certificate_error_code;
348 349
349 NextProto protocol = default_protocol_; 350 NextProto protocol = default_protocol_;
350 NextProto protocol_negotiated = connection->socket()->GetNegotiatedProtocol(); 351 NextProto protocol_negotiated = connection->socket()->GetNegotiatedProtocol();
351 if (protocol_negotiated != kProtoUnknown) { 352 if (protocol_negotiated != kProtoUnknown) {
352 protocol = protocol_negotiated; 353 protocol = protocol_negotiated;
353 } 354 }
354 355
(...skipping 11 matching lines...) Expand all
366 flow_control_ = (protocol >= kProtoSPDY3); 367 flow_control_ = (protocol >= kProtoSPDY3);
367 368
368 buffered_spdy_framer_.reset(new BufferedSpdyFramer(version, 369 buffered_spdy_framer_.reset(new BufferedSpdyFramer(version,
369 enable_compression_)); 370 enable_compression_));
370 buffered_spdy_framer_->set_visitor(this); 371 buffered_spdy_framer_->set_visitor(this);
371 SendInitialSettings(); 372 SendInitialSettings();
372 UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol, kProtoMaximumVersion); 373 UMA_HISTOGRAM_ENUMERATION("Net.SpdyVersion", protocol, kProtoMaximumVersion);
373 374
374 // Write out any data that we might have to send, such as the settings frame. 375 // Write out any data that we might have to send, such as the settings frame.
375 WriteSocketLater(); 376 WriteSocketLater();
376 net::Error error = ReadSocket(); 377 int error = DoLoop(OK);
377 if (error == ERR_IO_PENDING) 378 if (error == ERR_IO_PENDING)
378 return OK; 379 return OK;
379 return error; 380 return static_cast<net::Error>(error);
380 } 381 }
381 382
382 bool SpdySession::VerifyDomainAuthentication(const std::string& domain) { 383 bool SpdySession::VerifyDomainAuthentication(const std::string& domain) {
383 if (!verify_domain_authentication_) 384 if (!verify_domain_authentication_)
384 return true; 385 return true;
385 386
386 if (state_ != CONNECTED) 387 if (!IsConnected())
387 return false; 388 return false;
388 389
389 SSLInfo ssl_info; 390 SSLInfo ssl_info;
390 bool was_npn_negotiated; 391 bool was_npn_negotiated;
391 NextProto protocol_negotiated = kProtoUnknown; 392 NextProto protocol_negotiated = kProtoUnknown;
392 if (!GetSSLInfo(&ssl_info, &was_npn_negotiated, &protocol_negotiated)) 393 if (!GetSSLInfo(&ssl_info, &was_npn_negotiated, &protocol_negotiated))
393 return true; // This is not a secure session, so all domains are okay. 394 return true; // This is not a secure session, so all domains are okay.
394 395
395 return !ssl_info.client_cert_sent && 396 return !ssl_info.client_cert_sent &&
396 (enable_credential_frames_ || !ssl_info.channel_id_sent || 397 (enable_credential_frames_ || !ssl_info.channel_id_sent ||
397 ServerBoundCertService::GetDomainForHost(domain) == 398 ServerBoundCertService::GetDomainForHost(domain) ==
398 ServerBoundCertService::GetDomainForHost( 399 ServerBoundCertService::GetDomainForHost(
399 host_port_proxy_pair_.first.host())) && 400 host_port_proxy_pair_.first.host())) &&
400 ssl_info.cert->VerifyNameMatch(domain); 401 ssl_info.cert->VerifyNameMatch(domain);
401 } 402 }
402 403
403 void SpdySession::SetStreamHasWriteAvailable(SpdyStream* stream, 404 void SpdySession::SetStreamHasWriteAvailable(SpdyStream* stream,
404 SpdyIOBufferProducer* producer) { 405 SpdyIOBufferProducer* producer) {
405 write_queue_.push(producer); 406 write_queue_.push(producer);
406 stream_producers_[producer] = stream; 407 stream_producers_[producer] = stream;
407 WriteSocketLater(); 408 WriteSocketLater();
408 } 409 }
409 410
410 int SpdySession::GetPushStream( 411 int SpdySession::GetPushStream(
411 const GURL& url, 412 const GURL& url,
412 scoped_refptr<SpdyStream>* stream, 413 scoped_refptr<SpdyStream>* stream,
413 const BoundNetLog& stream_net_log) { 414 const BoundNetLog& stream_net_log) {
414 CHECK_NE(state_, CLOSED); 415 CHECK_NE(state_, STATE_CLOSED);
415 416
416 *stream = NULL; 417 *stream = NULL;
417 418
418 // Don't allow access to secure push streams over an unauthenticated, but 419 // Don't allow access to secure push streams over an unauthenticated, but
419 // encrypted SSL socket. 420 // encrypted SSL socket.
420 if (is_secure_ && certificate_error_code_ != OK && 421 if (is_secure_ && certificate_error_code_ != OK &&
421 (url.SchemeIs("https") || url.SchemeIs("wss"))) { 422 (url.SchemeIs("https") || url.SchemeIs("wss"))) {
422 RecordProtocolErrorHistogram( 423 RecordProtocolErrorHistogram(
423 PROTOCOL_ERROR_REQUEST_FOR_SECURE_CONTENT_OVER_INSECURE_SESSION); 424 PROTOCOL_ERROR_REQUEST_FOR_SECURE_CONTENT_OVER_INSECURE_SESSION);
424 CloseSessionOnError( 425 CloseSessionOnError(
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 return ContainsKey(active_streams_, stream_id); 761 return ContainsKey(active_streams_, stream_id);
761 } 762 }
762 763
763 LoadState SpdySession::GetLoadState() const { 764 LoadState SpdySession::GetLoadState() const {
764 // NOTE: The application only queries the LoadState via the 765 // NOTE: The application only queries the LoadState via the
765 // SpdyNetworkTransaction, and details are only needed when 766 // SpdyNetworkTransaction, and details are only needed when
766 // we're in the process of connecting. 767 // we're in the process of connecting.
767 768
768 // If we're connecting, defer to the connection to give us the actual 769 // If we're connecting, defer to the connection to give us the actual
769 // LoadState. 770 // LoadState.
770 if (state_ == CONNECTING) 771 if (state_ == STATE_CONNECTING)
771 return connection_->GetLoadState(); 772 return connection_->GetLoadState();
772 773
773 // Just report that we're idle since the session could be doing 774 // Just report that we're idle since the session could be doing
774 // many things concurrently. 775 // many things concurrently.
775 return LOAD_STATE_IDLE; 776 return LOAD_STATE_IDLE;
776 } 777 }
777 778
778 void SpdySession::OnReadComplete(int bytes_read) { 779 void SpdySession::OnReadComplete(int bytes_read) {
780 DCHECK_NE(state_, STATE_DO_READ);
781 read_pending_ = false;
782 DoLoop(bytes_read);
783 }
784
785 void SpdySession::StartRead() {
786 DCHECK_NE(state_, STATE_DO_READ_COMPLETE);
787 read_pending_ = false;
788 DoLoop(OK);
789 }
790
791 int SpdySession::DoLoop(int result) {
792 bytes_read_ = 0;
793 do {
794 if (read_pending_)
795 return OK;
796
797 switch (state_) {
798 case STATE_DO_READ:
799 DCHECK_EQ(result, OK);
800 result = DoRead();
801 break;
802 case STATE_DO_READ_COMPLETE:
803 result = DoReadComplete(result);
804 break;
805 case STATE_CLOSED:
806 result = ERR_CONNECTION_CLOSED;
807 break;
808 default:
809 NOTREACHED() << "state_: " << state_;
810 break;
811 }
812 } while (result != ERR_IO_PENDING && result != ERR_CONNECTION_CLOSED);
813
814 return result;
815 }
816
817 int SpdySession::DoRead() {
818 DCHECK(!read_pending_);
819 if (bytes_read_ > kMaxReadBytes) {
820 state_ = STATE_DO_READ;
821 MessageLoop::current()->PostTask(
822 FROM_HERE,
823 base::Bind(&SpdySession::StartRead,
824 weak_factory_.GetWeakPtr()));
825 return ERR_IO_PENDING;
826 }
827
828 CHECK(connection_.get());
829 CHECK(connection_->socket());
830 state_ = STATE_DO_READ_COMPLETE;
831 int result = connection_->socket()->Read(
832 read_buffer_.get(),
833 kReadBufferSize,
834 base::Bind(&SpdySession::OnReadComplete, base::Unretained(this)));
835 if (result == net::ERR_IO_PENDING)
836 read_pending_ = true;
837 return result;
838 }
839
840 int SpdySession::DoReadComplete(int bytes_read) {
779 // Parse a frame. For now this code requires that the frame fit into our 841 // Parse a frame. For now this code requires that the frame fit into our
780 // buffer (32KB). 842 // buffer (32KB).
781 // TODO(mbelshe): support arbitrarily large frames! 843 // TODO(mbelshe): support arbitrarily large frames!
782 844
783 read_pending_ = false; 845 DCHECK(!read_pending_);
784 846
785 if (bytes_read <= 0) { 847 if (bytes_read <= 0) {
786 // Session is tearing down. 848 // Session is tearing down.
787 net::Error error = static_cast<net::Error>(bytes_read); 849 net::Error error = static_cast<net::Error>(bytes_read);
788 if (bytes_read == 0) 850 if (bytes_read == 0)
789 error = ERR_CONNECTION_CLOSED; 851 error = ERR_CONNECTION_CLOSED;
790 CloseSessionOnError(error, true, "bytes_read is <= 0."); 852 CloseSessionOnError(error, true, "bytes_read is <= 0.");
791 return; 853 return ERR_CONNECTION_CLOSED;
792 } 854 }
793 855
794 bytes_received_ += bytes_read; 856 total_bytes_received_ += bytes_read;
857 bytes_read_ += bytes_read;
795 858
796 last_activity_time_ = base::TimeTicks::Now(); 859 last_activity_time_ = base::TimeTicks::Now();
797 860
798 // The SpdyFramer will use callbacks onto |this| as it parses frames. 861 // The SpdyFramer will use callbacks onto |this| as it parses frames.
799 // When errors occur, those callbacks can lead to teardown of all references 862 // When errors occur, those callbacks can lead to teardown of all references
800 // to |this|, so maintain a reference to self during this call for safe 863 // to |this|, so maintain a reference to self during this call for safe
801 // cleanup. 864 // cleanup.
802 scoped_refptr<SpdySession> self(this); 865 scoped_refptr<SpdySession> self(this);
803 866
804 DCHECK(buffered_spdy_framer_.get()); 867 DCHECK(buffered_spdy_framer_.get());
805 char *data = read_buffer_->data(); 868 char *data = read_buffer_->data();
806 while (bytes_read && 869 while (bytes_read &&
807 buffered_spdy_framer_->error_code() == 870 buffered_spdy_framer_->error_code() ==
808 SpdyFramer::SPDY_NO_ERROR) { 871 SpdyFramer::SPDY_NO_ERROR) {
809 uint32 bytes_processed = 872 uint32 bytes_processed =
810 buffered_spdy_framer_->ProcessInput(data, bytes_read); 873 buffered_spdy_framer_->ProcessInput(data, bytes_read);
811 bytes_read -= bytes_processed; 874 bytes_read -= bytes_processed;
812 data += bytes_processed; 875 data += bytes_processed;
813 if (buffered_spdy_framer_->state() == SpdyFramer::SPDY_DONE) 876 if (buffered_spdy_framer_->state() == SpdyFramer::SPDY_DONE)
814 buffered_spdy_framer_->Reset(); 877 buffered_spdy_framer_->Reset();
815 } 878 }
816 879
817 if (state_ != CLOSED) 880 if (IsConnected())
818 ReadSocket(); 881 state_ = STATE_DO_READ;
882 return OK;
819 } 883 }
820 884
821 void SpdySession::OnWriteComplete(int result) { 885 void SpdySession::OnWriteComplete(int result) {
822 DCHECK(write_pending_); 886 DCHECK(write_pending_);
823 DCHECK(in_flight_write_.size()); 887 DCHECK(in_flight_write_.size());
824 888
825 last_activity_time_ = base::TimeTicks::Now(); 889 last_activity_time_ = base::TimeTicks::Now();
826 write_pending_ = false; 890 write_pending_ = false;
827 891
828 scoped_refptr<SpdyStream> stream = in_flight_write_.stream(); 892 scoped_refptr<SpdyStream> stream = in_flight_write_.stream();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 WriteSocketLater(); 927 WriteSocketLater();
864 } else { 928 } else {
865 in_flight_write_.release(); 929 in_flight_write_.release();
866 930
867 // The stream is now errored. Close it down. 931 // The stream is now errored. Close it down.
868 CloseSessionOnError( 932 CloseSessionOnError(
869 static_cast<net::Error>(result), true, "The stream has errored."); 933 static_cast<net::Error>(result), true, "The stream has errored.");
870 } 934 }
871 } 935 }
872 936
873 net::Error SpdySession::ReadSocket() {
874 if (read_pending_)
875 return OK;
876
877 if (state_ == CLOSED) {
878 NOTREACHED();
879 return ERR_UNEXPECTED;
880 }
881
882 CHECK(connection_.get());
883 CHECK(connection_->socket());
884 int bytes_read = connection_->socket()->Read(
885 read_buffer_.get(),
886 kReadBufferSize,
887 base::Bind(&SpdySession::OnReadComplete, base::Unretained(this)));
888 switch (bytes_read) {
889 case 0:
890 // Socket is closed!
891 CloseSessionOnError(ERR_CONNECTION_CLOSED, true, "bytes_read is 0.");
892 return ERR_CONNECTION_CLOSED;
893 case net::ERR_IO_PENDING:
894 // Waiting for data. Nothing to do now.
895 read_pending_ = true;
896 return ERR_IO_PENDING;
897 default:
898 // Data was read, process it.
899 // Schedule the work through the message loop to avoid recursive
900 // callbacks.
901 read_pending_ = true;
902 MessageLoop::current()->PostTask(
903 FROM_HERE,
904 base::Bind(&SpdySession::OnReadComplete,
905 weak_factory_.GetWeakPtr(), bytes_read));
906 break;
907 }
908 return OK;
909 }
910
911 void SpdySession::WriteSocketLater() { 937 void SpdySession::WriteSocketLater() {
912 if (delayed_write_pending_) 938 if (delayed_write_pending_)
913 return; 939 return;
914 940
915 if (state_ < CONNECTED) 941 if (!IsConnected())
916 return; 942 return;
917 943
918 delayed_write_pending_ = true; 944 delayed_write_pending_ = true;
919 MessageLoop::current()->PostTask( 945 MessageLoop::current()->PostTask(
920 FROM_HERE, 946 FROM_HERE,
921 base::Bind(&SpdySession::WriteSocket, weak_factory_.GetWeakPtr())); 947 base::Bind(&SpdySession::WriteSocket, weak_factory_.GetWeakPtr()));
922 } 948 }
923 949
924 void SpdySession::WriteSocket() { 950 void SpdySession::WriteSocket() {
925 // This function should only be called via WriteSocketLater. 951 // This function should only be called via WriteSocketLater.
926 DCHECK(delayed_write_pending_); 952 DCHECK(delayed_write_pending_);
927 delayed_write_pending_ = false; 953 delayed_write_pending_ = false;
928 954
929 // If the socket isn't connected yet, just wait; we'll get called 955 // If the socket isn't connected yet, just wait; we'll get called
930 // again when the socket connection completes. If the socket is 956 // again when the socket connection completes. If the socket is
931 // closed, just return. 957 // closed, just return.
932 if (state_ < CONNECTED || state_ == CLOSED) 958 if (!IsConnected())
933 return; 959 return;
934 960
935 if (write_pending_) // Another write is in progress still. 961 if (write_pending_) // Another write is in progress still.
936 return; 962 return;
937 963
938 // Loop sending frames until we've sent everything or until the write 964 // Loop sending frames until we've sent everything or until the write
939 // returns error (or ERR_IO_PENDING). 965 // returns error (or ERR_IO_PENDING).
940 DCHECK(buffered_spdy_framer_.get()); 966 DCHECK(buffered_spdy_framer_.get());
941 while (in_flight_write_.buffer() || !write_queue_.empty()) { 967 while (in_flight_write_.buffer() || !write_queue_.empty()) {
942 if (!in_flight_write_.buffer()) { 968 if (!in_flight_write_.buffer()) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 scoped_refptr<SpdySession> self(this); 1070 scoped_refptr<SpdySession> self(this);
1045 1071
1046 DCHECK_LT(err, OK); 1072 DCHECK_LT(err, OK);
1047 net_log_.AddEvent( 1073 net_log_.AddEvent(
1048 NetLog::TYPE_SPDY_SESSION_CLOSE, 1074 NetLog::TYPE_SPDY_SESSION_CLOSE,
1049 base::Bind(&NetLogSpdySessionCloseCallback, err, &description)); 1075 base::Bind(&NetLogSpdySessionCloseCallback, err, &description));
1050 1076
1051 // Don't close twice. This can occur because we can have both 1077 // Don't close twice. This can occur because we can have both
1052 // a read and a write outstanding, and each can complete with 1078 // a read and a write outstanding, and each can complete with
1053 // an error. 1079 // an error.
1054 if (state_ != CLOSED) { 1080 if (!IsClosed()) {
1055 state_ = CLOSED; 1081 state_ = STATE_CLOSED;
1056 error_ = err; 1082 error_ = err;
1057 if (remove_from_pool) 1083 if (remove_from_pool)
1058 RemoveFromPool(); 1084 RemoveFromPool();
1059 CloseAllStreams(err); 1085 CloseAllStreams(err);
1060 } 1086 }
1061 } 1087 }
1062 1088
1063 Value* SpdySession::GetInfoAsValue() const { 1089 Value* SpdySession::GetInfoAsValue() const {
1064 DictionaryValue* dict = new DictionaryValue(); 1090 DictionaryValue* dict = new DictionaryValue();
1065 1091
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 SettingsMap::const_iterator it; 1935 SettingsMap::const_iterator it;
1910 for (it = settings_map.begin(); it != settings_map.end(); ++it) { 1936 for (it = settings_map.begin(); it != settings_map.end(); ++it) {
1911 const SpdySettingsIds id = it->first; 1937 const SpdySettingsIds id = it->first;
1912 const uint32 val = it->second.second; 1938 const uint32 val = it->second.second;
1913 switch (id) { 1939 switch (id) {
1914 case SETTINGS_CURRENT_CWND: 1940 case SETTINGS_CURRENT_CWND:
1915 // Record several different histograms to see if cwnd converges 1941 // Record several different histograms to see if cwnd converges
1916 // for larger volumes of data being sent. 1942 // for larger volumes of data being sent.
1917 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd", 1943 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd",
1918 val, 1, 200, 100); 1944 val, 1, 200, 100);
1919 if (bytes_received_ > 10 * 1024) { 1945 if (total_bytes_received_ > 10 * 1024) {
1920 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd10K", 1946 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd10K",
1921 val, 1, 200, 100); 1947 val, 1, 200, 100);
1922 if (bytes_received_ > 25 * 1024) { 1948 if (total_bytes_received_ > 25 * 1024) {
1923 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd25K", 1949 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd25K",
1924 val, 1, 200, 100); 1950 val, 1, 200, 100);
1925 if (bytes_received_ > 50 * 1024) { 1951 if (total_bytes_received_ > 50 * 1024) {
1926 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd50K", 1952 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd50K",
1927 val, 1, 200, 100); 1953 val, 1, 200, 100);
1928 if (bytes_received_ > 100 * 1024) { 1954 if (total_bytes_received_ > 100 * 1024) {
1929 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd100K", 1955 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd100K",
1930 val, 1, 200, 100); 1956 val, 1, 200, 100);
1931 } 1957 }
1932 } 1958 }
1933 } 1959 }
1934 } 1960 }
1935 break; 1961 break;
1936 case SETTINGS_ROUND_TRIP_TIME: 1962 case SETTINGS_ROUND_TRIP_TIME:
1937 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRTT", 1963 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsRTT",
1938 val, 1, 1200, 100); 1964 val, 1, 1200, 100);
(...skipping 26 matching lines...) Expand all
1965 SSLClientSocket* SpdySession::GetSSLClientSocket() const { 1991 SSLClientSocket* SpdySession::GetSSLClientSocket() const {
1966 if (!is_secure_) 1992 if (!is_secure_)
1967 return NULL; 1993 return NULL;
1968 SSLClientSocket* ssl_socket = 1994 SSLClientSocket* ssl_socket =
1969 reinterpret_cast<SSLClientSocket*>(connection_->socket()); 1995 reinterpret_cast<SSLClientSocket*>(connection_->socket());
1970 DCHECK(ssl_socket); 1996 DCHECK(ssl_socket);
1971 return ssl_socket; 1997 return ssl_socket;
1972 } 1998 }
1973 1999
1974 } // namespace net 2000 } // namespace net
OLDNEW
« net/spdy/spdy_network_transaction_spdy3_unittest.cc ('K') | « net/spdy/spdy_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698