Chromium Code Reviews| 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/quic/quic_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 | 754 |
| 755 void QuicClientSession::StartReading() { | 755 void QuicClientSession::StartReading() { |
| 756 if (read_pending_) { | 756 if (read_pending_) { |
| 757 return; | 757 return; |
| 758 } | 758 } |
| 759 read_pending_ = true; | 759 read_pending_ = true; |
| 760 int rv = socket_->Read(read_buffer_.get(), | 760 int rv = socket_->Read(read_buffer_.get(), |
| 761 read_buffer_->size(), | 761 read_buffer_->size(), |
| 762 base::Bind(&QuicClientSession::OnReadComplete, | 762 base::Bind(&QuicClientSession::OnReadComplete, |
| 763 weak_factory_.GetWeakPtr())); | 763 weak_factory_.GetWeakPtr())); |
| 764 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.AyncRead", rv == ERR_IO_PENDING); | |
|
ramant (doing other things)
2014/12/05 20:05:24
nit: AyncRead -> AsyncRead
Ryan Hamilton
2014/12/05 20:23:09
Done.
| |
| 764 if (rv == ERR_IO_PENDING) { | 765 if (rv == ERR_IO_PENDING) { |
| 765 num_packets_read_ = 0; | 766 num_packets_read_ = 0; |
| 766 return; | 767 return; |
| 767 } | 768 } |
| 768 | 769 |
| 769 if (++num_packets_read_ > 32) { | 770 if (++num_packets_read_ > 32) { |
| 770 num_packets_read_ = 0; | 771 num_packets_read_ = 0; |
| 771 // Data was read, process it. | 772 // Data was read, process it. |
| 772 // Schedule the work through the message loop to 1) prevent infinite | 773 // Schedule the work through the message loop to 1) prevent infinite |
| 773 // recursion and 2) avoid blocking the thread for too long. | 774 // recursion and 2) avoid blocking the thread for too long. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 932 return; | 933 return; |
| 933 | 934 |
| 934 // TODO(rch): re-enable this code once beta is cut. | 935 // TODO(rch): re-enable this code once beta is cut. |
| 935 // if (stream_factory_) | 936 // if (stream_factory_) |
| 936 // stream_factory_->OnSessionConnectTimeout(this); | 937 // stream_factory_->OnSessionConnectTimeout(this); |
| 937 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 938 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
| 938 // DCHECK_EQ(0u, GetNumOpenStreams()); | 939 // DCHECK_EQ(0u, GetNumOpenStreams()); |
| 939 } | 940 } |
| 940 | 941 |
| 941 } // namespace net | 942 } // namespace net |
| OLD | NEW |