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

Unified Diff: net/http/http_server_properties_manager.cc

Issue 1866983006: SHP 2: Change SpdySettingsMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SHP_1
Patch Set: remove commented line Created 4 years, 8 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
Index: net/http/http_server_properties_manager.cc
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc
index 02a7fedb2fb1f3fd7dc35ab99b7e67c08208808c..cecf8a170a595a527cd87276e0d5527825a913b5 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -290,28 +290,28 @@ HttpServerPropertiesManager::GetAlternativeServiceInfoAsValue()
}
const SettingsMap& HttpServerPropertiesManager::GetSpdySettings(
- const HostPortPair& host_port_pair) {
+ const url::SchemeHostPort& server) {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
- return http_server_properties_impl_->GetSpdySettings(host_port_pair);
+ return http_server_properties_impl_->GetSpdySettings(server);
}
bool HttpServerPropertiesManager::SetSpdySetting(
- const HostPortPair& host_port_pair,
+ const url::SchemeHostPort& server,
SpdySettingsIds id,
SpdySettingsFlags flags,
uint32_t value) {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
- bool persist = http_server_properties_impl_->SetSpdySetting(
- host_port_pair, id, flags, value);
+ bool persist =
+ http_server_properties_impl_->SetSpdySetting(server, id, flags, value);
if (persist)
ScheduleUpdatePrefsOnNetworkThread(SET_SPDY_SETTING);
return persist;
}
void HttpServerPropertiesManager::ClearSpdySettings(
- const HostPortPair& host_port_pair) {
+ const url::SchemeHostPort& server) {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
- http_server_properties_impl_->ClearSpdySettings(host_port_pair);
+ http_server_properties_impl_->ClearSpdySettings(server);
ScheduleUpdatePrefsOnNetworkThread(CLEAR_SPDY_SETTINGS);
}
@@ -555,6 +555,9 @@ bool HttpServerPropertiesManager::AddServersData(
// Get server's host/pair.
const std::string& server_str = it.key();
HostPortPair server = HostPortPair::FromString(server_str);
+ // TODO(zhongyi): fill in the scheme field when servers_dict has scheme.
+ std::string spdy_server_url = "https://" + server_str;
+ url::SchemeHostPort spdy_server((GURL(spdy_server_url)));
if (server.host().empty()) {
DVLOG(1) << "Malformed http_server_properties for server: " << server_str;
return false;
@@ -570,13 +573,10 @@ bool HttpServerPropertiesManager::AddServersData(
bool supports_spdy = false;
if ((server_pref_dict->GetBoolean(kSupportsSpdyKey, &supports_spdy)) &&
supports_spdy) {
- // TODO(zhongyi): fill in the scheme field when servers_dict has scheme.
- std::string spdy_server_url = "https://" + server_str;
- url::SchemeHostPort spdy_server((GURL(spdy_server_url)));
spdy_servers->push_back(spdy_server.Serialize());
}
- AddToSpdySettingsMap(server, *server_pref_dict, spdy_settings_map);
+ AddToSpdySettingsMap(spdy_server, *server_pref_dict, spdy_settings_map);
if (!AddToAlternativeServiceMap(server, *server_pref_dict,
alternative_service_map) ||
!AddToNetworkStatsMap(server, *server_pref_dict, network_stats_map)) {
@@ -587,7 +587,7 @@ bool HttpServerPropertiesManager::AddServersData(
}
void HttpServerPropertiesManager::AddToSpdySettingsMap(
- const HostPortPair& server,
+ const url::SchemeHostPort& server,
const base::DictionaryValue& server_pref_dict,
SpdySettingsMap* spdy_settings_map) {
// Get SpdySettings.
@@ -604,14 +604,14 @@ void HttpServerPropertiesManager::AddToSpdySettingsMap(
int id = 0;
if (!base::StringToInt(id_str, &id)) {
DVLOG(1) << "Malformed id in SpdySettings for server: "
- << server.ToString();
+ << server.Serialize();
NOTREACHED();
continue;
}
int value = 0;
if (!dict_it.value().GetAsInteger(&value)) {
DVLOG(1) << "Malformed value in SpdySettings for server: "
- << server.ToString();
+ << server.Serialize();
NOTREACHED();
continue;
}
@@ -1061,7 +1061,9 @@ void HttpServerPropertiesManager::UpdatePrefsOnPrefThread(
// Add servers that have SpdySettings to server_pref_map in the MRU order.
for (SpdySettingsMap::reverse_iterator map_it = spdy_settings_map->rbegin();
map_it != spdy_settings_map->rend(); ++map_it) {
- const HostPortPair& server = map_it->first;
+ // TODO(zhongyi): use memory data once disk data is migrated.
+ const url::SchemeHostPort spdy_server = map_it->first;
+ const HostPortPair server(spdy_server.host(), spdy_server.port());
ServerPrefMap::iterator it = server_pref_map.Get(server);
if (it == server_pref_map.end()) {
ServerPref server_pref;

Powered by Google App Engine
This is Rietveld 408576698