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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 SupportsQuic GetSupportsQuic( 148 SupportsQuic GetSupportsQuic(
149 const HostPortPair& host_port_pair) const override; 149 const HostPortPair& host_port_pair) const override;
150 150
151 void SetSupportsQuic(const HostPortPair& host_port_pair, 151 void SetSupportsQuic(const HostPortPair& host_port_pair,
152 bool used_quic, 152 bool used_quic,
153 const std::string& address) override; 153 const std::string& address) override;
154 154
155 const SupportsQuicMap& supports_quic_map() const override; 155 const SupportsQuicMap& supports_quic_map() const override;
156 156
157 void SetServerNetworkStats(const HostPortPair& host_port_pair, 157 void SetServerNetworkStats(const HostPortPair& host_port_pair,
158 NetworkStats stats) override; 158 ServerNetworkStats stats) override;
159 159
160 const NetworkStats* GetServerNetworkStats( 160 const ServerNetworkStats* GetServerNetworkStats(
161 const HostPortPair& host_port_pair) const override; 161 const HostPortPair& host_port_pair) override;
162
163 const ServerNetworkStatsMap& server_network_stats_map() const override;
162 164
163 protected: 165 protected:
164 // -------------------- 166 // --------------------
165 // SPDY related methods 167 // SPDY related methods
166 168
167 // These are used to delay updating of the cached data in 169 // These are used to delay updating of the cached data in
168 // |http_server_properties_impl_| while the preferences are changing, and 170 // |http_server_properties_impl_| while the preferences are changing, and
169 // execute only one update per simultaneous prefs changes. 171 // execute only one update per simultaneous prefs changes.
170 void ScheduleUpdateCacheOnPrefThread(); 172 void ScheduleUpdateCacheOnPrefThread();
171 173
172 // Starts the timers to update the cached prefs. This are overridden in tests 174 // Starts the timers to update the cached prefs. This are overridden in tests
173 // to prevent the delay. 175 // to prevent the delay.
174 virtual void StartCacheUpdateTimerOnPrefThread(base::TimeDelta delay); 176 virtual void StartCacheUpdateTimerOnPrefThread(base::TimeDelta delay);
175 177
176 // Update cached prefs in |http_server_properties_impl_| with data from 178 // Update cached prefs in |http_server_properties_impl_| with data from
177 // preferences. It gets the data on pref thread and calls 179 // preferences. It gets the data on pref thread and calls
178 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on 180 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on
179 // network thread. 181 // network thread.
180 virtual void UpdateCacheFromPrefsOnPrefThread(); 182 virtual void UpdateCacheFromPrefsOnPrefThread();
181 183
182 // Starts the update of cached prefs in |http_server_properties_impl_| on the 184 // Starts the update of cached prefs in |http_server_properties_impl_| on the
183 // network thread. Protected for testing. 185 // network thread. Protected for testing.
184 void UpdateCacheFromPrefsOnNetworkThread( 186 void UpdateCacheFromPrefsOnNetworkThread(
185 std::vector<std::string>* spdy_servers, 187 std::vector<std::string>* spdy_servers,
186 SpdySettingsMap* spdy_settings_map, 188 SpdySettingsMap* spdy_settings_map,
187 AlternateProtocolMap* alternate_protocol_map, 189 AlternateProtocolMap* alternate_protocol_map,
188 SupportsQuicMap* supports_quic_map, 190 SupportsQuicMap* supports_quic_map,
191 ServerNetworkStatsMap* server_network_stats_map,
189 bool detected_corrupted_prefs); 192 bool detected_corrupted_prefs);
190 193
191 // These are used to delay updating the preferences when cached data in 194 // These are used to delay updating the preferences when cached data in
192 // |http_server_properties_impl_| is changing, and execute only one update per 195 // |http_server_properties_impl_| is changing, and execute only one update per
193 // simultaneous spdy_servers or spdy_settings or alternate_protocol changes. 196 // simultaneous spdy_servers or spdy_settings or alternate_protocol changes.
194 void ScheduleUpdatePrefsOnNetworkThread(); 197 void ScheduleUpdatePrefsOnNetworkThread();
195 198
196 // Starts the timers to update the prefs from cache. This are overridden in 199 // Starts the timers to update the prefs from cache. This are overridden in
197 // tests to prevent the delay. 200 // tests to prevent the delay.
198 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); 201 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay);
199 202
200 // Update prefs::kHttpServerProperties in preferences with the cached data 203 // Update prefs::kHttpServerProperties in preferences with the cached data
201 // from |http_server_properties_impl_|. This gets the data on network thread 204 // from |http_server_properties_impl_|. This gets the data on network thread
202 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref 205 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref
203 // thread. 206 // thread.
204 void UpdatePrefsFromCacheOnNetworkThread(); 207 void UpdatePrefsFromCacheOnNetworkThread();
205 208
206 // Same as above, but fires an optional |completion| callback on pref thread 209 // Same as above, but fires an optional |completion| callback on pref thread
207 // when finished. Virtual for testing. 210 // when finished. Virtual for testing.
208 virtual void UpdatePrefsFromCacheOnNetworkThread( 211 virtual void UpdatePrefsFromCacheOnNetworkThread(
209 const base::Closure& completion); 212 const base::Closure& completion);
210 213
211 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an 214 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an
212 // optional |completion| callback when finished. Protected for testing. 215 // optional |completion| callback when finished. Protected for testing.
213 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, 216 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list,
214 SpdySettingsMap* spdy_settings_map, 217 SpdySettingsMap* spdy_settings_map,
215 AlternateProtocolMap* alternate_protocol_map, 218 AlternateProtocolMap* alternate_protocol_map,
216 SupportsQuicMap* supports_quic_map, 219 SupportsQuicMap* supports_quic_map,
220 ServerNetworkStatsMap* server_network_stats_map,
217 const base::Closure& completion); 221 const base::Closure& completion);
218 222
219 private: 223 private:
220 void OnHttpServerPropertiesChanged(); 224 void OnHttpServerPropertiesChanged();
221 225
222 // ----------- 226 // -----------
223 // Pref thread 227 // Pref thread
224 // ----------- 228 // -----------
225 229
226 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_; 230 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_;
(...skipping 29 matching lines...) Expand all
256 // Used to get |weak_ptr_| to self on the network thread. 260 // Used to get |weak_ptr_| to self on the network thread.
257 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > 261 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> >
258 network_weak_ptr_factory_; 262 network_weak_ptr_factory_;
259 263
260 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); 264 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager);
261 }; 265 };
262 266
263 } // namespace net 267 } // namespace net
264 268
265 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ 269 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_
OLDNEW
« no previous file with comments | « net/http/http_server_properties_impl_unittest.cc ('k') | net/http/http_server_properties_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698