| 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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 18 #include "net/cert/cert_verifier.h" | 19 #include "net/cert/cert_verifier.h" |
| 19 #include "net/dns/host_resolver.h" | 20 #include "net/dns/host_resolver.h" |
| 20 #include "net/dns/single_request_host_resolver.h" | 21 #include "net/dns/single_request_host_resolver.h" |
| 21 #include "net/http/http_server_properties.h" | 22 #include "net/http/http_server_properties.h" |
| 22 #include "net/quic/congestion_control/tcp_receiver.h" | 23 #include "net/quic/congestion_control/tcp_receiver.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 #include "net/quic/quic_default_packet_writer.h" | 34 #include "net/quic/quic_default_packet_writer.h" |
| 34 #include "net/quic/quic_http_stream.h" | 35 #include "net/quic/quic_http_stream.h" |
| 35 #include "net/quic/quic_protocol.h" | 36 #include "net/quic/quic_protocol.h" |
| 36 #include "net/quic/quic_server_id.h" | 37 #include "net/quic/quic_server_id.h" |
| 37 #include "net/socket/client_socket_factory.h" | 38 #include "net/socket/client_socket_factory.h" |
| 38 | 39 |
| 39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 40 #include "base/win/windows_version.h" | 41 #include "base/win/windows_version.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 using std::string; | |
| 44 using std::vector; | |
| 45 | |
| 46 namespace net { | 44 namespace net { |
| 47 | 45 |
| 48 namespace { | 46 namespace { |
| 49 | 47 |
| 50 enum CreateSessionFailure { | 48 enum CreateSessionFailure { |
| 51 CREATION_ERROR_CONNECTING_SOCKET, | 49 CREATION_ERROR_CONNECTING_SOCKET, |
| 52 CREATION_ERROR_SETTING_RECEIVE_BUFFER, | 50 CREATION_ERROR_SETTING_RECEIVE_BUFFER, |
| 53 CREATION_ERROR_SETTING_SEND_BUFFER, | 51 CREATION_ERROR_SETTING_SEND_BUFFER, |
| 54 CREATION_ERROR_MAX | 52 CREATION_ERROR_MAX |
| 55 }; | 53 }; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 break; | 285 break; |
| 288 default: | 286 default: |
| 289 NOTREACHED() << "io_state_: " << io_state_; | 287 NOTREACHED() << "io_state_: " << io_state_; |
| 290 break; | 288 break; |
| 291 } | 289 } |
| 292 } while (io_state_ != STATE_NONE && rv != ERR_IO_PENDING); | 290 } while (io_state_ != STATE_NONE && rv != ERR_IO_PENDING); |
| 293 return rv; | 291 return rv; |
| 294 } | 292 } |
| 295 | 293 |
| 296 void QuicStreamFactory::Job::OnIOComplete(int rv) { | 294 void QuicStreamFactory::Job::OnIOComplete(int rv) { |
| 295 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 296 tracked_objects::ScopedTracker tracking_profile( |
| 297 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 298 "436634 QuicStreamFactory::Job::OnIOComplete")); |
| 299 |
| 297 rv = DoLoop(rv); | 300 rv = DoLoop(rv); |
| 298 | 301 |
| 299 if (rv != ERR_IO_PENDING && !callback_.is_null()) { | 302 if (rv != ERR_IO_PENDING && !callback_.is_null()) { |
| 300 callback_.Run(rv); | 303 callback_.Run(rv); |
| 301 } | 304 } |
| 302 } | 305 } |
| 303 | 306 |
| 304 void QuicStreamFactory::Job::CancelWaitForDataReadyCallback() { | 307 void QuicStreamFactory::Job::CancelWaitForDataReadyCallback() { |
| 305 // If we are waiting for WaitForDataReadyCallback, then cancel the callback. | 308 // If we are waiting for WaitForDataReadyCallback, then cancel the callback. |
| 306 if (io_state_ != STATE_LOAD_SERVER_INFO_COMPLETE) | 309 if (io_state_ != STATE_LOAD_SERVER_INFO_COMPLETE) |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 http_server_properties_->ClearAlternateProtocol(server); | 1079 http_server_properties_->ClearAlternateProtocol(server); |
| 1077 http_server_properties_->SetAlternateProtocol( | 1080 http_server_properties_->SetAlternateProtocol( |
| 1078 server, alternate.port, alternate.protocol, 1); | 1081 server, alternate.port, alternate.protocol, 1); |
| 1079 DCHECK_EQ(QUIC, | 1082 DCHECK_EQ(QUIC, |
| 1080 http_server_properties_->GetAlternateProtocol(server).protocol); | 1083 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1081 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1084 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1082 server)); | 1085 server)); |
| 1083 } | 1086 } |
| 1084 | 1087 |
| 1085 } // namespace net | 1088 } // namespace net |
| OLD | NEW |