Chromium Code Reviews| Index: chrome/browser/net/http_server_properties_manager.cc |
| diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc |
| index 1bde25e4109bab522b0f74f053d5bda727562a0b..9d3392ac29136c4c1caa631c5b891c5f63bf3fb4 100644 |
| --- a/chrome/browser/net/http_server_properties_manager.cc |
| +++ b/chrome/browser/net/http_server_properties_manager.cc |
| @@ -43,6 +43,9 @@ const int kVersionNumber = 2; |
| typedef std::vector<std::string> StringVector; |
| +// Persist 200 MRU AlternateProtocolHostPortPairs. |
| +const int kMaxAlternateProtocolHostsToPersist = 200; |
| + |
| } // namespace |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -177,10 +180,10 @@ void HttpServerPropertiesManager::SetBrokenAlternateProtocol( |
| ScheduleUpdatePrefsOnIO(); |
| } |
| -const net::AlternateProtocolMap& |
| -HttpServerPropertiesManager::alternate_protocol_map() const { |
| +net::AlternateProtocolMap |
| +HttpServerPropertiesManager::GetAlternateProtocolMap() const { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| - return http_server_properties_impl_->alternate_protocol_map(); |
| + return http_server_properties_impl_->GetAlternateProtocolMap(); |
| } |
| const net::SettingsMap& |
| @@ -511,7 +514,7 @@ void HttpServerPropertiesManager::UpdatePrefsFromCacheOnIO( |
| net::AlternateProtocolMap* alternate_protocol_map = |
| new net::AlternateProtocolMap; |
| *alternate_protocol_map = |
| - http_server_properties_impl_->alternate_protocol_map(); |
| + http_server_properties_impl_->GetAlternateProtocolMap(); |
| net::PipelineCapabilityMap* pipeline_capability_map = |
| new net::PipelineCapabilityMap; |
| @@ -585,8 +588,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI( |
| } |
| // Add servers that have SpdySettings to server_pref_map. |
| - for (net::SpdySettingsMap::iterator map_it = |
| - spdy_settings_map->begin(); |
| + for (net::SpdySettingsMap::iterator map_it = spdy_settings_map->begin(); |
| map_it != spdy_settings_map->end(); ++map_it) { |
| const net::HostPortPair& server = map_it->first; |
| @@ -600,9 +602,12 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI( |
| } |
| // Add AlternateProtocol servers to server_pref_map. |
| + int count = 0; |
| for (net::AlternateProtocolMap::const_iterator map_it = |
|
Ryan Hamilton
2014/03/05 00:19:20
What guarantee do we have that this iterator is go
ramant (doing other things)
2014/03/05 15:11:11
Many thanks for the catch. My fault (had only 200
|
| - alternate_protocol_map->begin(); |
| - map_it != alternate_protocol_map->end(); ++map_it) { |
| + alternate_protocol_map->begin(); |
| + map_it != alternate_protocol_map->end() && |
| + count < kMaxAlternateProtocolHostsToPersist; |
| + ++map_it) { |
| const net::HostPortPair& server = map_it->first; |
| const net::PortAlternateProtocolPair& port_alternate_protocol = |
| map_it->second; |
| @@ -617,6 +622,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI( |
| } else { |
| it->second.alternate_protocol = &map_it->second; |
| } |
| + ++count; |
| } |
| for (net::PipelineCapabilityMap::const_iterator map_it = |