Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: chrome/browser/net/http_server_properties_manager.cc

Issue 188663002: Revert of HttpServerProperties - Implement MRU for AlternateProtocolMap. Persist (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/http_server_properties_manager.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cbe9fd6dd4003389070cab9c078b41ce0540e843..1bde25e4109bab522b0f74f053d5bda727562a0b 100644
--- a/chrome/browser/net/http_server_properties_manager.cc
+++ b/chrome/browser/net/http_server_properties_manager.cc
@@ -42,9 +42,6 @@
const int kVersionNumber = 2;
typedef std::vector<std::string> StringVector;
-
-// Persist 200 MRU AlternateProtocolHostPortPairs.
-const int kMaxAlternateProtocolHostsToPersist = 200;
} // namespace
@@ -151,14 +148,14 @@
}
bool HttpServerPropertiesManager::HasAlternateProtocol(
- const net::HostPortPair& server) {
+ const net::HostPortPair& server) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return http_server_properties_impl_->HasAlternateProtocol(server);
}
net::PortAlternateProtocolPair
HttpServerPropertiesManager::GetAlternateProtocol(
- const net::HostPortPair& server) {
+ const net::HostPortPair& server) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return http_server_properties_impl_->GetAlternateProtocol(server);
}
@@ -323,7 +320,7 @@
scoped_ptr<net::PipelineCapabilityMap> pipeline_capability_map(
new net::PipelineCapabilityMap);
scoped_ptr<net::AlternateProtocolMap> alternate_protocol_map(
- new net::AlternateProtocolMap(kMaxAlternateProtocolHostsToPersist));
+ new net::AlternateProtocolMap);
for (base::DictionaryValue::Iterator it(*servers_dict); !it.IsAtEnd();
it.Advance()) {
@@ -389,8 +386,7 @@
}
// Get alternate_protocol server.
- DCHECK(alternate_protocol_map->Peek(server) ==
- alternate_protocol_map->end());
+ DCHECK(!ContainsKey(*alternate_protocol_map, server));
const base::DictionaryValue* port_alternate_protocol_dict = NULL;
if (!server_pref_dict->GetDictionaryWithoutPathExpansion(
"alternate_protocol", &port_alternate_protocol_dict)) {
@@ -424,7 +420,7 @@
port_alternate_protocol.port = port;
port_alternate_protocol.protocol = protocol;
- alternate_protocol_map->Put(server, port_alternate_protocol);
+ (*alternate_protocol_map)[server] = port_alternate_protocol;
} while (false);
}
@@ -513,15 +509,9 @@
*spdy_settings_map = http_server_properties_impl_->spdy_settings_map();
net::AlternateProtocolMap* alternate_protocol_map =
- new net::AlternateProtocolMap(kMaxAlternateProtocolHostsToPersist);
- const net::AlternateProtocolMap& map =
+ new net::AlternateProtocolMap;
+ *alternate_protocol_map =
http_server_properties_impl_->alternate_protocol_map();
- int count = 0;
- for (net::AlternateProtocolMap::const_iterator it = map.begin();
- it != map.end() && count < kMaxAlternateProtocolHostsToPersist;
- ++it, ++count) {
- alternate_protocol_map->Put(it->first, it->second);
- }
net::PipelineCapabilityMap* pipeline_capability_map =
new net::PipelineCapabilityMap;
@@ -572,8 +562,6 @@
net::PipelineCapabilityMap* pipeline_capability_map,
const base::Closure& completion) {
- // TODO(rtenneti): Fix ServerPrefMap to preserve MRU order of
- // alternate_protocol_map and pipeline_capability_map.
typedef std::map<net::HostPortPair, ServerPref> ServerPrefMap;
ServerPrefMap server_pref_map;
@@ -597,7 +585,8 @@
}
// 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;
@@ -612,7 +601,7 @@
// Add AlternateProtocol servers to server_pref_map.
for (net::AlternateProtocolMap::const_iterator map_it =
- alternate_protocol_map->begin();
+ alternate_protocol_map->begin();
map_it != alternate_protocol_map->end(); ++map_it) {
const net::HostPortPair& server = map_it->first;
const net::PortAlternateProtocolPair& port_alternate_protocol =
« no previous file with comments | « chrome/browser/net/http_server_properties_manager.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698