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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION - | 79 ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION - |
80 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION + 1, | 80 ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION + 1, |
81 }; | 81 }; |
82 | 82 |
83 NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol); | 83 NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol); |
84 NET_EXPORT AlternateProtocol AlternateProtocolFromString( | 84 NET_EXPORT AlternateProtocol AlternateProtocolFromString( |
85 const std::string& str); | 85 const std::string& str); |
86 NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto( | 86 NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto( |
87 NextProto next_proto); | 87 NextProto next_proto); |
88 | 88 |
| 89 struct NET_EXPORT AlternativeService { |
| 90 AlternativeService() |
| 91 : protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), host(), port(0) {} |
| 92 |
| 93 AlternativeService(AlternateProtocol protocol, |
| 94 const std::string& host, |
| 95 uint16 port) |
| 96 : protocol(protocol), host(host), port(port) {} |
| 97 |
| 98 AlternativeService(const AlternativeService& altsvc) = default; |
| 99 AlternativeService& operator=(const AlternativeService& altsvc) = default; |
| 100 |
| 101 bool operator<(const AlternativeService& other) const { |
| 102 if (protocol != other.protocol) |
| 103 return protocol < other.protocol; |
| 104 if (host != other.host) |
| 105 return host < other.host; |
| 106 return port < other.port; |
| 107 } |
| 108 |
| 109 AlternateProtocol protocol; |
| 110 std::string host; |
| 111 uint16 port; |
| 112 }; |
| 113 |
89 struct NET_EXPORT AlternateProtocolInfo { | 114 struct NET_EXPORT AlternateProtocolInfo { |
90 AlternateProtocolInfo() | 115 AlternateProtocolInfo() |
91 : port(0), | 116 : port(0), |
92 protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), | 117 protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), |
93 probability(0), | 118 probability(0), |
94 is_broken(false) {} | 119 is_broken(false) {} |
95 | 120 |
96 AlternateProtocolInfo(uint16 port, | 121 AlternateProtocolInfo(uint16 port, |
97 AlternateProtocol protocol, | 122 AlternateProtocol protocol, |
98 double probability) | 123 double probability) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 285 |
261 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 286 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
262 | 287 |
263 private: | 288 private: |
264 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 289 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
265 }; | 290 }; |
266 | 291 |
267 } // namespace net | 292 } // namespace net |
268 | 293 |
269 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 294 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |