| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 // Clears all SPDY settings for a host. | 147 // Clears all SPDY settings for a host. |
| 148 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE; | 148 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE; |
| 149 | 149 |
| 150 // Clears all SPDY settings for all hosts. | 150 // Clears all SPDY settings for all hosts. |
| 151 virtual void ClearAllSpdySettings() OVERRIDE; | 151 virtual void ClearAllSpdySettings() OVERRIDE; |
| 152 | 152 |
| 153 // Returns all SPDY persistent settings. | 153 // Returns all SPDY persistent settings. |
| 154 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; | 154 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; |
| 155 | 155 |
| 156 // Methods for SupportsQuic. |
| 157 virtual SupportsQuic GetSupportsQuic( |
| 158 const HostPortPair& host_port_pair) const OVERRIDE; |
| 159 |
| 160 virtual void SetSupportsQuic(const HostPortPair& host_port_pair, |
| 161 bool used_quic, |
| 162 const std::string& address) OVERRIDE; |
| 163 |
| 164 virtual const SupportsQuicMap& supports_quic_map() const OVERRIDE; |
| 165 |
| 156 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, | 166 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, |
| 157 NetworkStats stats) OVERRIDE; | 167 NetworkStats stats) OVERRIDE; |
| 158 | 168 |
| 159 virtual const NetworkStats* GetServerNetworkStats( | 169 virtual const NetworkStats* GetServerNetworkStats( |
| 160 const HostPortPair& host_port_pair) const OVERRIDE; | 170 const HostPortPair& host_port_pair) const OVERRIDE; |
| 161 | 171 |
| 162 protected: | 172 protected: |
| 163 // -------------------- | 173 // -------------------- |
| 164 // SPDY related methods | 174 // SPDY related methods |
| 165 | 175 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 178 // network thread. | 188 // network thread. |
| 179 virtual void UpdateCacheFromPrefsOnPrefThread(); | 189 virtual void UpdateCacheFromPrefsOnPrefThread(); |
| 180 | 190 |
| 181 // Starts the update of cached prefs in |http_server_properties_impl_| on the | 191 // Starts the update of cached prefs in |http_server_properties_impl_| on the |
| 182 // network thread. Protected for testing. | 192 // network thread. Protected for testing. |
| 183 void UpdateCacheFromPrefsOnNetworkThread( | 193 void UpdateCacheFromPrefsOnNetworkThread( |
| 184 std::vector<std::string>* spdy_servers, | 194 std::vector<std::string>* spdy_servers, |
| 185 SpdySettingsMap* spdy_settings_map, | 195 SpdySettingsMap* spdy_settings_map, |
| 186 AlternateProtocolMap* alternate_protocol_map, | 196 AlternateProtocolMap* alternate_protocol_map, |
| 187 AlternateProtocolExperiment alternate_protocol_experiment, | 197 AlternateProtocolExperiment alternate_protocol_experiment, |
| 198 SupportsQuicMap* supports_quic_map, |
| 188 bool detected_corrupted_prefs); | 199 bool detected_corrupted_prefs); |
| 189 | 200 |
| 190 // These are used to delay updating the preferences when cached data in | 201 // These are used to delay updating the preferences when cached data in |
| 191 // |http_server_properties_impl_| is changing, and execute only one update per | 202 // |http_server_properties_impl_| is changing, and execute only one update per |
| 192 // simultaneous spdy_servers or spdy_settings or alternate_protocol changes. | 203 // simultaneous spdy_servers or spdy_settings or alternate_protocol changes. |
| 193 void ScheduleUpdatePrefsOnNetworkThread(); | 204 void ScheduleUpdatePrefsOnNetworkThread(); |
| 194 | 205 |
| 195 // Starts the timers to update the prefs from cache. This are overridden in | 206 // Starts the timers to update the prefs from cache. This are overridden in |
| 196 // tests to prevent the delay. | 207 // tests to prevent the delay. |
| 197 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); | 208 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); |
| 198 | 209 |
| 199 // Update prefs::kHttpServerProperties in preferences with the cached data | 210 // Update prefs::kHttpServerProperties in preferences with the cached data |
| 200 // from |http_server_properties_impl_|. This gets the data on network thread | 211 // from |http_server_properties_impl_|. This gets the data on network thread |
| 201 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref | 212 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref |
| 202 // thread. | 213 // thread. |
| 203 void UpdatePrefsFromCacheOnNetworkThread(); | 214 void UpdatePrefsFromCacheOnNetworkThread(); |
| 204 | 215 |
| 205 // Same as above, but fires an optional |completion| callback on pref thread | 216 // Same as above, but fires an optional |completion| callback on pref thread |
| 206 // when finished. Virtual for testing. | 217 // when finished. Virtual for testing. |
| 207 virtual void UpdatePrefsFromCacheOnNetworkThread( | 218 virtual void UpdatePrefsFromCacheOnNetworkThread( |
| 208 const base::Closure& completion); | 219 const base::Closure& completion); |
| 209 | 220 |
| 210 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an | 221 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an |
| 211 // optional |completion| callback when finished. Protected for testing. | 222 // optional |completion| callback when finished. Protected for testing. |
| 212 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, | 223 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, |
| 213 SpdySettingsMap* spdy_settings_map, | 224 SpdySettingsMap* spdy_settings_map, |
| 214 AlternateProtocolMap* alternate_protocol_map, | 225 AlternateProtocolMap* alternate_protocol_map, |
| 226 SupportsQuicMap* supports_quic_map, |
| 215 const base::Closure& completion); | 227 const base::Closure& completion); |
| 216 | 228 |
| 217 private: | 229 private: |
| 218 void OnHttpServerPropertiesChanged(); | 230 void OnHttpServerPropertiesChanged(); |
| 219 | 231 |
| 220 // ----------- | 232 // ----------- |
| 221 // Pref thread | 233 // Pref thread |
| 222 // ----------- | 234 // ----------- |
| 223 | 235 |
| 224 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_; | 236 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 254 // Used to get |weak_ptr_| to self on the network thread. | 266 // Used to get |weak_ptr_| to self on the network thread. |
| 255 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > | 267 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > |
| 256 network_weak_ptr_factory_; | 268 network_weak_ptr_factory_; |
| 257 | 269 |
| 258 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); | 270 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); |
| 259 }; | 271 }; |
| 260 | 272 |
| 261 } // namespace net | 273 } // namespace net |
| 262 | 274 |
| 263 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 275 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
| OLD | NEW |