Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame^] | 1 | // Copyright 2018 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/quic/chromium/quic_session_key.h" |
| 6 | |
| 7 | namespace net { |
| 8 | |
| 9 | QuicSessionKey::QuicSessionKey(const HostPortPair& host_port_pair, |
| 10 | PrivacyMode privacy_mode, |
| 11 | const SocketTag& socket_tag) |
| 12 | : QuicSessionKey(QuicServerId(host_port_pair, privacy_mode), socket_tag) {} |
| 13 | |
| 14 | QuicSessionKey::QuicSessionKey(const std::string& host, |
| 15 | uint16_t port, |
| 16 | PrivacyMode privacy_mode, |
| 17 | const SocketTag& socket_tag) |
| 18 | : QuicSessionKey(QuicServerId(host, port, privacy_mode), socket_tag) {} |
| 19 | |
| 20 | QuicSessionKey::QuicSessionKey(const QuicServerId& server_id, |
| 21 | const SocketTag& socket_tag) |
| 22 | : server_id_(server_id), socket_tag_(socket_tag) {} |
| 23 | |
| 24 | bool QuicSessionKey::operator<(const QuicSessionKey& other) const { |
| 25 | return std::tie(server_id_, socket_tag_) < |
| 26 | std::tie(other.server_id_, other.socket_tag_); |
| 27 | } |
| 28 | bool QuicSessionKey::operator==(const QuicSessionKey& other) const { |
| 29 | return server_id_ == other.server_id_ && socket_tag_ == other.socket_tag_; |
| 30 | } |
| 31 | |
| 32 | size_t QuicSessionKey::EstimateMemoryUsage() const { |
| 33 | return server_id_.EstimateMemoryUsage(); |
| 34 | } |
| 35 | |
| 36 | } // namespace net |