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

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: git sync 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
« no previous file with comments | « net/http/http_server_properties_manager.h ('k') | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6fd0df7fe9913de5b29f6a8b16710ba8039b6212..31e8d6c489a667b2d9af8ffe17621700580e26f5 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -289,28 +289,28 @@ HttpServerPropertiesManager::GetAlternativeServiceInfoAsValue() const {
}
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);
}
@@ -554,6 +554,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;
@@ -569,13 +572,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)) {
@@ -586,7 +586,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.
@@ -603,14 +603,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;
}
@@ -1060,7 +1060,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;
« no previous file with comments | « net/http/http_server_properties_manager.h ('k') | net/http/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698