| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 bool operator!=(const AlternativeService& other) const { | 97 bool operator!=(const AlternativeService& other) const { |
| 98 return !this->operator==(other); | 98 return !this->operator==(other); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool operator<(const AlternativeService& other) const { | 101 bool operator<(const AlternativeService& other) const { |
| 102 return std::tie(protocol, host, port) < | 102 return std::tie(protocol, host, port) < |
| 103 std::tie(other.protocol, other.host, other.port); | 103 std::tie(other.protocol, other.host, other.port); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Output format: "protocol host:port", e.g. "h2 www.google.com:1234". |
| 106 std::string ToString() const; | 107 std::string ToString() const; |
| 107 | 108 |
| 108 NextProto protocol; | 109 NextProto protocol; |
| 109 std::string host; | 110 std::string host; |
| 110 uint16_t port; | 111 uint16_t port; |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 NET_EXPORT_PRIVATE std::ostream& operator<<( | 114 NET_EXPORT_PRIVATE std::ostream& operator<<( |
| 114 std::ostream& os, | 115 std::ostream& os, |
| 115 const AlternativeService& alternative_service); | 116 const AlternativeService& alternative_service); |
| 116 | 117 |
| 118 struct AlternativeServiceHash { |
| 119 size_t operator()(const net::AlternativeService& entry) const { |
| 120 return entry.protocol ^ std::hash<std::string>()(entry.host) ^ entry.port; |
| 121 } |
| 122 }; |
| 123 |
| 117 class NET_EXPORT_PRIVATE AlternativeServiceInfo { | 124 class NET_EXPORT_PRIVATE AlternativeServiceInfo { |
| 118 public: | 125 public: |
| 119 AlternativeServiceInfo(); | 126 AlternativeServiceInfo(); |
| 120 | 127 |
| 121 AlternativeServiceInfo(const AlternativeService& alternative_service, | 128 AlternativeServiceInfo(const AlternativeService& alternative_service, |
| 122 base::Time expiration); | 129 base::Time expiration); |
| 123 | 130 |
| 124 AlternativeServiceInfo(NextProto protocol, | 131 AlternativeServiceInfo(NextProto protocol, |
| 125 const std::string& host, | 132 const std::string& host, |
| 126 uint16_t port, | 133 uint16_t port, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // Returns whether HttpServerProperties is initialized. | 371 // Returns whether HttpServerProperties is initialized. |
| 365 virtual bool IsInitialized() const = 0; | 372 virtual bool IsInitialized() const = 0; |
| 366 | 373 |
| 367 private: | 374 private: |
| 368 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 375 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 369 }; | 376 }; |
| 370 | 377 |
| 371 } // namespace net | 378 } // namespace net |
| 372 | 379 |
| 373 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 380 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |