| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_server_properties_manager.h" | 5 #include "net/http/http_server_properties_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Time to wait before starting an update the preferences from the | 28 // Time to wait before starting an update the preferences from the |
| 29 // http_server_properties_impl_ cache. Scheduling another update during this | 29 // http_server_properties_impl_ cache. Scheduling another update during this |
| 30 // period will reset the timer. | 30 // period will reset the timer. |
| 31 const int64_t kUpdatePrefsDelayMs = 60000; | 31 const int64_t kUpdatePrefsDelayMs = 60000; |
| 32 | 32 |
| 33 // "version" 0 indicates, http_server_properties doesn't have "version" | 33 // "version" 0 indicates, http_server_properties doesn't have "version" |
| 34 // property. | 34 // property. |
| 35 const int kMissingVersion = 0; | 35 const int kMissingVersion = 0; |
| 36 | 36 |
| 37 // The version number of persisted http_server_properties. | 37 // The version number of persisted http_server_properties. |
| 38 const int kVersionNumber = 4; | 38 const int kVersionNumber = 5; |
| 39 | 39 |
| 40 // Persist 200 MRU AlternateProtocolHostPortPairs. | 40 // Persist 200 MRU AlternateProtocolHostPortPairs. |
| 41 const int kMaxAlternateProtocolHostsToPersist = 200; | 41 const int kMaxAlternateProtocolHostsToPersist = 200; |
| 42 | 42 |
| 43 // Persist 200 MRU SpdySettingsHostPortPairs. | 43 // Persist 200 MRU SpdySettingsHostPortPairs. |
| 44 const int kMaxSpdySettingsHostsToPersist = 200; | 44 const int kMaxSpdySettingsHostsToPersist = 200; |
| 45 | 45 |
| 46 // Persist 300 MRU SupportsSpdyServerHostPortPairs. | 46 // Persist 300 MRU SupportsSpdyServerHostPortPairs. |
| 47 const int kMaxSupportsSpdyServerHostsToPersist = 300; | 47 const int kMaxSupportsSpdyServerHostsToPersist = 300; |
| 48 | 48 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 if (version < 4) { | 453 if (version < 4) { |
| 454 // The properties for a given server is in | 454 // The properties for a given server is in |
| 455 // http_server_properties_dict["servers"][server]. | 455 // http_server_properties_dict["servers"][server]. |
| 456 // Before Version 4, server data was stored in the following format in | 456 // Before Version 4, server data was stored in the following format in |
| 457 // alphabetical order. | 457 // alphabetical order. |
| 458 // | 458 // |
| 459 // "http_server_properties": { | 459 // "http_server_properties": { |
| 460 // "servers": { | 460 // "servers": { |
| 461 // "0-edge-chat.facebook.com:443" : {...}, | 461 // "0-edge-chat.facebook.com:443" : {...}, |
| 462 // "0.client-channel.google.com:443" : {...}, | 462 // "0.client-channel.google.com:443" : {...}, |
| 463 // "yt3.ggpht.com:443" : {...}, | 463 // "yt3.ggpht.com:80" : {...}, |
| 464 // ... | 464 // ... |
| 465 // }, ... | 465 // }, ... |
| 466 // }, | 466 // }, |
| 467 if (!http_server_properties_dict.GetDictionaryWithoutPathExpansion( | 467 if (!http_server_properties_dict.GetDictionaryWithoutPathExpansion( |
| 468 kServersKey, &servers_dict)) { | 468 kServersKey, &servers_dict)) { |
| 469 DVLOG(1) << "Malformed http_server_properties for servers."; | 469 DVLOG(1) << "Malformed http_server_properties for servers."; |
| 470 return; | 470 return; |
| 471 } | 471 } |
| 472 } else { | 472 } else { |
| 473 // From Version 4 onwards, data was stored in the following format. | 473 // For Version 4, data was stored in the following format. |
| 474 // |servers| are saved in MRU order. | 474 // |servers| are saved in MRU order. |
| 475 // | 475 // |
| 476 // "http_server_properties": { | 476 // "http_server_properties": { |
| 477 // "servers": [ | 477 // "servers": [ |
| 478 // {"yt3.ggpht.com:443" : {...}}, | 478 // {"yt3.ggpht.com:443" : {...}}, |
| 479 // {"0.client-channel.google.com:443" : {...}}, | 479 // {"0.client-channel.google.com:443" : {...}}, |
| 480 // {"0-edge-chat.facebook.com:443" : {...}}, | 480 // {"0-edge-chat.facebook.com:80" : {...}}, |
| 481 // ... | 481 // ... |
| 482 // ], ... | 482 // ], ... |
| 483 // }, | 483 // }, |
| 484 // For Version 5, data was stored in the following format. |
| 485 // |servers| are saved in MRU order. |servers| are in the format flattened |
| 486 // representation of (scheme/host/port) where port might be ignored if is |
| 487 // default with scheme. |
| 488 // |
| 489 // "http_server_properties": { |
| 490 // "servers": [ |
| 491 // {"https://yt3.ggpht.com" : {...}}, |
| 492 // {"http://0.client-channel.google.com:443" : {...}}, |
| 493 // {"http://0-edge-chat.facebook.com" : {...}}, |
| 494 // ... |
| 495 // ], ... |
| 496 // }, |
| 484 if (!http_server_properties_dict.GetListWithoutPathExpansion( | 497 if (!http_server_properties_dict.GetListWithoutPathExpansion( |
| 485 kServersKey, &servers_list)) { | 498 kServersKey, &servers_list)) { |
| 486 DVLOG(1) << "Malformed http_server_properties for servers list."; | 499 DVLOG(1) << "Malformed http_server_properties for servers list."; |
| 487 return; | 500 return; |
| 488 } | 501 } |
| 489 } | 502 } |
| 490 | 503 |
| 491 IPAddress* addr = new IPAddress; | 504 IPAddress* addr = new IPAddress; |
| 492 ReadSupportsQuic(http_server_properties_dict, addr); | 505 ReadSupportsQuic(http_server_properties_dict, addr); |
| 493 | 506 |
| 494 // String is "scheme://host:port" tuple of spdy server. | 507 // String is "scheme://host:port" tuple of spdy server. |
| 495 std::unique_ptr<ServerList> spdy_servers(new ServerList); | 508 std::unique_ptr<ServerList> spdy_servers(new ServerList); |
| 496 std::unique_ptr<SpdySettingsMap> spdy_settings_map( | 509 std::unique_ptr<SpdySettingsMap> spdy_settings_map( |
| 497 new SpdySettingsMap(kMaxSpdySettingsHostsToPersist)); | 510 new SpdySettingsMap(kMaxSpdySettingsHostsToPersist)); |
| 498 std::unique_ptr<AlternativeServiceMap> alternative_service_map( | 511 std::unique_ptr<AlternativeServiceMap> alternative_service_map( |
| 499 new AlternativeServiceMap(kMaxAlternateProtocolHostsToPersist)); | 512 new AlternativeServiceMap(kMaxAlternateProtocolHostsToPersist)); |
| 500 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map( | 513 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map( |
| 501 new ServerNetworkStatsMap(kMaxServerNetworkStatsHostsToPersist)); | 514 new ServerNetworkStatsMap(kMaxServerNetworkStatsHostsToPersist)); |
| 502 std::unique_ptr<QuicServerInfoMap> quic_server_info_map( | 515 std::unique_ptr<QuicServerInfoMap> quic_server_info_map( |
| 503 new QuicServerInfoMap(QuicServerInfoMap::NO_AUTO_EVICT)); | 516 new QuicServerInfoMap(QuicServerInfoMap::NO_AUTO_EVICT)); |
| 504 | 517 |
| 505 if (version < 4) { | 518 if (version < 4) { |
| 506 if (!AddServersData(*servers_dict, spdy_servers.get(), | 519 if (!AddServersData(*servers_dict, spdy_servers.get(), |
| 507 spdy_settings_map.get(), alternative_service_map.get(), | 520 spdy_settings_map.get(), alternative_service_map.get(), |
| 508 server_network_stats_map.get())) { | 521 server_network_stats_map.get(), version)) { |
| 509 detected_corrupted_prefs = true; | 522 detected_corrupted_prefs = true; |
| 510 } | 523 } |
| 511 } else { | 524 } else { |
| 512 for (base::ListValue::const_iterator it = servers_list->begin(); | 525 for (base::ListValue::const_iterator it = servers_list->begin(); |
| 513 it != servers_list->end(); ++it) { | 526 it != servers_list->end(); ++it) { |
| 514 if (!(*it)->GetAsDictionary(&servers_dict)) { | 527 if (!(*it)->GetAsDictionary(&servers_dict)) { |
| 515 DVLOG(1) << "Malformed http_server_properties for servers dictionary."; | 528 DVLOG(1) << "Malformed http_server_properties for servers dictionary."; |
| 516 detected_corrupted_prefs = true; | 529 detected_corrupted_prefs = true; |
| 517 continue; | 530 continue; |
| 518 } | 531 } |
| 519 if (!AddServersData( | 532 if (!AddServersData(*servers_dict, spdy_servers.get(), |
| 520 *servers_dict, spdy_servers.get(), spdy_settings_map.get(), | 533 spdy_settings_map.get(), |
| 521 alternative_service_map.get(), server_network_stats_map.get())) { | 534 alternative_service_map.get(), |
| 535 server_network_stats_map.get(), version)) { |
| 522 detected_corrupted_prefs = true; | 536 detected_corrupted_prefs = true; |
| 523 } | 537 } |
| 524 } | 538 } |
| 525 } | 539 } |
| 526 | 540 |
| 527 if (!AddToQuicServerInfoMap(http_server_properties_dict, | 541 if (!AddToQuicServerInfoMap(http_server_properties_dict, |
| 528 quic_server_info_map.get())) { | 542 quic_server_info_map.get())) { |
| 529 detected_corrupted_prefs = true; | 543 detected_corrupted_prefs = true; |
| 530 } | 544 } |
| 531 | 545 |
| 532 network_task_runner_->PostTask( | 546 network_task_runner_->PostTask( |
| 533 FROM_HERE, | 547 FROM_HERE, |
| 534 base::Bind( | 548 base::Bind( |
| 535 &HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread, | 549 &HttpServerPropertiesManager::UpdateCacheFromPrefsOnNetworkThread, |
| 536 base::Unretained(this), base::Owned(spdy_servers.release()), | 550 base::Unretained(this), base::Owned(spdy_servers.release()), |
| 537 base::Owned(spdy_settings_map.release()), | 551 base::Owned(spdy_settings_map.release()), |
| 538 base::Owned(alternative_service_map.release()), base::Owned(addr), | 552 base::Owned(alternative_service_map.release()), base::Owned(addr), |
| 539 base::Owned(server_network_stats_map.release()), | 553 base::Owned(server_network_stats_map.release()), |
| 540 base::Owned(quic_server_info_map.release()), | 554 base::Owned(quic_server_info_map.release()), |
| 541 detected_corrupted_prefs)); | 555 detected_corrupted_prefs)); |
| 542 } | 556 } |
| 543 | 557 |
| 544 bool HttpServerPropertiesManager::AddServersData( | 558 bool HttpServerPropertiesManager::AddServersData( |
| 545 const base::DictionaryValue& servers_dict, | 559 const base::DictionaryValue& servers_dict, |
| 546 ServerList* spdy_servers, | 560 ServerList* spdy_servers, |
| 547 SpdySettingsMap* spdy_settings_map, | 561 SpdySettingsMap* spdy_settings_map, |
| 548 AlternativeServiceMap* alternative_service_map, | 562 AlternativeServiceMap* alternative_service_map, |
| 549 ServerNetworkStatsMap* network_stats_map) { | 563 ServerNetworkStatsMap* network_stats_map, |
| 564 int version) { |
| 550 for (base::DictionaryValue::Iterator it(servers_dict); !it.IsAtEnd(); | 565 for (base::DictionaryValue::Iterator it(servers_dict); !it.IsAtEnd(); |
| 551 it.Advance()) { | 566 it.Advance()) { |
| 552 // TODO(zhongyi): get server's scheme/host/port when servers_dict migrates | 567 // Get server's scheme/host/pair. |
| 553 // to SchemeHostPort. | |
| 554 // Get server's host/pair. | |
| 555 const std::string& server_str = it.key(); | 568 const std::string& server_str = it.key(); |
| 556 // TODO(zhongyi): fill in the scheme field when servers_dict has scheme. | 569 std::string spdy_server_url = server_str; |
| 557 std::string spdy_server_url = "https://" + server_str; | 570 if (version < 5) { |
| 571 // For old version disk data, always use HTTPS as the scheme. |
| 572 spdy_server_url.insert(0, "https://"); |
| 573 } |
| 558 url::SchemeHostPort spdy_server((GURL(spdy_server_url))); | 574 url::SchemeHostPort spdy_server((GURL(spdy_server_url))); |
| 559 if (spdy_server.host().empty()) { | 575 if (spdy_server.host().empty()) { |
| 560 DVLOG(1) << "Malformed http_server_properties for server: " << server_str; | 576 DVLOG(1) << "Malformed http_server_properties for server: " << server_str; |
| 561 return false; | 577 return false; |
| 562 } | 578 } |
| 563 | 579 |
| 564 const base::DictionaryValue* server_pref_dict = nullptr; | 580 const base::DictionaryValue* server_pref_dict = nullptr; |
| 565 if (!it.value().GetAsDictionary(&server_pref_dict)) { | 581 if (!it.value().GetAsDictionary(&server_pref_dict)) { |
| 566 DVLOG(1) << "Malformed http_server_properties server: " << server_str; | 582 DVLOG(1) << "Malformed http_server_properties server: " << server_str; |
| 567 return false; | 583 return false; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 | 1045 |
| 1030 // All maps and lists are in MRU order. | 1046 // All maps and lists are in MRU order. |
| 1031 void HttpServerPropertiesManager::UpdatePrefsOnPrefThread( | 1047 void HttpServerPropertiesManager::UpdatePrefsOnPrefThread( |
| 1032 base::ListValue* spdy_server_list, | 1048 base::ListValue* spdy_server_list, |
| 1033 SpdySettingsMap* spdy_settings_map, | 1049 SpdySettingsMap* spdy_settings_map, |
| 1034 AlternativeServiceMap* alternative_service_map, | 1050 AlternativeServiceMap* alternative_service_map, |
| 1035 IPAddress* last_quic_address, | 1051 IPAddress* last_quic_address, |
| 1036 ServerNetworkStatsMap* server_network_stats_map, | 1052 ServerNetworkStatsMap* server_network_stats_map, |
| 1037 QuicServerInfoMap* quic_server_info_map, | 1053 QuicServerInfoMap* quic_server_info_map, |
| 1038 const base::Closure& completion) { | 1054 const base::Closure& completion) { |
| 1039 typedef base::MRUCache<HostPortPair, ServerPref> ServerPrefMap; | 1055 typedef base::MRUCache<url::SchemeHostPort, ServerPref> ServerPrefMap; |
| 1040 ServerPrefMap server_pref_map(ServerPrefMap::NO_AUTO_EVICT); | 1056 ServerPrefMap server_pref_map(ServerPrefMap::NO_AUTO_EVICT); |
| 1041 | 1057 |
| 1042 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 1058 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 1043 | 1059 |
| 1044 // Add servers that support spdy to server_pref_map in the MRU order. | 1060 // Add servers that support spdy to server_pref_map in the MRU order. |
| 1045 for (size_t index = spdy_server_list->GetSize(); index > 0; --index) { | 1061 for (size_t index = spdy_server_list->GetSize(); index > 0; --index) { |
| 1046 std::string s; | 1062 std::string server_str; |
| 1047 if (spdy_server_list->GetString(index - 1, &s)) { | 1063 if (spdy_server_list->GetString(index - 1, &server_str)) { |
| 1048 HostPortPair server = HostPortPair::FromString(s); | 1064 url::SchemeHostPort server((GURL(server_str))); |
| 1049 ServerPrefMap::iterator it = server_pref_map.Get(server); | 1065 ServerPrefMap::iterator it = server_pref_map.Get(server); |
| 1050 if (it == server_pref_map.end()) { | 1066 if (it == server_pref_map.end()) { |
| 1051 ServerPref server_pref; | 1067 ServerPref server_pref; |
| 1052 server_pref.supports_spdy = true; | 1068 server_pref.supports_spdy = true; |
| 1053 server_pref_map.Put(server, server_pref); | 1069 server_pref_map.Put(server, server_pref); |
| 1054 } else { | 1070 } else { |
| 1055 it->second.supports_spdy = true; | 1071 it->second.supports_spdy = true; |
| 1056 } | 1072 } |
| 1057 } | 1073 } |
| 1058 } | 1074 } |
| 1059 | 1075 |
| 1060 // Add servers that have SpdySettings to server_pref_map in the MRU order. | 1076 // Add servers that have SpdySettings to server_pref_map in the MRU order. |
| 1061 for (SpdySettingsMap::reverse_iterator map_it = spdy_settings_map->rbegin(); | 1077 for (SpdySettingsMap::reverse_iterator map_it = spdy_settings_map->rbegin(); |
| 1062 map_it != spdy_settings_map->rend(); ++map_it) { | 1078 map_it != spdy_settings_map->rend(); ++map_it) { |
| 1063 // TODO(zhongyi): use memory data once disk data is migrated. | 1079 const url::SchemeHostPort server = map_it->first; |
| 1064 const url::SchemeHostPort spdy_server = map_it->first; | |
| 1065 const HostPortPair server(spdy_server.host(), spdy_server.port()); | |
| 1066 ServerPrefMap::iterator it = server_pref_map.Get(server); | 1080 ServerPrefMap::iterator it = server_pref_map.Get(server); |
| 1067 if (it == server_pref_map.end()) { | 1081 if (it == server_pref_map.end()) { |
| 1068 ServerPref server_pref; | 1082 ServerPref server_pref; |
| 1069 server_pref.settings_map = &map_it->second; | 1083 server_pref.settings_map = &map_it->second; |
| 1070 server_pref_map.Put(server, server_pref); | 1084 server_pref_map.Put(server, server_pref); |
| 1071 } else { | 1085 } else { |
| 1072 it->second.settings_map = &map_it->second; | 1086 it->second.settings_map = &map_it->second; |
| 1073 } | 1087 } |
| 1074 } | 1088 } |
| 1075 | 1089 |
| 1076 // Add alternative services to server_pref_map in the MRU order. | 1090 // Add alternative services to server_pref_map in the MRU order. |
| 1077 for (AlternativeServiceMap::const_reverse_iterator map_it = | 1091 for (AlternativeServiceMap::const_reverse_iterator map_it = |
| 1078 alternative_service_map->rbegin(); | 1092 alternative_service_map->rbegin(); |
| 1079 map_it != alternative_service_map->rend(); ++map_it) { | 1093 map_it != alternative_service_map->rend(); ++map_it) { |
| 1080 // TODO(zhongyi): migrate to SHP once server_pref_map is migrated. | 1094 const url::SchemeHostPort server = map_it->first; |
| 1081 const HostPortPair server(map_it->first.host(), map_it->first.port()); | |
| 1082 ServerPrefMap::iterator it = server_pref_map.Get(server); | 1095 ServerPrefMap::iterator it = server_pref_map.Get(server); |
| 1083 if (it == server_pref_map.end()) { | 1096 if (it == server_pref_map.end()) { |
| 1084 ServerPref server_pref; | 1097 ServerPref server_pref; |
| 1085 server_pref.alternative_service_info_vector = &map_it->second; | 1098 server_pref.alternative_service_info_vector = &map_it->second; |
| 1086 server_pref_map.Put(server, server_pref); | 1099 server_pref_map.Put(server, server_pref); |
| 1087 } else { | 1100 } else { |
| 1088 it->second.alternative_service_info_vector = &map_it->second; | 1101 it->second.alternative_service_info_vector = &map_it->second; |
| 1089 } | 1102 } |
| 1090 } | 1103 } |
| 1091 | 1104 |
| 1092 // Add ServerNetworkStats servers to server_pref_map in the MRU order. | 1105 // Add ServerNetworkStats servers to server_pref_map in the MRU order. |
| 1093 for (ServerNetworkStatsMap::const_reverse_iterator map_it = | 1106 for (ServerNetworkStatsMap::const_reverse_iterator map_it = |
| 1094 server_network_stats_map->rbegin(); | 1107 server_network_stats_map->rbegin(); |
| 1095 map_it != server_network_stats_map->rend(); ++map_it) { | 1108 map_it != server_network_stats_map->rend(); ++map_it) { |
| 1096 // TODO(zhongyi): use memory data once disk data is migrated. | 1109 const url::SchemeHostPort server = map_it->first; |
| 1097 const url::SchemeHostPort spdy_server = map_it->first; | |
| 1098 const HostPortPair server(spdy_server.host(), spdy_server.port()); | |
| 1099 ServerPrefMap::iterator it = server_pref_map.Get(server); | 1110 ServerPrefMap::iterator it = server_pref_map.Get(server); |
| 1100 if (it == server_pref_map.end()) { | 1111 if (it == server_pref_map.end()) { |
| 1101 ServerPref server_pref; | 1112 ServerPref server_pref; |
| 1102 server_pref.server_network_stats = &map_it->second; | 1113 server_pref.server_network_stats = &map_it->second; |
| 1103 server_pref_map.Put(server, server_pref); | 1114 server_pref_map.Put(server, server_pref); |
| 1104 } else { | 1115 } else { |
| 1105 it->second.server_network_stats = &map_it->second; | 1116 it->second.server_network_stats = &map_it->second; |
| 1106 } | 1117 } |
| 1107 } | 1118 } |
| 1108 | 1119 |
| 1109 // Persist properties to the prefs in the MRU order. | 1120 // Persist properties to the prefs in the MRU order. |
| 1110 base::DictionaryValue http_server_properties_dict; | 1121 base::DictionaryValue http_server_properties_dict; |
| 1111 base::ListValue* servers_list = new base::ListValue; | 1122 base::ListValue* servers_list = new base::ListValue; |
| 1112 for (ServerPrefMap::const_reverse_iterator map_it = server_pref_map.rbegin(); | 1123 for (ServerPrefMap::const_reverse_iterator map_it = server_pref_map.rbegin(); |
| 1113 map_it != server_pref_map.rend(); ++map_it) { | 1124 map_it != server_pref_map.rend(); ++map_it) { |
| 1114 const HostPortPair& server = map_it->first; | 1125 const url::SchemeHostPort server = map_it->first; |
| 1115 const ServerPref& server_pref = map_it->second; | 1126 const ServerPref& server_pref = map_it->second; |
| 1116 | 1127 |
| 1117 base::DictionaryValue* servers_dict = new base::DictionaryValue; | 1128 base::DictionaryValue* servers_dict = new base::DictionaryValue; |
| 1118 base::DictionaryValue* server_pref_dict = new base::DictionaryValue; | 1129 base::DictionaryValue* server_pref_dict = new base::DictionaryValue; |
| 1119 | 1130 |
| 1120 // Save supports_spdy. | 1131 // Save supports_spdy. |
| 1121 if (server_pref.supports_spdy) | 1132 if (server_pref.supports_spdy) |
| 1122 server_pref_dict->SetBoolean(kSupportsSpdyKey, server_pref.supports_spdy); | 1133 server_pref_dict->SetBoolean(kSupportsSpdyKey, server_pref.supports_spdy); |
| 1123 SaveSpdySettingsToServerPrefs(server_pref.settings_map, server_pref_dict); | 1134 SaveSpdySettingsToServerPrefs(server_pref.settings_map, server_pref_dict); |
| 1124 SaveAlternativeServiceToServerPrefs( | 1135 SaveAlternativeServiceToServerPrefs( |
| 1125 server_pref.alternative_service_info_vector, server_pref_dict); | 1136 server_pref.alternative_service_info_vector, server_pref_dict); |
| 1126 SaveNetworkStatsToServerPrefs(server_pref.server_network_stats, | 1137 SaveNetworkStatsToServerPrefs(server_pref.server_network_stats, |
| 1127 server_pref_dict); | 1138 server_pref_dict); |
| 1128 | 1139 |
| 1129 servers_dict->SetWithoutPathExpansion(server.ToString(), server_pref_dict); | 1140 servers_dict->SetWithoutPathExpansion(server.Serialize(), server_pref_dict); |
| 1130 bool value = servers_list->AppendIfNotPresent(servers_dict); | 1141 bool value = servers_list->AppendIfNotPresent(servers_dict); |
| 1131 DCHECK(value); // Should never happen. | 1142 DCHECK(value); // Should never happen. |
| 1132 } | 1143 } |
| 1133 | 1144 |
| 1134 http_server_properties_dict.SetWithoutPathExpansion(kServersKey, | 1145 http_server_properties_dict.SetWithoutPathExpansion(kServersKey, |
| 1135 servers_list); | 1146 servers_list); |
| 1136 SetVersion(&http_server_properties_dict, kVersionNumber); | 1147 SetVersion(&http_server_properties_dict, kVersionNumber); |
| 1137 | 1148 |
| 1138 SaveSupportsQuicToPrefs(last_quic_address, &http_server_properties_dict); | 1149 SaveSupportsQuicToPrefs(last_quic_address, &http_server_properties_dict); |
| 1139 | 1150 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 quic_servers_dict); | 1263 quic_servers_dict); |
| 1253 } | 1264 } |
| 1254 | 1265 |
| 1255 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 1266 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
| 1256 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 1267 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
| 1257 if (!setting_prefs_) | 1268 if (!setting_prefs_) |
| 1258 ScheduleUpdateCacheOnPrefThread(); | 1269 ScheduleUpdateCacheOnPrefThread(); |
| 1259 } | 1270 } |
| 1260 | 1271 |
| 1261 } // namespace net | 1272 } // namespace net |
| OLD | NEW |