QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/third_party/quiche/src/quic/core/quic_server_id.h" |
| 6 | |
vasilvv | 872e7a3 | 2019-03-12 16:42:44 -0700 | [diff] [blame] | 7 | #include <string> |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 8 | #include <tuple> |
| 9 | |
| 10 | #include "net/third_party/quiche/src/quic/platform/api/quic_estimate_memory_usage.h" |
| 11 | #include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 12 | |
| 13 | namespace quic { |
| 14 | |
| 15 | QuicServerId::QuicServerId() : QuicServerId("", 0, false) {} |
| 16 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 17 | QuicServerId::QuicServerId(const std::string& host, uint16_t port) |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 18 | : QuicServerId(host, port, false) {} |
| 19 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 20 | QuicServerId::QuicServerId(const std::string& host, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 21 | uint16_t port, |
| 22 | bool privacy_mode_enabled) |
| 23 | : host_(host), port_(port), privacy_mode_enabled_(privacy_mode_enabled) {} |
| 24 | |
| 25 | QuicServerId::~QuicServerId() {} |
| 26 | |
| 27 | bool QuicServerId::operator<(const QuicServerId& other) const { |
| 28 | return std::tie(port_, host_, privacy_mode_enabled_) < |
| 29 | std::tie(other.port_, other.host_, other.privacy_mode_enabled_); |
| 30 | } |
| 31 | |
| 32 | bool QuicServerId::operator==(const QuicServerId& other) const { |
| 33 | return privacy_mode_enabled_ == other.privacy_mode_enabled_ && |
| 34 | host_ == other.host_ && port_ == other.port_; |
| 35 | } |
| 36 | |
| 37 | size_t QuicServerId::EstimateMemoryUsage() const { |
| 38 | return QuicEstimateMemoryUsage(host_); |
| 39 | } |
| 40 | |
| 41 | } // namespace quic |