| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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/spdy/spdy_session_key.h" | |
| 6 | |
| 7 #include <tuple> | |
| 8 | |
| 9 #include "base/logging.h" | |
| 10 #include "net/base/host_port_pair.h" | |
| 11 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 SpdySessionKey::SpdySessionKey() : privacy_mode_(PRIVACY_MODE_DISABLED) { | |
| 16 } | |
| 17 | |
| 18 SpdySessionKey::SpdySessionKey(const HostPortPair& host_port_pair, | |
| 19 const ProxyServer& proxy_server, | |
| 20 PrivacyMode privacy_mode) | |
| 21 : host_port_proxy_pair_(host_port_pair, proxy_server), | |
| 22 privacy_mode_(privacy_mode) { | |
| 23 DVLOG(1) << "SpdySessionKey(host=" << host_port_pair.ToString() | |
| 24 << ", proxy=" << proxy_server.ToURI() | |
| 25 << ", privacy=" << privacy_mode; | |
| 26 } | |
| 27 | |
| 28 SpdySessionKey::SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair, | |
| 29 PrivacyMode privacy_mode) | |
| 30 : host_port_proxy_pair_(host_port_proxy_pair), | |
| 31 privacy_mode_(privacy_mode) { | |
| 32 DVLOG(1) << "SpdySessionKey(hppp=" << host_port_proxy_pair.first.ToString() | |
| 33 << "," << host_port_proxy_pair.second.ToURI() | |
| 34 << ", privacy=" << privacy_mode; | |
| 35 } | |
| 36 | |
| 37 SpdySessionKey::SpdySessionKey(const SpdySessionKey& other) = default; | |
| 38 | |
| 39 SpdySessionKey::~SpdySessionKey() {} | |
| 40 | |
| 41 bool SpdySessionKey::operator<(const SpdySessionKey& other) const { | |
| 42 return std::tie(privacy_mode_, host_port_proxy_pair_.first, | |
| 43 host_port_proxy_pair_.second) < | |
| 44 std::tie(other.privacy_mode_, other.host_port_proxy_pair_.first, | |
| 45 other.host_port_proxy_pair_.second); | |
| 46 } | |
| 47 | |
| 48 bool SpdySessionKey::Equals(const SpdySessionKey& other) const { | |
| 49 return privacy_mode_ == other.privacy_mode_ && | |
| 50 host_port_proxy_pair_.first.Equals(other.host_port_proxy_pair_.first) && | |
| 51 host_port_proxy_pair_.second == other.host_port_proxy_pair_.second; | |
| 52 } | |
| 53 | |
| 54 size_t SpdySessionKey::EstimateMemoryUsage() const { | |
| 55 return SpdyEstimateMemoryUsage(host_port_proxy_pair_); | |
| 56 } | |
| 57 | |
| 58 } // namespace net | |
| OLD | NEW |