Project import generated by Copybara. PiperOrigin-RevId: 237361882 Change-Id: I109a68f44db867b20f8c6a7732b0ce657133e52a
diff --git a/quic/core/quic_server_id.cc b/quic/core/quic_server_id.cc new file mode 100644 index 0000000..ab35d6e --- /dev/null +++ b/quic/core/quic_server_id.cc
@@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/third_party/quiche/src/quic/core/quic_server_id.h" + +#include <tuple> + +#include "net/third_party/quiche/src/quic/platform/api/quic_estimate_memory_usage.h" +#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h" +#include "net/third_party/quiche/src/quic/platform/api/quic_string.h" + +namespace quic { + +QuicServerId::QuicServerId() : QuicServerId("", 0, false) {} + +QuicServerId::QuicServerId(const QuicString& host, uint16_t port) + : QuicServerId(host, port, false) {} + +QuicServerId::QuicServerId(const QuicString& host, + uint16_t port, + bool privacy_mode_enabled) + : host_(host), port_(port), privacy_mode_enabled_(privacy_mode_enabled) {} + +QuicServerId::~QuicServerId() {} + +bool QuicServerId::operator<(const QuicServerId& other) const { + return std::tie(port_, host_, privacy_mode_enabled_) < + std::tie(other.port_, other.host_, other.privacy_mode_enabled_); +} + +bool QuicServerId::operator==(const QuicServerId& other) const { + return privacy_mode_enabled_ == other.privacy_mode_enabled_ && + host_ == other.host_ && port_ == other.port_; +} + +size_t QuicServerId::EstimateMemoryUsage() const { + return QuicEstimateMemoryUsage(host_); +} + +} // namespace quic