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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 628 |
629 // TODO(rtenneti): |task_runner_| is used by the Job. Initialize task_runner_ | 629 // TODO(rtenneti): |task_runner_| is used by the Job. Initialize task_runner_ |
630 // in the constructor after WebRequestActionWithThreadsTest.* tests are fixed. | 630 // in the constructor after WebRequestActionWithThreadsTest.* tests are fixed. |
631 if (!task_runner_) | 631 if (!task_runner_) |
632 task_runner_ = base::MessageLoop::current()->message_loop_proxy().get(); | 632 task_runner_ = base::MessageLoop::current()->message_loop_proxy().get(); |
633 | 633 |
634 QuicServerInfo* quic_server_info = nullptr; | 634 QuicServerInfo* quic_server_info = nullptr; |
635 if (quic_server_info_factory_) { | 635 if (quic_server_info_factory_) { |
636 bool load_from_disk_cache = !disable_disk_cache_; | 636 bool load_from_disk_cache = !disable_disk_cache_; |
637 if (http_server_properties_) { | 637 if (http_server_properties_) { |
638 const AlternateProtocolMap& alternate_protocol_map = | 638 const AlternativeServiceMap& alternative_service_map = |
639 http_server_properties_->alternate_protocol_map(); | 639 http_server_properties_->alternative_service_map(); |
640 AlternateProtocolMap::const_iterator it = | 640 AlternativeServiceMap::const_iterator it = |
641 alternate_protocol_map.Peek(server_id.host_port_pair()); | 641 alternative_service_map.Peek(server_id.host_port_pair()); |
642 if (it == alternate_protocol_map.end() || it->second.protocol != QUIC) { | 642 if (it == alternative_service_map.end() || |
| 643 it->second.alternative_service.protocol != QUIC) { |
643 // If there is no entry for QUIC, consider that as a new server and | 644 // If there is no entry for QUIC, consider that as a new server and |
644 // don't wait for Cache thread to load the data for that server. | 645 // don't wait for Cache thread to load the data for that server. |
645 load_from_disk_cache = false; | 646 load_from_disk_cache = false; |
646 } | 647 } |
647 } | 648 } |
648 if (load_from_disk_cache && CryptoConfigCacheIsEmpty(server_id)) { | 649 if (load_from_disk_cache && CryptoConfigCacheIsEmpty(server_id)) { |
649 quic_server_info = quic_server_info_factory_->GetForServer(server_id); | 650 quic_server_info = quic_server_info_factory_->GetForServer(server_id); |
650 } | 651 } |
651 } | 652 } |
652 | 653 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 if (!server_info) | 1130 if (!server_info) |
1130 return; | 1131 return; |
1131 | 1132 |
1132 QuicCryptoClientConfig::CachedState* cached = | 1133 QuicCryptoClientConfig::CachedState* cached = |
1133 crypto_config_.LookupOrCreate(server_id); | 1134 crypto_config_.LookupOrCreate(server_id); |
1134 if (!cached->IsEmpty()) | 1135 if (!cached->IsEmpty()) |
1135 return; | 1136 return; |
1136 | 1137 |
1137 if (http_server_properties_) { | 1138 if (http_server_properties_) { |
1138 if (quic_supported_servers_at_startup_.empty()) { | 1139 if (quic_supported_servers_at_startup_.empty()) { |
1139 for (const std::pair<const HostPortPair, AlternateProtocolInfo>& | 1140 for (const std::pair<const HostPortPair, AlternativeServiceInfo>& |
1140 key_value : http_server_properties_->alternate_protocol_map()) { | 1141 key_value : http_server_properties_->alternative_service_map()) { |
1141 if (key_value.second.protocol == QUIC) { | 1142 if (key_value.second.alternative_service.protocol == QUIC) { |
1142 quic_supported_servers_at_startup_.insert(key_value.first); | 1143 quic_supported_servers_at_startup_.insert(key_value.first); |
1143 } | 1144 } |
1144 } | 1145 } |
1145 } | 1146 } |
1146 | 1147 |
1147 // TODO(rtenneti): Delete the following histogram after collecting stats. | 1148 // TODO(rtenneti): Delete the following histogram after collecting stats. |
1148 // If the AlternateProtocolMap contained an entry for this host, check if | 1149 // If the AlternativeServiceMap contained an entry for this host, check if |
1149 // the disk cache contained an entry for it. | 1150 // the disk cache contained an entry for it. |
1150 if (ContainsKey(quic_supported_servers_at_startup_, | 1151 if (ContainsKey(quic_supported_servers_at_startup_, |
1151 server_id.host_port_pair())) { | 1152 server_id.host_port_pair())) { |
1152 UMA_HISTOGRAM_BOOLEAN( | 1153 UMA_HISTOGRAM_BOOLEAN( |
1153 "Net.QuicServerInfo.ExpectConfigMissingFromDiskCache", | 1154 "Net.QuicServerInfo.ExpectConfigMissingFromDiskCache", |
1154 server_info->state().server_config.empty()); | 1155 server_info->state().server_config.empty()); |
1155 } | 1156 } |
1156 } | 1157 } |
1157 | 1158 |
1158 if (!cached->Initialize(server_info->state().server_config, | 1159 if (!cached->Initialize(server_info->state().server_config, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 // Since the session was active, there's no longer an | 1205 // Since the session was active, there's no longer an |
1205 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1206 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1206 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1207 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1207 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1208 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1208 // still race. | 1209 // still race. |
1209 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1210 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1210 alternative_service); | 1211 alternative_service); |
1211 } | 1212 } |
1212 | 1213 |
1213 } // namespace net | 1214 } // namespace net |
OLD | NEW |