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 "base/logging.h" 8 9 namespace net { 10 11 SpdySessionKey::SpdySessionKey() : privacy_mode_(PRIVACY_MODE_DISABLED) { 12 } 13 14 SpdySessionKey::SpdySessionKey(const HostPortPair& host_port_pair, 15 const ProxyServer& proxy_server, 16 PrivacyMode privacy_mode) 17 : host_port_proxy_pair_(host_port_pair, proxy_server), 18 privacy_mode_(privacy_mode) { 19 DVLOG(1) << "SpdySessionKey(host=" << host_port_pair.ToString() 20 << ", proxy=" << proxy_server.ToURI() 21 << ", privacy=" << privacy_mode; 22 } 23 24 SpdySessionKey::SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair, 25 PrivacyMode privacy_mode) 26 : host_port_proxy_pair_(host_port_proxy_pair), 27 privacy_mode_(privacy_mode) { 28 DVLOG(1) << "SpdySessionKey(hppp=" << host_port_proxy_pair.first.ToString() 29 << "," << host_port_proxy_pair.second.ToURI() 30 << ", privacy=" << privacy_mode; 31 } 32 33 SpdySessionKey::~SpdySessionKey() {} 34 35 bool SpdySessionKey::operator<(const SpdySessionKey& other) const { 36 if (privacy_mode_ != other.privacy_mode_) 37 return privacy_mode_ < other.privacy_mode_; 38 if (!host_port_proxy_pair_.first.Equals(other.host_port_proxy_pair_.first)) 39 return host_port_proxy_pair_.first < other.host_port_proxy_pair_.first; 40 return host_port_proxy_pair_.second < other.host_port_proxy_pair_.second; 41 } 42 43 bool SpdySessionKey::Equals(const SpdySessionKey& other) const { 44 return privacy_mode_ == other.privacy_mode_ && 45 host_port_proxy_pair_.first.Equals(other.host_port_proxy_pair_.first) && 46 host_port_proxy_pair_.second == other.host_port_proxy_pair_.second; 47 } 48 49 } // namespace net 50 51