| 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" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 ChannelIDService* channel_id_service, | 474 ChannelIDService* channel_id_service, |
| 475 TransportSecurityState* transport_security_state, | 475 TransportSecurityState* transport_security_state, |
| 476 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 476 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
| 477 QuicRandom* random_generator, | 477 QuicRandom* random_generator, |
| 478 QuicClock* clock, | 478 QuicClock* clock, |
| 479 size_t max_packet_length, | 479 size_t max_packet_length, |
| 480 const std::string& user_agent_id, | 480 const std::string& user_agent_id, |
| 481 const QuicVersionVector& supported_versions, | 481 const QuicVersionVector& supported_versions, |
| 482 bool enable_port_selection, | 482 bool enable_port_selection, |
| 483 bool enable_time_based_loss_detection, | 483 bool enable_time_based_loss_detection, |
| 484 bool always_require_handshake_confirmation, |
| 484 const QuicTagVector& connection_options) | 485 const QuicTagVector& connection_options) |
| 485 : require_confirmation_(true), | 486 : require_confirmation_(true), |
| 486 host_resolver_(host_resolver), | 487 host_resolver_(host_resolver), |
| 487 client_socket_factory_(client_socket_factory), | 488 client_socket_factory_(client_socket_factory), |
| 488 http_server_properties_(http_server_properties), | 489 http_server_properties_(http_server_properties), |
| 489 transport_security_state_(transport_security_state), | 490 transport_security_state_(transport_security_state), |
| 490 quic_server_info_factory_(NULL), | 491 quic_server_info_factory_(NULL), |
| 491 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 492 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 492 random_generator_(random_generator), | 493 random_generator_(random_generator), |
| 493 clock_(clock), | 494 clock_(clock), |
| 494 max_packet_length_(max_packet_length), | 495 max_packet_length_(max_packet_length), |
| 495 config_(InitializeQuicConfig(enable_time_based_loss_detection, | 496 config_(InitializeQuicConfig(enable_time_based_loss_detection, |
| 496 connection_options)), | 497 connection_options)), |
| 497 supported_versions_(supported_versions), | 498 supported_versions_(supported_versions), |
| 498 enable_port_selection_(enable_port_selection), | 499 enable_port_selection_(enable_port_selection), |
| 500 always_require_handshake_confirmation_( |
| 501 always_require_handshake_confirmation), |
| 499 port_seed_(random_generator_->RandUint64()), | 502 port_seed_(random_generator_->RandUint64()), |
| 500 weak_factory_(this) { | 503 weak_factory_(this) { |
| 501 DCHECK(transport_security_state_); | 504 DCHECK(transport_security_state_); |
| 502 crypto_config_.SetDefaults(); | 505 crypto_config_.SetDefaults(); |
| 503 crypto_config_.set_user_agent_id(user_agent_id); | 506 crypto_config_.set_user_agent_id(user_agent_id); |
| 504 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 507 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
| 505 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 508 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
| 506 crypto_config_.SetProofVerifier( | 509 crypto_config_.SetProofVerifier( |
| 507 new ProofVerifierChromium(cert_verifier, transport_security_state)); | 510 new ProofVerifierChromium(cert_verifier, transport_security_state)); |
| 508 crypto_config_.SetChannelIDSource( | 511 crypto_config_.SetChannelIDSource( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 active_sessions_[server_id] = session; | 595 active_sessions_[server_id] = session; |
| 593 session_aliases_[session].insert(server_id); | 596 session_aliases_[session].insert(server_id); |
| 594 return true; | 597 return true; |
| 595 } | 598 } |
| 596 } | 599 } |
| 597 return false; | 600 return false; |
| 598 } | 601 } |
| 599 | 602 |
| 600 void QuicStreamFactory::OnJobComplete(Job* job, int rv) { | 603 void QuicStreamFactory::OnJobComplete(Job* job, int rv) { |
| 601 if (rv == OK) { | 604 if (rv == OK) { |
| 602 require_confirmation_ = false; | 605 if (!always_require_handshake_confirmation_) |
| 606 require_confirmation_ = false; |
| 603 | 607 |
| 604 // Create all the streams, but do not notify them yet. | 608 // Create all the streams, but do not notify them yet. |
| 605 for (RequestSet::iterator it = job_requests_map_[job].begin(); | 609 for (RequestSet::iterator it = job_requests_map_[job].begin(); |
| 606 it != job_requests_map_[job].end() ; ++it) { | 610 it != job_requests_map_[job].end() ; ++it) { |
| 607 DCHECK(HasActiveSession(job->server_id())); | 611 DCHECK(HasActiveSession(job->server_id())); |
| 608 (*it)->set_stream(CreateIfSessionExists(job->server_id(), | 612 (*it)->set_stream(CreateIfSessionExists(job->server_id(), |
| 609 (*it)->net_log())); | 613 (*it)->net_log())); |
| 610 } | 614 } |
| 611 } | 615 } |
| 612 while (!job_requests_map_[job].empty()) { | 616 while (!job_requests_map_[job].empty()) { |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 http_server_properties_->ClearAlternateProtocol(server); | 980 http_server_properties_->ClearAlternateProtocol(server); |
| 977 http_server_properties_->SetAlternateProtocol( | 981 http_server_properties_->SetAlternateProtocol( |
| 978 server, alternate.port, alternate.protocol, 1); | 982 server, alternate.port, alternate.protocol, 1); |
| 979 DCHECK_EQ(QUIC, | 983 DCHECK_EQ(QUIC, |
| 980 http_server_properties_->GetAlternateProtocol(server).protocol); | 984 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 981 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 985 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 982 server)); | 986 server)); |
| 983 } | 987 } |
| 984 | 988 |
| 985 } // namespace net | 989 } // namespace net |
| OLD | NEW |