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 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 bool GetSupportsQuic(IPAddressNumber* last_address) const override; | 116 bool GetSupportsQuic(IPAddressNumber* last_address) const override; |
117 void SetSupportsQuic(bool used_quic, | 117 void SetSupportsQuic(bool used_quic, |
118 const IPAddressNumber& last_address) override; | 118 const IPAddressNumber& last_address) override; |
119 void SetServerNetworkStats(const HostPortPair& host_port_pair, | 119 void SetServerNetworkStats(const HostPortPair& host_port_pair, |
120 ServerNetworkStats stats) override; | 120 ServerNetworkStats stats) override; |
121 const ServerNetworkStats* GetServerNetworkStats( | 121 const ServerNetworkStats* GetServerNetworkStats( |
122 const HostPortPair& host_port_pair) override; | 122 const HostPortPair& host_port_pair) override; |
123 const ServerNetworkStatsMap& server_network_stats_map() const override; | 123 const ServerNetworkStatsMap& server_network_stats_map() const override; |
124 | 124 |
125 protected: | 125 protected: |
| 126 // The location where ScheduleUpdatePrefsOnNetworkThread was called. |
| 127 enum Location { |
| 128 SUPPORTS_SPDY = 0, |
| 129 HTTP_11_REQUIRED = 1, |
| 130 SET_ALTERNATIVE_SERVICE = 2, |
| 131 MARK_ALTERNATIVE_SERVICE_BROKEN = 3, |
| 132 MARK_ALTERNATIVE_SERVICE_RECENTLY_BROKEN = 4, |
| 133 CONFIRM_ALTERNATIVE_SERVICE = 5, |
| 134 CLEAR_ALTERNATIVE_SERVICE = 6, |
| 135 SET_SPDY_SETTING = 7, |
| 136 CLEAR_SPDY_SETTINGS = 8, |
| 137 CLEAR_ALL_SPDY_SETTINGS = 9, |
| 138 SET_SUPPORTS_QUIC = 10, |
| 139 SET_SERVER_NETWORK_STATS = 11, |
| 140 DETECTED_CORRUPTED_PREFS = 12, |
| 141 NUM_LOCATIONS = 13, |
| 142 }; |
| 143 |
126 // -------------------- | 144 // -------------------- |
127 // SPDY related methods | 145 // SPDY related methods |
128 | 146 |
129 // These are used to delay updating of the cached data in | 147 // These are used to delay updating of the cached data in |
130 // |http_server_properties_impl_| while the preferences are changing, and | 148 // |http_server_properties_impl_| while the preferences are changing, and |
131 // execute only one update per simultaneous prefs changes. | 149 // execute only one update per simultaneous prefs changes. |
132 void ScheduleUpdateCacheOnPrefThread(); | 150 void ScheduleUpdateCacheOnPrefThread(); |
133 | 151 |
134 // Starts the timers to update the cached prefs. This are overridden in tests | 152 // Starts the timers to update the cached prefs. This are overridden in tests |
135 // to prevent the delay. | 153 // to prevent the delay. |
(...skipping 11 matching lines...) Expand all Loading... |
147 std::vector<std::string>* spdy_servers, | 165 std::vector<std::string>* spdy_servers, |
148 SpdySettingsMap* spdy_settings_map, | 166 SpdySettingsMap* spdy_settings_map, |
149 AlternativeServiceMap* alternative_service_map, | 167 AlternativeServiceMap* alternative_service_map, |
150 IPAddressNumber* last_quic_address, | 168 IPAddressNumber* last_quic_address, |
151 ServerNetworkStatsMap* server_network_stats_map, | 169 ServerNetworkStatsMap* server_network_stats_map, |
152 bool detected_corrupted_prefs); | 170 bool detected_corrupted_prefs); |
153 | 171 |
154 // These are used to delay updating the preferences when cached data in | 172 // These are used to delay updating the preferences when cached data in |
155 // |http_server_properties_impl_| is changing, and execute only one update per | 173 // |http_server_properties_impl_| is changing, and execute only one update per |
156 // simultaneous spdy_servers or spdy_settings or alternative_service changes. | 174 // simultaneous spdy_servers or spdy_settings or alternative_service changes. |
157 void ScheduleUpdatePrefsOnNetworkThread(); | 175 // |location| specifies where this method is called from. |
| 176 void ScheduleUpdatePrefsOnNetworkThread(Location location); |
158 | 177 |
159 // Starts the timers to update the prefs from cache. This are overridden in | 178 // Starts the timers to update the prefs from cache. This are overridden in |
160 // tests to prevent the delay. | 179 // tests to prevent the delay. |
161 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); | 180 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); |
162 | 181 |
163 // Update prefs::kHttpServerProperties in preferences with the cached data | 182 // Update prefs::kHttpServerProperties in preferences with the cached data |
164 // from |http_server_properties_impl_|. This gets the data on network thread | 183 // from |http_server_properties_impl_|. This gets the data on network thread |
165 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref | 184 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref |
166 // thread. | 185 // thread. |
167 void UpdatePrefsFromCacheOnNetworkThread(); | 186 void UpdatePrefsFromCacheOnNetworkThread(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // Used to get |weak_ptr_| to self on the network thread. | 268 // Used to get |weak_ptr_| to self on the network thread. |
250 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > | 269 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > |
251 network_weak_ptr_factory_; | 270 network_weak_ptr_factory_; |
252 | 271 |
253 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); | 272 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); |
254 }; | 273 }; |
255 | 274 |
256 } // namespace net | 275 } // namespace net |
257 | 276 |
258 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 277 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
OLD | NEW |