Chromium Code Reviews| Index: net/quic/quic_stream_factory.cc |
| diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc |
| index 20335a57be31b28ccb862869b72a4a6259c74844..0e10bd50186109d3e2b13bd967a7a43e32139197 100644 |
| --- a/net/quic/quic_stream_factory.cc |
| +++ b/net/quic/quic_stream_factory.cc |
| @@ -1712,12 +1712,17 @@ void QuicStreamFactory::MaybeInitialize() { |
| if (http_server_properties_->max_server_configs_stored_in_properties() == 0) |
| return; |
| // Create a temporary QuicServerInfo object to deserialize and to populate the |
| - // in-memory crypto server config cache. |
| + // in-memory crypto server config cache in the MRU order. |
| scoped_ptr<QuicServerInfo> server_info; |
| CompletionCallback callback; |
| - for (const auto& key_value : |
| - http_server_properties_->quic_server_info_map()) { |
| - const QuicServerId& server_id = key_value.first; |
| + // Get the list of servers to be deserialized first because WaitForDataReady |
| + // touches quic_server_info_map. |
| + const QuicServerInfoMap& quic_server_info_map = |
| + http_server_properties_->quic_server_info_map(); |
| + std::vector<QuicServerId> server_list(quic_server_info_map.size()); |
| + for (const auto& key_value : quic_server_info_map) |
| + server_list.insert(server_list.begin(), key_value.first); |
|
Ryan Hamilton
2016/04/06 04:25:54
It looks like this is going to be O(n^2) since it
ramant (doing other things)
2016/04/06 04:56:07
facepalm (thanks for catching this). Used push_bac
|
| + for (QuicServerId server_id : server_list) { |
| server_info.reset(quic_server_info_factory_->GetForServer(server_id)); |
| if (server_info->WaitForDataReady(callback) == OK) { |
| DVLOG(1) << "Initialized server config for: " << server_id.ToString(); |