blob: 3018cee814e9fa36f900ea366455080b4b0b3f99 [file] [log] [blame]
Paul Jensen8e3c5d32018-02-19 17:06:331// 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
7namespace net {
8
9QuicSessionKey::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
14QuicSessionKey::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
20QuicSessionKey::QuicSessionKey(const QuicServerId& server_id,
21 const SocketTag& socket_tag)
22 : server_id_(server_id), socket_tag_(socket_tag) {}
23
24bool QuicSessionKey::operator<(const QuicSessionKey& other) const {
25 return std::tie(server_id_, socket_tag_) <
26 std::tie(other.server_id_, other.socket_tag_);
27}
28bool QuicSessionKey::operator==(const QuicSessionKey& other) const {
29 return server_id_ == other.server_id_ && socket_tag_ == other.socket_tag_;
30}
31
32size_t QuicSessionKey::EstimateMemoryUsage() const {
33 return server_id_.EstimateMemoryUsage();
34}
35
36} // namespace net