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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "net/dns/host_resolver.h" | 31 #include "net/dns/host_resolver.h" |
32 #include "net/dns/single_request_host_resolver.h" | 32 #include "net/dns/single_request_host_resolver.h" |
33 #include "net/http/bidirectional_stream_impl.h" | 33 #include "net/http/bidirectional_stream_impl.h" |
34 #include "net/quic/bidirectional_stream_quic_impl.h" | 34 #include "net/quic/bidirectional_stream_quic_impl.h" |
35 #include "net/quic/crypto/channel_id_chromium.h" | 35 #include "net/quic/crypto/channel_id_chromium.h" |
36 #include "net/quic/crypto/proof_verifier_chromium.h" | 36 #include "net/quic/crypto/proof_verifier_chromium.h" |
37 #include "net/quic/crypto/properties_based_quic_server_info.h" | 37 #include "net/quic/crypto/properties_based_quic_server_info.h" |
38 #include "net/quic/crypto/quic_random.h" | 38 #include "net/quic/crypto/quic_random.h" |
39 #include "net/quic/crypto/quic_server_info.h" | 39 #include "net/quic/crypto/quic_server_info.h" |
40 #include "net/quic/port_suggester.h" | 40 #include "net/quic/port_suggester.h" |
| 41 #include "net/quic/quic_chromium_alarm_factory.h" |
41 #include "net/quic/quic_chromium_client_session.h" | 42 #include "net/quic/quic_chromium_client_session.h" |
42 #include "net/quic/quic_chromium_connection_helper.h" | 43 #include "net/quic/quic_chromium_connection_helper.h" |
43 #include "net/quic/quic_chromium_packet_reader.h" | 44 #include "net/quic/quic_chromium_packet_reader.h" |
44 #include "net/quic/quic_chromium_packet_writer.h" | 45 #include "net/quic/quic_chromium_packet_writer.h" |
45 #include "net/quic/quic_client_promised_info.h" | 46 #include "net/quic/quic_client_promised_info.h" |
46 #include "net/quic/quic_clock.h" | 47 #include "net/quic/quic_clock.h" |
47 #include "net/quic/quic_connection.h" | 48 #include "net/quic/quic_connection.h" |
48 #include "net/quic/quic_crypto_client_stream_factory.h" | 49 #include "net/quic/quic_crypto_client_stream_factory.h" |
49 #include "net/quic/quic_flags.h" | 50 #include "net/quic/quic_flags.h" |
50 #include "net/quic/quic_http_stream.h" | 51 #include "net/quic/quic_http_stream.h" |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 | 1551 |
1551 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", | 1552 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", |
1552 port_suggester->call_count()); | 1553 port_suggester->call_count()); |
1553 if (enable_port_selection) { | 1554 if (enable_port_selection) { |
1554 DCHECK_LE(1u, port_suggester->call_count()); | 1555 DCHECK_LE(1u, port_suggester->call_count()); |
1555 } else { | 1556 } else { |
1556 DCHECK_EQ(0u, port_suggester->call_count()); | 1557 DCHECK_EQ(0u, port_suggester->call_count()); |
1557 } | 1558 } |
1558 | 1559 |
1559 if (!helper_.get()) { | 1560 if (!helper_.get()) { |
1560 helper_.reset(new QuicChromiumConnectionHelper( | 1561 helper_.reset( |
1561 base::ThreadTaskRunnerHandle::Get().get(), clock_.get(), | 1562 new QuicChromiumConnectionHelper(clock_.get(), random_generator_)); |
1562 random_generator_)); | 1563 } |
| 1564 if (!alarm_factory_.get()) { |
| 1565 alarm_factory_.reset(new QuicChromiumAlarmFactory( |
| 1566 base::ThreadTaskRunnerHandle::Get().get(), clock_.get())); |
1563 } | 1567 } |
1564 QuicConnectionId connection_id = random_generator_->RandUint64(); | 1568 QuicConnectionId connection_id = random_generator_->RandUint64(); |
1565 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); | 1569 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); |
1566 | 1570 |
1567 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); | 1571 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); |
1568 QuicConnection* connection = new QuicConnection( | 1572 QuicConnection* connection = new QuicConnection( |
1569 connection_id, addr, helper_.get(), writer, true /* owns_writer */, | 1573 connection_id, addr, helper_.get(), alarm_factory_.get(), writer, |
1570 Perspective::IS_CLIENT, supported_versions_); | 1574 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_); |
1571 writer->SetConnection(connection); | 1575 writer->SetConnection(connection); |
1572 connection->SetMaxPacketLength(max_packet_length_); | 1576 connection->SetMaxPacketLength(max_packet_length_); |
1573 | 1577 |
1574 QuicConfig config = config_; | 1578 QuicConfig config = config_; |
1575 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); | 1579 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); |
1576 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); | 1580 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); |
1577 config.SetInitialSessionFlowControlWindowToSend( | 1581 config.SetInitialSessionFlowControlWindowToSend( |
1578 kQuicSessionMaxRecvWindowSize); | 1582 kQuicSessionMaxRecvWindowSize); |
1579 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); | 1583 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); |
1580 int64_t srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); | 1584 int64_t srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 // Since the session was active, there's no longer an | 1775 // Since the session was active, there's no longer an |
1772 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1776 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1773 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1777 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1774 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1778 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1775 // still race. | 1779 // still race. |
1776 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1780 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1777 alternative_service); | 1781 alternative_service); |
1778 } | 1782 } |
1779 | 1783 |
1780 } // namespace net | 1784 } // namespace net |
OLD | NEW |