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

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

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // ---------------------------------- 79 // ----------------------------------
80 80
81 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; 81 base::WeakPtr<HttpServerProperties> GetWeakPtr() override;
82 void Clear() override; 82 void Clear() override;
83 bool SupportsRequestPriority(const HostPortPair& server) override; 83 bool SupportsRequestPriority(const HostPortPair& server) override;
84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; 84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override;
85 bool RequiresHTTP11(const HostPortPair& server) override; 85 bool RequiresHTTP11(const HostPortPair& server) override;
86 void SetHTTP11Required(const HostPortPair& server) override; 86 void SetHTTP11Required(const HostPortPair& server) override;
87 void MaybeForceHTTP11(const HostPortPair& server, 87 void MaybeForceHTTP11(const HostPortPair& server,
88 SSLConfig* ssl_config) override; 88 SSLConfig* ssl_config) override;
89 bool HasAlternateProtocol(const HostPortPair& server) override;
90 AlternateProtocolInfo GetAlternateProtocol( 89 AlternateProtocolInfo GetAlternateProtocol(
91 const HostPortPair& server) override; 90 const HostPortPair& server) override;
92 void SetAlternateProtocol(const HostPortPair& server, 91 void SetAlternateProtocol(const HostPortPair& server,
93 uint16 alternate_port, 92 uint16 alternate_port,
94 AlternateProtocol alternate_protocol, 93 AlternateProtocol alternate_protocol,
95 double alternate_probability) override; 94 double alternate_probability) override;
96 void SetBrokenAlternateProtocol(const HostPortPair& server) override; 95 void SetBrokenAlternateProtocol(const HostPortPair& server) override;
97 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override; 96 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override;
98 void ConfirmAlternateProtocol(const HostPortPair& server) override; 97 void ConfirmAlternateProtocol(const HostPortPair& server) override;
99 void ClearAlternateProtocol(const HostPortPair& server) override; 98 void ClearAlternateProtocol(const HostPortPair& server) override;
100 const AlternateProtocolMap& alternate_protocol_map() const override; 99 const AlternateProtocolMap& alternate_protocol_map() const override;
101 void SetAlternateProtocolProbabilityThreshold(double threshold) override; 100 void SetAlternateProtocolProbabilityThreshold(double threshold) override;
102 const SettingsMap& GetSpdySettings( 101 const SettingsMap& GetSpdySettings(
103 const HostPortPair& host_port_pair) override; 102 const HostPortPair& host_port_pair) override;
104 bool SetSpdySetting(const HostPortPair& host_port_pair, 103 bool SetSpdySetting(const HostPortPair& host_port_pair,
105 SpdySettingsIds id, 104 SpdySettingsIds id,
106 SpdySettingsFlags flags, 105 SpdySettingsFlags flags,
107 uint32 value) override; 106 uint32 value) override;
108 void ClearSpdySettings(const HostPortPair& host_port_pair) override; 107 void ClearSpdySettings(const HostPortPair& host_port_pair) override;
109 void ClearAllSpdySettings() override; 108 void ClearAllSpdySettings() override;
110 const SpdySettingsMap& spdy_settings_map() const override; 109 const SpdySettingsMap& spdy_settings_map() const override;
111 SupportsQuic GetSupportsQuic( 110 bool GetSupportsQuic(IPAddressNumber* last_address) const override;
112 const HostPortPair& host_port_pair) const override; 111 void SetSupportsQuic(bool used_quic,
113 void SetSupportsQuic(const HostPortPair& host_port_pair, 112 const IPAddressNumber& last_address) override;
114 bool used_quic,
115 const std::string& address) override;
116 const SupportsQuicMap& supports_quic_map() const override;
117 void SetServerNetworkStats(const HostPortPair& host_port_pair, 113 void SetServerNetworkStats(const HostPortPair& host_port_pair,
118 ServerNetworkStats stats) override; 114 ServerNetworkStats stats) override;
119 const ServerNetworkStats* GetServerNetworkStats( 115 const ServerNetworkStats* GetServerNetworkStats(
120 const HostPortPair& host_port_pair) override; 116 const HostPortPair& host_port_pair) override;
121 const ServerNetworkStatsMap& server_network_stats_map() const override; 117 const ServerNetworkStatsMap& server_network_stats_map() const override;
122 118
123 protected: 119 protected:
124 // -------------------- 120 // --------------------
125 // SPDY related methods 121 // SPDY related methods
126 122
(...skipping 11 matching lines...) Expand all
138 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on 134 // UpdateSpdyServersFromPrefsOnNetworkThread() to perform the update on
139 // network thread. 135 // network thread.
140 virtual void UpdateCacheFromPrefsOnPrefThread(); 136 virtual void UpdateCacheFromPrefsOnPrefThread();
141 137
142 // Starts the update of cached prefs in |http_server_properties_impl_| on the 138 // Starts the update of cached prefs in |http_server_properties_impl_| on the
143 // network thread. Protected for testing. 139 // network thread. Protected for testing.
144 void UpdateCacheFromPrefsOnNetworkThread( 140 void UpdateCacheFromPrefsOnNetworkThread(
145 std::vector<std::string>* spdy_servers, 141 std::vector<std::string>* spdy_servers,
146 SpdySettingsMap* spdy_settings_map, 142 SpdySettingsMap* spdy_settings_map,
147 AlternateProtocolMap* alternate_protocol_map, 143 AlternateProtocolMap* alternate_protocol_map,
148 SupportsQuicMap* supports_quic_map, 144 IPAddressNumber* last_quic_address,
149 ServerNetworkStatsMap* server_network_stats_map, 145 ServerNetworkStatsMap* server_network_stats_map,
150 bool detected_corrupted_prefs); 146 bool detected_corrupted_prefs);
151 147
152 // These are used to delay updating the preferences when cached data in 148 // These are used to delay updating the preferences when cached data in
153 // |http_server_properties_impl_| is changing, and execute only one update per 149 // |http_server_properties_impl_| is changing, and execute only one update per
154 // simultaneous spdy_servers or spdy_settings or alternate_protocol changes. 150 // simultaneous spdy_servers or spdy_settings or alternate_protocol changes.
155 void ScheduleUpdatePrefsOnNetworkThread(); 151 void ScheduleUpdatePrefsOnNetworkThread();
156 152
157 // Starts the timers to update the prefs from cache. This are overridden in 153 // Starts the timers to update the prefs from cache. This are overridden in
158 // tests to prevent the delay. 154 // tests to prevent the delay.
159 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay); 155 virtual void StartPrefsUpdateTimerOnNetworkThread(base::TimeDelta delay);
160 156
161 // Update prefs::kHttpServerProperties in preferences with the cached data 157 // Update prefs::kHttpServerProperties in preferences with the cached data
162 // from |http_server_properties_impl_|. This gets the data on network thread 158 // from |http_server_properties_impl_|. This gets the data on network thread
163 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref 159 // and posts a task (UpdatePrefsOnPrefThread) to update preferences on pref
164 // thread. 160 // thread.
165 void UpdatePrefsFromCacheOnNetworkThread(); 161 void UpdatePrefsFromCacheOnNetworkThread();
166 162
167 // Same as above, but fires an optional |completion| callback on pref thread 163 // Same as above, but fires an optional |completion| callback on pref thread
168 // when finished. Virtual for testing. 164 // when finished. Virtual for testing.
169 virtual void UpdatePrefsFromCacheOnNetworkThread( 165 virtual void UpdatePrefsFromCacheOnNetworkThread(
170 const base::Closure& completion); 166 const base::Closure& completion);
171 167
172 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an 168 // Update prefs::kHttpServerProperties preferences on pref thread. Executes an
173 // optional |completion| callback when finished. Protected for testing. 169 // optional |completion| callback when finished. Protected for testing.
174 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list, 170 void UpdatePrefsOnPrefThread(base::ListValue* spdy_server_list,
175 SpdySettingsMap* spdy_settings_map, 171 SpdySettingsMap* spdy_settings_map,
176 AlternateProtocolMap* alternate_protocol_map, 172 AlternateProtocolMap* alternate_protocol_map,
177 SupportsQuicMap* supports_quic_map, 173 IPAddressNumber* last_quic_address,
178 ServerNetworkStatsMap* server_network_stats_map, 174 ServerNetworkStatsMap* server_network_stats_map,
179 const base::Closure& completion); 175 const base::Closure& completion);
180 176
181 private: 177 private:
182 void OnHttpServerPropertiesChanged(); 178 void OnHttpServerPropertiesChanged();
183 179
180 bool ReadSupportsQuic(const base::DictionaryValue& server_dict,
181 IPAddressNumber* last_quic_address);
182 void AddToSpdySettingsMap(const HostPortPair& server,
183 const base::DictionaryValue& server_dict,
184 SpdySettingsMap* spdy_settings_map);
185 AlternateProtocolInfo ParseAlternateProtocolDict(
186 const base::DictionaryValue& alternate_protocol_dict,
187 const std::string& server_str);
188 bool AddToAlternateProtocolMap(const HostPortPair& server,
189 const base::DictionaryValue& server_dict,
190 AlternateProtocolMap* alternate_protocol_map);
191 bool AddToNetworkStatsMap(const HostPortPair& server,
192 const base::DictionaryValue& server_dict,
193 ServerNetworkStatsMap* network_stats_map);
194
195 void SaveSpdySettingsToServerPrefs(const SettingsMap* spdy_settings_map,
196 base::DictionaryValue* server_pref_dict);
197 void SaveAlternateProtocolToServerPrefs(
198 const AlternateProtocolInfo* port_alternate_protocol,
199 base::DictionaryValue* server_pref_dict);
200 void SaveNetworkStatsToServerPrefs(
201 const ServerNetworkStats* server_network_stats,
202 base::DictionaryValue* server_pref_dict);
203
204 void SaveSupportsQuicToPrefs(
205 const IPAddressNumber* last_quic_address,
206 base::DictionaryValue* http_server_properties_dict);
207
184 // ----------- 208 // -----------
185 // Pref thread 209 // Pref thread
186 // ----------- 210 // -----------
187 211
188 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_; 212 const scoped_refptr<base::SequencedTaskRunner> pref_task_runner_;
189 213
190 base::WeakPtr<HttpServerPropertiesManager> pref_weak_ptr_; 214 base::WeakPtr<HttpServerPropertiesManager> pref_weak_ptr_;
191 215
192 // Used to post cache update tasks. 216 // Used to post cache update tasks.
193 scoped_ptr<base::OneShotTimer<HttpServerPropertiesManager> > 217 scoped_ptr<base::OneShotTimer<HttpServerPropertiesManager> >
(...skipping 24 matching lines...) Expand all
218 // Used to get |weak_ptr_| to self on the network thread. 242 // Used to get |weak_ptr_| to self on the network thread.
219 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > 243 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> >
220 network_weak_ptr_factory_; 244 network_weak_ptr_factory_;
221 245
222 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); 246 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager);
223 }; 247 };
224 248
225 } // namespace net 249 } // namespace net
226 250
227 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ 251 #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