| 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 new QuicDefaultPacketWriter(socket.get())); | 729 new QuicDefaultPacketWriter(socket.get())); |
| 730 | 730 |
| 731 if (!helper_.get()) { | 731 if (!helper_.get()) { |
| 732 helper_.reset(new QuicConnectionHelper( | 732 helper_.reset(new QuicConnectionHelper( |
| 733 base::MessageLoop::current()->message_loop_proxy().get(), | 733 base::MessageLoop::current()->message_loop_proxy().get(), |
| 734 clock_.get(), random_generator_)); | 734 clock_.get(), random_generator_)); |
| 735 } | 735 } |
| 736 | 736 |
| 737 QuicConnection* connection = | 737 QuicConnection* connection = |
| 738 new QuicConnection(connection_id, addr, helper_.get(), writer.get(), | 738 new QuicConnection(connection_id, addr, helper_.get(), writer.get(), |
| 739 false, supported_versions_, kInitialReceiveWindowSize); | 739 false, supported_versions_); |
| 740 writer->SetConnection(connection); | 740 writer->SetConnection(connection); |
| 741 connection->options()->max_packet_length = max_packet_length_; | 741 connection->options()->max_packet_length = max_packet_length_; |
| 742 | 742 |
| 743 InitializeCachedStateInCryptoConfig(server_id, server_info); | 743 InitializeCachedStateInCryptoConfig(server_id, server_info); |
| 744 | 744 |
| 745 QuicConfig config = config_; | 745 QuicConfig config = config_; |
| 746 if (http_server_properties_) { | 746 if (http_server_properties_) { |
| 747 const HttpServerProperties::NetworkStats* stats = | 747 const HttpServerProperties::NetworkStats* stats = |
| 748 http_server_properties_->GetServerNetworkStats( | 748 http_server_properties_->GetServerNetworkStats( |
| 749 server_id.host_port_pair()); | 749 server_id.host_port_pair()); |
| 750 if (stats != NULL) { | 750 if (stats != NULL) { |
| 751 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 751 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 | 754 |
| 755 *session = new QuicClientSession( | 755 *session = new QuicClientSession( |
| 756 connection, socket.Pass(), writer.Pass(), this, | 756 connection, socket.Pass(), writer.Pass(), this, |
| 757 quic_crypto_client_stream_factory_, server_info.Pass(), server_id, | 757 quic_crypto_client_stream_factory_, server_info.Pass(), server_id, |
| 758 config, &crypto_config_, net_log.net_log()); | 758 config, kInitialReceiveWindowSize, &crypto_config_, net_log.net_log()); |
| 759 all_sessions_[*session] = server_id; // owning pointer | 759 all_sessions_[*session] = server_id; // owning pointer |
| 760 return OK; | 760 return OK; |
| 761 } | 761 } |
| 762 | 762 |
| 763 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { | 763 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { |
| 764 return ContainsKey(active_jobs_, key); | 764 return ContainsKey(active_jobs_, key); |
| 765 } | 765 } |
| 766 | 766 |
| 767 void QuicStreamFactory::ActivateSession( | 767 void QuicStreamFactory::ActivateSession( |
| 768 const QuicServerId& server_id, | 768 const QuicServerId& server_id, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 } | 822 } |
| 823 | 823 |
| 824 HttpServerProperties::NetworkStats network_stats; | 824 HttpServerProperties::NetworkStats network_stats; |
| 825 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); | 825 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); |
| 826 network_stats.bandwidth_estimate = stats.estimated_bandwidth; | 826 network_stats.bandwidth_estimate = stats.estimated_bandwidth; |
| 827 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), | 827 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), |
| 828 network_stats); | 828 network_stats); |
| 829 } | 829 } |
| 830 | 830 |
| 831 } // namespace net | 831 } // namespace net |
| OLD | NEW |