| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/quic/quic_session_key.h" | 5 #include "net/quic/quic_session_key.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 QuicSessionKey::QuicSessionKey() {} | 9 QuicSessionKey::QuicSessionKey() {} |
| 10 | 10 |
| 11 QuicSessionKey::QuicSessionKey(const HostPortPair& host_port_pair, | 11 QuicSessionKey::QuicSessionKey(const HostPortPair& host_port_pair, |
| 12 bool is_https) | 12 bool is_https) |
| 13 : host_port_pair_(host_port_pair), | 13 : host_port_pair_(host_port_pair), |
| 14 is_https_(is_https) {} | 14 is_https_(is_https) {} |
| 15 | 15 |
| 16 QuicSessionKey::QuicSessionKey(const std::string& host, |
| 17 uint16 port, |
| 18 bool is_https) |
| 19 : host_port_pair_(host, port), |
| 20 is_https_(is_https) {} |
| 21 |
| 16 QuicSessionKey::~QuicSessionKey() {} | 22 QuicSessionKey::~QuicSessionKey() {} |
| 17 | 23 |
| 18 bool QuicSessionKey::operator<(const QuicSessionKey &other) const { | 24 bool QuicSessionKey::operator<(const QuicSessionKey &other) const { |
| 19 if (!host_port_pair_.Equals(other.host_port_pair_)) { | 25 if (!host_port_pair_.Equals(other.host_port_pair_)) { |
| 20 return host_port_pair_ < other.host_port_pair_; | 26 return host_port_pair_ < other.host_port_pair_; |
| 21 } | 27 } |
| 22 return is_https_ < other.is_https_; | 28 return is_https_ < other.is_https_; |
| 23 } | 29 } |
| 24 | 30 |
| 25 bool QuicSessionKey::operator==(const QuicSessionKey& other) const { | 31 bool QuicSessionKey::operator==(const QuicSessionKey& other) const { |
| 26 return is_https_ == other.is_https_ && | 32 return is_https_ == other.is_https_ && |
| 27 host_port_pair_.Equals(other.host_port_pair_); | 33 host_port_pair_.Equals(other.host_port_pair_); |
| 28 }; | 34 }; |
| 29 | 35 |
| 30 std::string QuicSessionKey::ToString() const { | 36 std::string QuicSessionKey::ToString() const { |
| 31 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString(); | 37 return (is_https_ ? "https://" : "http://") + host_port_pair_.ToString(); |
| 32 } | 38 } |
| 33 | 39 |
| 34 } // namespace net | 40 } // namespace net |
| OLD | NEW |