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 
7 #include <string>
8 #include <tuple>
9 
10 #include "net/third_party/quiche/src/quic/platform/api/quic_estimate_memory_usage.h"
11 
12 namespace quic {
13 
QuicServerId()14 QuicServerId::QuicServerId() : QuicServerId("", 0, false) {}
15 
QuicServerId(const std::string & host,uint16_t port)16 QuicServerId::QuicServerId(const std::string& host, uint16_t port)
17     : QuicServerId(host, port, false) {}
18 
QuicServerId(const std::string & host,uint16_t port,bool privacy_mode_enabled)19 QuicServerId::QuicServerId(const std::string& host,
20                            uint16_t port,
21                            bool privacy_mode_enabled)
22     : host_(host), port_(port), privacy_mode_enabled_(privacy_mode_enabled) {}
23 
~QuicServerId()24 QuicServerId::~QuicServerId() {}
25 
operator <(const QuicServerId & other) const26 bool QuicServerId::operator<(const QuicServerId& other) const {
27   return std::tie(port_, host_, privacy_mode_enabled_) <
28          std::tie(other.port_, other.host_, other.privacy_mode_enabled_);
29 }
30 
operator ==(const QuicServerId & other) const31 bool QuicServerId::operator==(const QuicServerId& other) const {
32   return privacy_mode_enabled_ == other.privacy_mode_enabled_ &&
33          host_ == other.host_ && port_ == other.port_;
34 }
35 
EstimateMemoryUsage() const36 size_t QuicServerId::EstimateMemoryUsage() const {
37   return QuicEstimateMemoryUsage(host_);
38 }
39 
40 }  // namespace quic
41