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_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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1691 | 1691 |
| 1692 void QuicStreamFactory::MaybeInitialize() { | 1692 void QuicStreamFactory::MaybeInitialize() { |
| 1693 // We don't initialize data from HttpServerProperties in the constructor | 1693 // We don't initialize data from HttpServerProperties in the constructor |
| 1694 // because HttpServerProperties has not yet initialized. We're guaranteed | 1694 // because HttpServerProperties has not yet initialized. We're guaranteed |
| 1695 // HttpServerProperties has been initialized by the first time a request is | 1695 // HttpServerProperties has been initialized by the first time a request is |
| 1696 // made. | 1696 // made. |
| 1697 if (has_initialized_data_) | 1697 if (has_initialized_data_) |
| 1698 return; | 1698 return; |
| 1699 | 1699 |
| 1700 has_initialized_data_ = true; | 1700 has_initialized_data_ = true; |
| 1701 for (const std::pair<const HostPortPair, AlternativeServiceInfoVector>& | 1701 for (const std::pair<const url::SchemeHostPort, AlternativeServiceInfoVector>& |
| 1702 key_value : http_server_properties_->alternative_service_map()) { | 1702 key_value : http_server_properties_->alternative_service_map()) { |
| 1703 HostPortPair host_port_pair(key_value.first.host(), key_value.first.port()); | |
|
Ryan Hamilton
2016/04/18 17:18:40
nit: move this down to where it's used (or perhaps
Zhongyi Shi
2016/04/18 19:26:37
It's used multiple times in the inner for loop. I
| |
| 1703 for (const AlternativeServiceInfo& alternative_service_info : | 1704 for (const AlternativeServiceInfo& alternative_service_info : |
| 1704 key_value.second) { | 1705 key_value.second) { |
| 1705 if (alternative_service_info.alternative_service.protocol == QUIC) { | 1706 if (alternative_service_info.alternative_service.protocol == QUIC) { |
| 1706 quic_supported_servers_at_startup_.insert(key_value.first); | 1707 quic_supported_servers_at_startup_.insert(host_port_pair); |
| 1707 break; | 1708 break; |
| 1708 } | 1709 } |
| 1709 } | 1710 } |
| 1710 } | 1711 } |
| 1711 | 1712 |
| 1712 if (http_server_properties_->max_server_configs_stored_in_properties() == 0) | 1713 if (http_server_properties_->max_server_configs_stored_in_properties() == 0) |
| 1713 return; | 1714 return; |
| 1714 // Create a temporary QuicServerInfo object to deserialize and to populate the | 1715 // Create a temporary QuicServerInfo object to deserialize and to populate the |
| 1715 // in-memory crypto server config cache in the MRU order. | 1716 // in-memory crypto server config cache in the MRU order. |
| 1716 scoped_ptr<QuicServerInfo> server_info; | 1717 scoped_ptr<QuicServerInfo> server_info; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1769 // Since the session was active, there's no longer an | 1770 // Since the session was active, there's no longer an |
| 1770 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1771 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1771 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1772 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1772 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1773 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1773 // still race. | 1774 // still race. |
| 1774 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1775 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1775 alternative_service); | 1776 alternative_service); |
| 1776 } | 1777 } |
| 1777 | 1778 |
| 1778 } // namespace net | 1779 } // namespace net |
| OLD | NEW |