| 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 <memory> | 10 #include <memory> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 // -------------------- | 185 // -------------------- |
| 186 // SPDY related methods | 186 // SPDY related methods |
| 187 | 187 |
| 188 // These are used to delay updating of the cached data in | 188 // These are used to delay updating of the cached data in |
| 189 // |http_server_properties_impl_| while the preferences are changing, and | 189 // |http_server_properties_impl_| while the preferences are changing, and |
| 190 // execute only one update per simultaneous prefs changes. | 190 // execute only one update per simultaneous prefs changes. |
| 191 void ScheduleUpdateCacheOnPrefThread(); | 191 void ScheduleUpdateCacheOnPrefThread(); |
| 192 | 192 |
| 193 // Starts the timers to update the cached prefs. This are overridden in tests | |
| 194 // to prevent the delay. | |
| 195 virtual void StartCacheUpdateTimerOnPrefThread(base::TimeDelta delay); | |
| 196 | |
| 197 // Update cached prefs in |http_server_properties_impl_| with data from | 193 // Update cached prefs in |http_server_properties_impl_| with data from |
| 198 // preferences. It gets the data on pref thread and calls | 194 // preferences. It gets the data on pref thread and calls |
| 199 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on | 195 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on |
| 200 // network thread. | 196 // network thread. |
| 201 virtual void UpdateCacheFromPrefsOnPrefThread(); | 197 virtual void UpdateCacheFromPrefsOnPrefThread(); |
| 202 | 198 |
| 203 // Starts the update of cached prefs in |http_server_properties_impl_| on the | 199 // Starts the update of cached prefs in |http_server_properties_impl_| on the |
| 204 // network thread. Protected for testing. | 200 // network thread. Protected for testing. |
| 205 void UpdateCacheFromPrefsOnNetworkThread( | 201 void UpdateCacheFromPrefsOnNetworkThread( |
| 206 std::vector<std::string>* spdy_servers, | 202 std::vector<std::string>* spdy_servers, |
| 207 AlternativeServiceMap* alternative_service_map, | 203 AlternativeServiceMap* alternative_service_map, |
| 208 IPAddress* last_quic_address, | 204 IPAddress* last_quic_address, |
| 209 ServerNetworkStatsMap* server_network_stats_map, | 205 ServerNetworkStatsMap* server_network_stats_map, |
| 210 QuicServerInfoMap* quic_server_info_map, | 206 QuicServerInfoMap* quic_server_info_map, |
| 211 bool detected_corrupted_prefs); | 207 bool detected_corrupted_prefs); |
| 212 | 208 |
| 213 // These are used to delay updating the preferences when cached data in | 209 // These are used to delay updating the preferences when cached data in |
| 214 // |http_server_properties_impl_| is changing, and execute only one update per | 210 // |http_server_properties_impl_| is changing, and execute only one update per |
| 215 // simultaneous spdy_servers or spdy_settings or alternative_service changes. | 211 // simultaneous spdy_servers or spdy_settings or alternative_service changes. |
| 216 // |location| specifies where this method is called from. Virtual for testing. | 212 // |location| specifies where this method is called from. Virtual for testing. |
| 217 virtual void ScheduleUpdatePrefsOnNetworkThread(Location location); | 213 virtual void ScheduleUpdatePrefsOnNetworkThread(Location location); |
| 218 | 214 |
| 219 // Starts the timers to update the prefs from cache. This are overridden in | |
| 220 // tests to prevent the delay. | |
| 221 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); | |
| 222 | |
| 223 // Update prefs::kHttpServerProperties in preferences with the cached data | 215 // Update prefs::kHttpServerProperties in preferences with the cached data |
| 224 // from |http_server_properties_impl_|. This gets the data on network thread | 216 // from |http_server_properties_impl_|. This gets the data on network thread |
| 225 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref | 217 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref |
| 226 // thread. | 218 // thread. |
| 227 void UpdatePrefsFromCacheOnNetworkThread(); | 219 void UpdatePrefsFromCacheOnNetworkThread(); |
| 228 | 220 |
| 229 // Same as above, but fires an optional |completion| callback on pref thread | 221 // Same as above, but fires an optional |completion| callback on pref thread |
| 230 // when finished. Virtual for testing. | 222 // when finished. Virtual for testing. |
| 231 virtual void UpdatePrefsFromCacheOnNetworkThread( | 223 virtual void UpdatePrefsFromCacheOnNetworkThread( |
| 232 const base::Closure& completion); | 224 const base::Closure& completion); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Used to get |weak_ptr_| to self on the network thread. | 313 // Used to get |weak_ptr_| to self on the network thread. |
| 322 std::unique_ptr<base::WeakPtrFactory<HttpServerPropertiesManager>> | 314 std::unique_ptr<base::WeakPtrFactory<HttpServerPropertiesManager>> |
| 323 network_weak_ptr_factory_; | 315 network_weak_ptr_factory_; |
| 324 | 316 |
| 325 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); | 317 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); |
| 326 }; | 318 }; |
| 327 | 319 |
| 328 } // namespace net | 320 } // namespace net |
| 329 | 321 |
| 330 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 322 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
| OLD | NEW |