OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/containers/mru_cache.h" | 11 #include "base/containers/mru_cache.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 #include "net/socket/next_proto.h" | 16 #include "net/socket/next_proto.h" |
17 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 17 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 enum AlternateProtocolExperiment { | |
22 // 200 alternate_protocol servers are loaded (persisted 200 MRU servers). | |
23 ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT = 0, | |
24 // 200 alternate_protocol servers are loaded (persisted 1000 MRU servers). | |
25 ALTERNATE_PROTOCOL_TRUNCATED_200_SERVERS, | |
26 // 1000 alternate_protocol servers are loaded (persisted 1000 MRU servers). | |
27 ALTERNATE_PROTOCOL_TRUNCATED_1000_SERVERS, | |
28 }; | |
29 | |
30 enum AlternateProtocolUsage { | 21 enum AlternateProtocolUsage { |
31 // Alternate Protocol was used without racing a normal connection. | 22 // Alternate Protocol was used without racing a normal connection. |
32 ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, | 23 ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, |
33 // Alternate Protocol was used by winning a race with a normal connection. | 24 // Alternate Protocol was used by winning a race with a normal connection. |
34 ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, | 25 ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, |
35 // Alternate Protocol was not used by losing a race with a normal connection. | 26 // Alternate Protocol was not used by losing a race with a normal connection. |
36 ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, | 27 ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, |
37 // Alternate Protocol was not used because no Alternate-Protocol information | 28 // Alternate Protocol was not used because no Alternate-Protocol information |
38 // was available when the request was issued, but an Alternate-Protocol header | 29 // was available when the request was issued, but an Alternate-Protocol header |
39 // was present in the response. | 30 // was present in the response. |
40 ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3, | 31 ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3, |
41 // Alternate Protocol was not used because it was marked broken. | 32 // Alternate Protocol was not used because it was marked broken. |
42 ALTERNATE_PROTOCOL_USAGE_BROKEN = 4, | 33 ALTERNATE_PROTOCOL_USAGE_BROKEN = 4, |
43 // Maximum value for the enum. | 34 // Maximum value for the enum. |
44 ALTERNATE_PROTOCOL_USAGE_MAX, | 35 ALTERNATE_PROTOCOL_USAGE_MAX, |
45 }; | 36 }; |
46 | 37 |
47 // Log a histogram to reflect |usage| and |alternate_protocol_experiment|. | 38 // Log a histogram to reflect |usage|. |
48 NET_EXPORT void HistogramAlternateProtocolUsage( | 39 NET_EXPORT void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage); |
49 AlternateProtocolUsage usage, | |
50 AlternateProtocolExperiment alternate_protocol_experiment); | |
51 | 40 |
52 enum BrokenAlternateProtocolLocation { | 41 enum BrokenAlternateProtocolLocation { |
53 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB = 0, | 42 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB = 0, |
54 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1, | 43 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1, |
55 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT = 2, | 44 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT = 2, |
56 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN = 3, | 45 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN = 3, |
57 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX, | 46 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX, |
58 }; | 47 }; |
59 | 48 |
60 // Log a histogram to reflect |location|. | 49 // Log a histogram to reflect |location|. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 175 |
187 // Confirms that Alternate-Protocol for |server| is working. | 176 // Confirms that Alternate-Protocol for |server| is working. |
188 virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0; | 177 virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0; |
189 | 178 |
190 // Clears the Alternate-Protocol for |server|. | 179 // Clears the Alternate-Protocol for |server|. |
191 virtual void ClearAlternateProtocol(const HostPortPair& server) = 0; | 180 virtual void ClearAlternateProtocol(const HostPortPair& server) = 0; |
192 | 181 |
193 // Returns all Alternate-Protocol mappings. | 182 // Returns all Alternate-Protocol mappings. |
194 virtual const AlternateProtocolMap& alternate_protocol_map() const = 0; | 183 virtual const AlternateProtocolMap& alternate_protocol_map() const = 0; |
195 | 184 |
196 virtual void SetAlternateProtocolExperiment( | |
197 AlternateProtocolExperiment experiment) = 0; | |
198 | |
199 // Sets the threshold to be used when evaluating Alternate-Protocol | 185 // Sets the threshold to be used when evaluating Alternate-Protocol |
200 // advertisments. Only advertisements with a with a probability | 186 // advertisments. Only advertisements with a with a probability |
201 // greater than |threshold| will be honored. |threshold| must be | 187 // greater than |threshold| will be honored. |threshold| must be |
202 // between 0 and 1 inclusive. Hence, a threshold of 0 implies that | 188 // between 0 and 1 inclusive. Hence, a threshold of 0 implies that |
203 // all advertisements will be honored. | 189 // all advertisements will be honored. |
204 virtual void SetAlternateProtocolProbabilityThreshold( | 190 virtual void SetAlternateProtocolProbabilityThreshold( |
205 double threshold) = 0; | 191 double threshold) = 0; |
206 | 192 |
207 virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() | |
208 const = 0; | |
209 | |
210 // Gets a reference to the SettingsMap stored for a host. | 193 // Gets a reference to the SettingsMap stored for a host. |
211 // If no settings are stored, returns an empty SettingsMap. | 194 // If no settings are stored, returns an empty SettingsMap. |
212 virtual const SettingsMap& GetSpdySettings( | 195 virtual const SettingsMap& GetSpdySettings( |
213 const HostPortPair& host_port_pair) = 0; | 196 const HostPortPair& host_port_pair) = 0; |
214 | 197 |
215 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 198 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
216 // is to be persisted. | 199 // is to be persisted. |
217 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 200 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, |
218 SpdySettingsIds id, | 201 SpdySettingsIds id, |
219 SpdySettingsFlags flags, | 202 SpdySettingsFlags flags, |
(...skipping 24 matching lines...) Expand all Loading... |
244 virtual const NetworkStats* GetServerNetworkStats( | 227 virtual const NetworkStats* GetServerNetworkStats( |
245 const HostPortPair& host_port_pair) const = 0; | 228 const HostPortPair& host_port_pair) const = 0; |
246 | 229 |
247 private: | 230 private: |
248 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 231 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
249 }; | 232 }; |
250 | 233 |
251 } // namespace net | 234 } // namespace net |
252 | 235 |
253 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 236 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |