| 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 http_server_properties_->GetServerNetworkStats( | 1123 http_server_properties_->GetServerNetworkStats( |
| 1124 server_id.host_port_pair()); | 1124 server_id.host_port_pair()); |
| 1125 if (stats == nullptr) | 1125 if (stats == nullptr) |
| 1126 return 0; | 1126 return 0; |
| 1127 return stats->srtt.InMicroseconds(); | 1127 return stats->srtt.InMicroseconds(); |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 void QuicStreamFactory::InitializeCachedStateInCryptoConfig( | 1130 void QuicStreamFactory::InitializeCachedStateInCryptoConfig( |
| 1131 const QuicServerId& server_id, | 1131 const QuicServerId& server_id, |
| 1132 const scoped_ptr<QuicServerInfo>& server_info) { | 1132 const scoped_ptr<QuicServerInfo>& server_info) { |
| 1133 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1134 tracked_objects::ScopedTracker tracking_profile1( |
| 1135 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1136 "422516 QuicStreamFactory::InitializeCachedStateInCryptoConfig1")); |
| 1137 |
| 1133 // |server_info| will be NULL, if a non-empty server config already exists in | 1138 // |server_info| will be NULL, if a non-empty server config already exists in |
| 1134 // the memory cache. This is a minor optimization to avoid LookupOrCreate. | 1139 // the memory cache. This is a minor optimization to avoid LookupOrCreate. |
| 1135 if (!server_info) | 1140 if (!server_info) |
| 1136 return; | 1141 return; |
| 1137 | 1142 |
| 1138 QuicCryptoClientConfig::CachedState* cached = | 1143 QuicCryptoClientConfig::CachedState* cached = |
| 1139 crypto_config_.LookupOrCreate(server_id); | 1144 crypto_config_.LookupOrCreate(server_id); |
| 1140 if (!cached->IsEmpty()) | 1145 if (!cached->IsEmpty()) |
| 1141 return; | 1146 return; |
| 1142 | 1147 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1154 // If the AlternateProtocolMap contained an entry for this host, check if | 1159 // If the AlternateProtocolMap contained an entry for this host, check if |
| 1155 // the disk cache contained an entry for it. | 1160 // the disk cache contained an entry for it. |
| 1156 if (ContainsKey(quic_supported_servers_at_startup_, | 1161 if (ContainsKey(quic_supported_servers_at_startup_, |
| 1157 server_id.host_port_pair())) { | 1162 server_id.host_port_pair())) { |
| 1158 UMA_HISTOGRAM_BOOLEAN( | 1163 UMA_HISTOGRAM_BOOLEAN( |
| 1159 "Net.QuicServerInfo.ExpectConfigMissingFromDiskCache", | 1164 "Net.QuicServerInfo.ExpectConfigMissingFromDiskCache", |
| 1160 server_info->state().server_config.empty()); | 1165 server_info->state().server_config.empty()); |
| 1161 } | 1166 } |
| 1162 } | 1167 } |
| 1163 | 1168 |
| 1169 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1170 tracked_objects::ScopedTracker tracking_profile2( |
| 1171 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1172 "422516 QuicStreamFactory::InitializeCachedStateInCryptoConfig2")); |
| 1173 |
| 1164 if (!cached->Initialize(server_info->state().server_config, | 1174 if (!cached->Initialize(server_info->state().server_config, |
| 1165 server_info->state().source_address_token, | 1175 server_info->state().source_address_token, |
| 1166 server_info->state().certs, | 1176 server_info->state().certs, |
| 1167 server_info->state().server_config_sig, | 1177 server_info->state().server_config_sig, |
| 1168 clock_->WallNow())) | 1178 clock_->WallNow())) |
| 1169 return; | 1179 return; |
| 1170 | 1180 |
| 1171 if (!server_id.is_https()) { | 1181 if (!server_id.is_https()) { |
| 1172 // Don't check the certificates for insecure QUIC. | 1182 // Don't check the certificates for insecure QUIC. |
| 1173 cached->SetProofValid(); | 1183 cached->SetProofValid(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 http_server_properties_->ClearAlternateProtocol(server); | 1233 http_server_properties_->ClearAlternateProtocol(server); |
| 1224 http_server_properties_->SetAlternateProtocol( | 1234 http_server_properties_->SetAlternateProtocol( |
| 1225 server, alternate.port, alternate.protocol, 1); | 1235 server, alternate.port, alternate.protocol, 1); |
| 1226 DCHECK_EQ(QUIC, | 1236 DCHECK_EQ(QUIC, |
| 1227 http_server_properties_->GetAlternateProtocol(server).protocol); | 1237 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 1228 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1238 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 1229 server)); | 1239 server)); |
| 1230 } | 1240 } |
| 1231 | 1241 |
| 1232 } // namespace net | 1242 } // namespace net |
| OLD | NEW |