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

Side by Side Diff: net/http/http_server_properties_manager.h

Issue 2949513005: Update param types of HttpServerPropertiesImpl setters and getters. Fix MRU order when loading (Closed)
Patch Set: Updated HttpServerPropertiesManagerTest.SingleUpdateForTwoSpdyServerPrefChanges to reflect new load… Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 <memory> 10 #include <memory>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 // Update cached prefs in |http_server_properties_impl_| with data from 202 // Update cached prefs in |http_server_properties_impl_| with data from
203 // preferences. It gets the data on pref thread and calls 203 // preferences. It gets the data on pref thread and calls
204 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on 204 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on
205 // network thread. 205 // network thread.
206 virtual void UpdateCacheFromPrefsOnPrefSequence(); 206 virtual void UpdateCacheFromPrefsOnPrefSequence();
207 207
208 // Starts the update of cached prefs in |http_server_properties_impl_| on the 208 // Starts the update of cached prefs in |http_server_properties_impl_| on the
209 // network thread. Protected for testing. 209 // network thread. Protected for testing.
210 void UpdateCacheFromPrefsOnNetworkSequence( 210 void UpdateCacheFromPrefsOnNetworkSequence(
211 std::vector<std::string>* spdy_servers, 211 std::unique_ptr<SpdyServersMap> spdy_servers_map,
212 AlternativeServiceMap* alternative_service_map, 212 std::unique_ptr<AlternativeServiceMap> alternative_service_map,
213 IPAddress* last_quic_address, 213 std::unique_ptr<IPAddress> last_quic_address,
214 ServerNetworkStatsMap* server_network_stats_map, 214 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map,
215 QuicServerInfoMap* quic_server_info_map, 215 std::unique_ptr<QuicServerInfoMap> quic_server_info_map,
216 bool detected_corrupted_prefs); 216 bool detected_corrupted_prefs);
217 217
218 // These are used to delay updating the preferences when cached data in 218 // These are used to delay updating the preferences when cached data in
219 // |http_server_properties_impl_| is changing, and execute only one update per 219 // |http_server_properties_impl_| is changing, and execute only one update per
220 // simultaneous spdy_servers or spdy_settings or alternative_service changes. 220 // simultaneous spdy_servers or spdy_settings or alternative_service changes.
221 // |location| specifies where this method is called from. Virtual for testing. 221 // |location| specifies where this method is called from. Virtual for testing.
222 virtual void ScheduleUpdatePrefsOnNetworkSequence(Location location); 222 virtual void ScheduleUpdatePrefsOnNetworkSequence(Location location);
223 223
224 // Update prefs::kHttpServerProperties in preferences with the cached data 224 // Update prefs::kHttpServerProperties in preferences with the cached data
225 // from |http_server_properties_impl_|. This gets the data on network thread 225 // from |http_server_properties_impl_|. This gets the data on network thread
226 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref 226 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref
227 // thread. 227 // thread.
228 void UpdatePrefsFromCacheOnNetworkSequence(); 228 void UpdatePrefsFromCacheOnNetworkSequence();
229 229
230 // Same as above, but fires an optional |completion| callback on pref thread 230 // Same as above, but fires an optional |completion| callback on pref thread
231 // when finished. Virtual for testing. 231 // when finished. Virtual for testing.
232 virtual void UpdatePrefsFromCacheOnNetworkSequence( 232 virtual void UpdatePrefsFromCacheOnNetworkSequence(
233 const base::Closure& completion); 233 const base::Closure& completion);
234 234
235 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an 235 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an
236 // optional |completion| callback when finished. Protected for testing. 236 // optional |completion| callback when finished. Protected for testing.
237 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, 237 void UpdatePrefsOnPrefThread(
238 AlternativeServiceMap* alternative_service_map, 238 std::unique_ptr<std::vector<std::string>> spdy_servers,
239 IPAddress* last_quic_address, 239 std::unique_ptr<AlternativeServiceMap> alternative_service_map,
240 ServerNetworkStatsMap* server_network_stats_map, 240 std::unique_ptr<IPAddress> last_quic_address,
241 QuicServerInfoMap* quic_server_info_map, 241 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map,
242 const base::Closure& completion); 242 std::unique_ptr<QuicServerInfoMap> quic_server_info_map,
243 const base::Closure& completion);
243 244
244 private: 245 private:
245 typedef std::vector<std::string> ServerList;
246
247 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, 246 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest,
248 AddToAlternativeServiceMap); 247 AddToAlternativeServiceMap);
249 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, 248 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest,
250 DoNotLoadAltSvcForInsecureOrigins); 249 DoNotLoadAltSvcForInsecureOrigins);
251 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, 250 FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest,
252 DoNotLoadExpiredAlternativeService); 251 DoNotLoadExpiredAlternativeService);
253 void OnHttpServerPropertiesChanged(); 252 void OnHttpServerPropertiesChanged();
254 253
255 bool AddServersData(const base::DictionaryValue& server_dict, 254 bool AddServersData(const base::DictionaryValue& server_dict,
256 ServerList* spdy_servers, 255 SpdyServersMap* spdy_servers_map,
257 AlternativeServiceMap* alternative_service_map, 256 AlternativeServiceMap* alternative_service_map,
258 ServerNetworkStatsMap* network_stats_map, 257 ServerNetworkStatsMap* network_stats_map,
259 int version); 258 int version);
260 bool ParseAlternativeServiceDict( 259 bool ParseAlternativeServiceDict(
261 const base::DictionaryValue& alternative_service_dict, 260 const base::DictionaryValue& alternative_service_dict,
262 const std::string& server_str, 261 const std::string& server_str,
263 AlternativeServiceInfo* alternative_service_info); 262 AlternativeServiceInfo* alternative_service_info);
264 bool AddToAlternativeServiceMap( 263 bool AddToAlternativeServiceMap(
265 const url::SchemeHostPort& server, 264 const url::SchemeHostPort& server,
266 const base::DictionaryValue& server_dict, 265 const base::DictionaryValue& server_dict,
267 AlternativeServiceMap* alternative_service_map); 266 AlternativeServiceMap* alternative_service_map);
268 bool ReadSupportsQuic(const base::DictionaryValue& server_dict, 267 bool ReadSupportsQuic(const base::DictionaryValue& server_dict,
269 IPAddress* last_quic_address); 268 IPAddress* last_quic_address);
270 bool AddToNetworkStatsMap(const url::SchemeHostPort& server, 269 bool AddToNetworkStatsMap(const url::SchemeHostPort& server,
271 const base::DictionaryValue& server_dict, 270 const base::DictionaryValue& server_dict,
272 ServerNetworkStatsMap* network_stats_map); 271 ServerNetworkStatsMap* network_stats_map);
273 bool AddToQuicServerInfoMap(const base::DictionaryValue& server_dict, 272 bool AddToQuicServerInfoMap(const base::DictionaryValue& server_dict,
274 QuicServerInfoMap* quic_server_info_map); 273 QuicServerInfoMap* quic_server_info_map);
275 274
276 void SaveAlternativeServiceToServerPrefs( 275 void SaveAlternativeServiceToServerPrefs(
277 const AlternativeServiceInfoVector* alternative_service_info_vector, 276 const AlternativeServiceInfoVector& alternative_service_info_vector,
278 base::DictionaryValue* server_pref_dict); 277 base::DictionaryValue* server_pref_dict);
279 void SaveSupportsQuicToPrefs( 278 void SaveSupportsQuicToPrefs(
280 const IPAddress* last_quic_address, 279 const IPAddress& last_quic_address,
281 base::DictionaryValue* http_server_properties_dict); 280 base::DictionaryValue* http_server_properties_dict);
282 void SaveNetworkStatsToServerPrefs( 281 void SaveNetworkStatsToServerPrefs(
283 const ServerNetworkStats* server_network_stats, 282 const ServerNetworkStats& server_network_stats,
284 base::DictionaryValue* server_pref_dict); 283 base::DictionaryValue* server_pref_dict);
285 void SaveQuicServerInfoMapToServerPrefs( 284 void SaveQuicServerInfoMapToServerPrefs(
286 QuicServerInfoMap* quic_server_info_map, 285 const QuicServerInfoMap& quic_server_info_map,
287 base::DictionaryValue* http_server_properties_dict); 286 base::DictionaryValue* http_server_properties_dict);
288 void SetInitialized(); 287 void SetInitialized();
289 288
290 // ----------- 289 // -----------
291 // Pref thread 290 // Pref thread
292 // ----------- 291 // -----------
293 292
294 const scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner_; 293 const scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner_;
295 294
296 base::WeakPtr<HttpServerPropertiesManager> pref_weak_ptr_; 295 base::WeakPtr<HttpServerPropertiesManager> pref_weak_ptr_;
(...skipping 27 matching lines...) Expand all
324 network_weak_ptr_factory_; 323 network_weak_ptr_factory_;
325 324
326 const NetLogWithSource net_log_; 325 const NetLogWithSource net_log_;
327 326
328 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); 327 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager);
329 }; 328 };
330 329
331 } // namespace net 330 } // namespace net
332 331
333 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ 332 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698