OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/spdy_session_key.h" | 5 #include "net/spdy/spdy_session_key.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 SpdySessionKey::SpdySessionKey() : privacy_mode_(PRIVACY_MODE_DISABLED) { | 11 SpdySessionKey::SpdySessionKey() : privacy_mode_(PRIVACY_MODE_DISABLED) { |
12 } | 12 } |
13 | 13 |
14 SpdySessionKey::SpdySessionKey(const HostPortPair& host_port_pair, | 14 SpdySessionKey::SpdySessionKey(const HostPortPair& host_port_pair, |
15 const ProxyServer& proxy_server, | 15 const ProxyServer& proxy_server, |
16 PrivacyMode privacy_mode) | 16 PrivacyMode privacy_mode) |
17 : host_port_proxy_pair_(host_port_pair, proxy_server), | 17 : host_port_proxy_pair_(host_port_pair, proxy_server), |
18 privacy_mode_(privacy_mode) { | 18 privacy_mode_(privacy_mode) { |
19 DVLOG(1) << "SpdySessionKey(host=" << host_port_pair.ToString() | 19 DVLOG(1) << "SpdySessionKey(host=" << host_port_pair.ToString() |
20 << ", proxy=" << proxy_server.ToURI() | 20 << ", proxy=" << proxy_server.ToURI() |
21 << ", privacy=" << privacy_mode; | 21 << ", privacy=" << privacy_mode; |
22 } | 22 } |
23 | 23 |
24 SpdySessionKey::SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair, | 24 SpdySessionKey::SpdySessionKey(const HostPortProxyPair& host_port_proxy_pair, |
25 PrivacyMode privacy_mode) | 25 PrivacyMode privacy_mode) |
26 : host_port_proxy_pair_(host_port_proxy_pair), | 26 : host_port_proxy_pair_(host_port_proxy_pair), privacy_mode_(privacy_mode) { |
27 privacy_mode_(privacy_mode) { | |
28 DVLOG(1) << "SpdySessionKey(hppp=" << host_port_proxy_pair.first.ToString() | 27 DVLOG(1) << "SpdySessionKey(hppp=" << host_port_proxy_pair.first.ToString() |
29 << "," << host_port_proxy_pair.second.ToURI() | 28 << "," << host_port_proxy_pair.second.ToURI() |
30 << ", privacy=" << privacy_mode; | 29 << ", privacy=" << privacy_mode; |
31 } | 30 } |
32 | 31 |
33 SpdySessionKey::~SpdySessionKey() {} | 32 SpdySessionKey::~SpdySessionKey() { |
| 33 } |
34 | 34 |
35 bool SpdySessionKey::operator<(const SpdySessionKey& other) const { | 35 bool SpdySessionKey::operator<(const SpdySessionKey& other) const { |
36 if (privacy_mode_ != other.privacy_mode_) | 36 if (privacy_mode_ != other.privacy_mode_) |
37 return 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)) | 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; | 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; | 40 return host_port_proxy_pair_.second < other.host_port_proxy_pair_.second; |
41 } | 41 } |
42 | 42 |
43 bool SpdySessionKey::Equals(const SpdySessionKey& other) const { | 43 bool SpdySessionKey::Equals(const SpdySessionKey& other) const { |
44 return privacy_mode_ == other.privacy_mode_ && | 44 return privacy_mode_ == other.privacy_mode_ && |
45 host_port_proxy_pair_.first.Equals(other.host_port_proxy_pair_.first) && | 45 host_port_proxy_pair_.first.Equals( |
46 host_port_proxy_pair_.second == other.host_port_proxy_pair_.second; | 46 other.host_port_proxy_pair_.first) && |
| 47 host_port_proxy_pair_.second == other.host_port_proxy_pair_.second; |
47 } | 48 } |
48 | 49 |
49 } // namespace net | 50 } // namespace net |
50 | |
OLD | NEW |