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/http/http_pipelined_host_capability.h" | 16 #include "net/http/http_pipelined_host_capability.h" |
17 #include "net/socket/next_proto.h" | 17 #include "net/socket/next_proto.h" |
18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
| 22 enum AlternateProtocolExperiment { |
| 23 // 200 alternate_protocol servers are loaded (persisted 200 MRU servers). |
| 24 ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT = 0, |
| 25 // 200 alternate_protocol servers are loaded (persisted 1000 MRU servers). |
| 26 ALTERNATE_PROTOCOL_TRUNCATED_200_SERVERS, |
| 27 // 1000 alternate_protocol servers are loaded (persisted 1000 MRU servers). |
| 28 ALTERNATE_PROTOCOL_TRUNCATED_1000_SERVERS, |
| 29 }; |
| 30 |
22 enum AlternateProtocolUsage { | 31 enum AlternateProtocolUsage { |
23 // Alternate Protocol was used without racing a normal connection. | 32 // Alternate Protocol was used without racing a normal connection. |
24 ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, | 33 ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, |
25 // Alternate Protocol was used by winning a race with a normal connection. | 34 // Alternate Protocol was used by winning a race with a normal connection. |
26 ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, | 35 ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, |
27 // Alternate Protocol was not used by losing a race with a normal connection. | 36 // Alternate Protocol was not used by losing a race with a normal connection. |
28 ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, | 37 ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, |
29 // Alternate Protocol was not used because no Alternate-Protocol information | 38 // Alternate Protocol was not used because no Alternate-Protocol information |
30 // was available when the request was issued, but an Alternate-Protocol header | 39 // was available when the request was issued, but an Alternate-Protocol header |
31 // was present in the response. | 40 // was present in the response. |
32 ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3, | 41 ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3, |
33 // Alternate Protocol was not used because it was marked broken. | 42 // Alternate Protocol was not used because it was marked broken. |
34 ALTERNATE_PROTOCOL_USAGE_BROKEN = 4, | 43 ALTERNATE_PROTOCOL_USAGE_BROKEN = 4, |
35 // Maximum value for the enum. | 44 // Maximum value for the enum. |
36 ALTERNATE_PROTOCOL_USAGE_MAX, | 45 ALTERNATE_PROTOCOL_USAGE_MAX, |
37 }; | 46 }; |
38 | 47 |
39 // Log a histogram to reflect |usage|. | 48 // Log a histogram to reflect |usage| and |alternate_protocol_experiment|. |
40 NET_EXPORT void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage); | 49 NET_EXPORT void HistogramAlternateProtocolUsage( |
| 50 AlternateProtocolUsage usage, |
| 51 AlternateProtocolExperiment alternate_protocol_experiment); |
41 | 52 |
42 enum BrokenAlternateProtocolLocation { | 53 enum BrokenAlternateProtocolLocation { |
43 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB = 0, | 54 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB = 0, |
44 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1, | 55 BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1, |
45 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX, | 56 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX, |
46 }; | 57 }; |
47 | 58 |
48 // Log a histogram to reflect |location|. | 59 // Log a histogram to reflect |location|. |
49 NET_EXPORT void HistogramBrokenAlternateProtocolLocation( | 60 NET_EXPORT void HistogramBrokenAlternateProtocolLocation( |
50 BrokenAlternateProtocolLocation location); | 61 BrokenAlternateProtocolLocation location); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 161 |
151 // Confirms that Alternate-Protocol for |server| is working. | 162 // Confirms that Alternate-Protocol for |server| is working. |
152 virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0; | 163 virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0; |
153 | 164 |
154 // Clears the Alternate-Protocol for |server|. | 165 // Clears the Alternate-Protocol for |server|. |
155 virtual void ClearAlternateProtocol(const HostPortPair& server) = 0; | 166 virtual void ClearAlternateProtocol(const HostPortPair& server) = 0; |
156 | 167 |
157 // Returns all Alternate-Protocol mappings. | 168 // Returns all Alternate-Protocol mappings. |
158 virtual const AlternateProtocolMap& alternate_protocol_map() const = 0; | 169 virtual const AlternateProtocolMap& alternate_protocol_map() const = 0; |
159 | 170 |
| 171 virtual void SetAlternateProtocolExperiment( |
| 172 AlternateProtocolExperiment experiment) = 0; |
| 173 |
| 174 virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() |
| 175 const = 0; |
| 176 |
160 // Gets a reference to the SettingsMap stored for a host. | 177 // Gets a reference to the SettingsMap stored for a host. |
161 // If no settings are stored, returns an empty SettingsMap. | 178 // If no settings are stored, returns an empty SettingsMap. |
162 virtual const SettingsMap& GetSpdySettings( | 179 virtual const SettingsMap& GetSpdySettings( |
163 const HostPortPair& host_port_pair) = 0; | 180 const HostPortPair& host_port_pair) = 0; |
164 | 181 |
165 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 182 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
166 // is to be persisted. | 183 // is to be persisted. |
167 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 184 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, |
168 SpdySettingsIds id, | 185 SpdySettingsIds id, |
169 SpdySettingsFlags flags, | 186 SpdySettingsFlags flags, |
(...skipping 25 matching lines...) Expand all Loading... |
195 | 212 |
196 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; | 213 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; |
197 | 214 |
198 private: | 215 private: |
199 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 216 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
200 }; | 217 }; |
201 | 218 |
202 } // namespace net | 219 } // namespace net |
203 | 220 |
204 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 221 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |