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

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

Powered by Google App Engine
This is Rietveld 408576698