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 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // optional |completion| callback when finished. Protected for testing. | 209 // optional |completion| callback when finished. Protected for testing. |
210 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, | 210 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, |
211 SpdySettingsMap* spdy_settings_map, | 211 SpdySettingsMap* spdy_settings_map, |
212 AlternativeServiceMap* alternative_service_map, | 212 AlternativeServiceMap* alternative_service_map, |
213 IPAddressNumber* last_quic_address, | 213 IPAddressNumber* last_quic_address, |
214 ServerNetworkStatsMap* server_network_stats_map, | 214 ServerNetworkStatsMap* server_network_stats_map, |
215 QuicServerInfoMap* quic_server_info_map, | 215 QuicServerInfoMap* quic_server_info_map, |
216 const base::Closure& completion); | 216 const base::Closure& completion); |
217 | 217 |
218 private: | 218 private: |
| 219 typedef std::vector<std::string> ServerList; |
| 220 |
219 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, | 221 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, |
220 AddToAlternativeServiceMap); | 222 AddToAlternativeServiceMap); |
221 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, | 223 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, |
222 DoNotLoadExpiredAlternativeService); | 224 DoNotLoadExpiredAlternativeService); |
223 void OnHttpServerPropertiesChanged(); | 225 void OnHttpServerPropertiesChanged(); |
224 | 226 |
225 bool ReadSupportsQuic(const base::DictionaryValue& server_dict, | 227 bool AddServersData(const base::DictionaryValue& server_dict, |
226 IPAddressNumber* last_quic_address); | 228 ServerList* spdy_servers, |
| 229 SpdySettingsMap* spdy_settings_map, |
| 230 AlternativeServiceMap* alternative_service_map, |
| 231 ServerNetworkStatsMap* network_stats_map); |
227 void AddToSpdySettingsMap(const HostPortPair& server, | 232 void AddToSpdySettingsMap(const HostPortPair& server, |
228 const base::DictionaryValue& server_dict, | 233 const base::DictionaryValue& server_dict, |
229 SpdySettingsMap* spdy_settings_map); | 234 SpdySettingsMap* spdy_settings_map); |
230 bool ParseAlternativeServiceDict( | 235 bool ParseAlternativeServiceDict( |
231 const base::DictionaryValue& alternative_service_dict, | 236 const base::DictionaryValue& alternative_service_dict, |
232 const std::string& server_str, | 237 const std::string& server_str, |
233 AlternativeServiceInfo* alternative_service_info); | 238 AlternativeServiceInfo* alternative_service_info); |
234 bool AddToAlternativeServiceMap( | 239 bool AddToAlternativeServiceMap( |
235 const HostPortPair& server, | 240 const HostPortPair& server, |
236 const base::DictionaryValue& server_dict, | 241 const base::DictionaryValue& server_dict, |
237 AlternativeServiceMap* alternative_service_map); | 242 AlternativeServiceMap* alternative_service_map); |
| 243 bool ReadSupportsQuic(const base::DictionaryValue& server_dict, |
| 244 IPAddressNumber* last_quic_address); |
238 bool AddToNetworkStatsMap(const HostPortPair& server, | 245 bool AddToNetworkStatsMap(const HostPortPair& server, |
239 const base::DictionaryValue& server_dict, | 246 const base::DictionaryValue& server_dict, |
240 ServerNetworkStatsMap* network_stats_map); | 247 ServerNetworkStatsMap* network_stats_map); |
241 bool AddToQuicServerInfoMap(const base::DictionaryValue& server_dict, | 248 bool AddToQuicServerInfoMap(const base::DictionaryValue& server_dict, |
242 QuicServerInfoMap* quic_server_info_map); | 249 QuicServerInfoMap* quic_server_info_map); |
243 | 250 |
244 void SaveSpdySettingsToServerPrefs(const SettingsMap* spdy_settings_map, | 251 void SaveSpdySettingsToServerPrefs(const SettingsMap* spdy_settings_map, |
245 base::DictionaryValue* server_pref_dict); | 252 base::DictionaryValue* server_pref_dict); |
246 void SaveAlternativeServiceToServerPrefs( | 253 void SaveAlternativeServiceToServerPrefs( |
247 const AlternativeServiceInfoVector* alternative_service_info_vector, | 254 const AlternativeServiceInfoVector* alternative_service_info_vector, |
248 base::DictionaryValue* server_pref_dict); | 255 base::DictionaryValue* server_pref_dict); |
| 256 void SaveSupportsQuicToPrefs( |
| 257 const IPAddressNumber* last_quic_address, |
| 258 base::DictionaryValue* http_server_properties_dict); |
249 void SaveNetworkStatsToServerPrefs( | 259 void SaveNetworkStatsToServerPrefs( |
250 const ServerNetworkStats* server_network_stats, | 260 const ServerNetworkStats* server_network_stats, |
251 base::DictionaryValue* server_pref_dict); | 261 base::DictionaryValue* server_pref_dict); |
252 void SaveQuicServerInfoMapToServerPrefs( | 262 void SaveQuicServerInfoMapToServerPrefs( |
253 QuicServerInfoMap* quic_server_info_map, | 263 QuicServerInfoMap* quic_server_info_map, |
254 base::DictionaryValue* http_server_properties_dict); | 264 base::DictionaryValue* http_server_properties_dict); |
255 void SaveSupportsQuicToPrefs( | |
256 const IPAddressNumber* last_quic_address, | |
257 base::DictionaryValue* http_server_properties_dict); | |
258 | 265 |
259 // ----------- | 266 // ----------- |
260 // Pref thread | 267 // Pref thread |
261 // ----------- | 268 // ----------- |
262 | 269 |
263 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_; | 270 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_; |
264 | 271 |
265 base::WeakPtr<HttpServerPropertiesManager> pref_weak_ptr_; | 272 base::WeakPtr<HttpServerPropertiesManager> pref_weak_ptr_; |
266 | 273 |
267 // Used to post cache update tasks. | 274 // Used to post cache update tasks. |
(...skipping 23 matching lines...) Expand all Loading... |
291 // Used to get |weak_ptr_| to self on the network thread. | 298 // Used to get |weak_ptr_| to self on the network thread. |
292 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > | 299 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > |
293 network_weak_ptr_factory_; | 300 network_weak_ptr_factory_; |
294 | 301 |
295 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); | 302 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); |
296 }; | 303 }; |
297 | 304 |
298 } // namespace net | 305 } // namespace net |
299 | 306 |
300 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 307 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
OLD | NEW |