| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/core/crypto/quic_compressed_certs_cache.h" | 5 #include "net/quic/core/crypto/quic_compressed_certs_cache.h" |
| 6 | 6 |
| 7 using std::string; | 7 using std::string; |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 // Inline helper function for extending a 64-bit |seed| in-place with a 64-bit | 13 // Inline helper function for extending a 64-bit |seed| in-place with a 64-bit |
| 14 // |value|. Based on Boost's hash_combine function. | 14 // |value|. Based on Boost's hash_combine function. |
| 15 inline void hash_combine(uint64_t* seed, const uint64_t& val) { | 15 inline void hash_combine(uint64_t* seed, const uint64_t& val) { |
| 16 (*seed) ^= val + 0x9e3779b9 + ((*seed) << 6) + ((*seed) >> 2); | 16 (*seed) ^= val + 0x9e3779b9 + ((*seed) << 6) + ((*seed) >> 2); |
| 17 } | 17 } |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 QuicCompressedCertsCache::UncompressedCerts::UncompressedCerts() | 21 QuicCompressedCertsCache::UncompressedCerts::UncompressedCerts() |
| 22 : chain(nullptr) {} | 22 : chain(nullptr), |
| 23 client_common_set_hashes(nullptr), |
| 24 client_cached_cert_hashes(nullptr) {} |
| 23 | 25 |
| 24 QuicCompressedCertsCache::UncompressedCerts::UncompressedCerts( | 26 QuicCompressedCertsCache::UncompressedCerts::UncompressedCerts( |
| 25 const QuicReferenceCountedPointer<ProofSource::Chain>& chain, | 27 const QuicReferenceCountedPointer<ProofSource::Chain>& chain, |
| 26 const string* client_common_set_hashes, | 28 const string* client_common_set_hashes, |
| 27 const string* client_cached_cert_hashes) | 29 const string* client_cached_cert_hashes) |
| 28 : chain(chain), | 30 : chain(chain), |
| 29 client_common_set_hashes(client_common_set_hashes), | 31 client_common_set_hashes(client_common_set_hashes), |
| 30 client_cached_cert_hashes(client_cached_cert_hashes) {} | 32 client_cached_cert_hashes(client_cached_cert_hashes) {} |
| 31 | 33 |
| 32 QuicCompressedCertsCache::UncompressedCerts::~UncompressedCerts() {} | 34 QuicCompressedCertsCache::UncompressedCerts::~UncompressedCerts() {} |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 uint64_t h = | 117 uint64_t h = |
| 116 std::hash<string>()(*uncompressed_certs.client_cached_cert_hashes); | 118 std::hash<string>()(*uncompressed_certs.client_cached_cert_hashes); |
| 117 hash_combine(&hash, h); | 119 hash_combine(&hash, h); |
| 118 | 120 |
| 119 hash_combine(&hash, | 121 hash_combine(&hash, |
| 120 reinterpret_cast<uint64_t>(uncompressed_certs.chain.get())); | 122 reinterpret_cast<uint64_t>(uncompressed_certs.chain.get())); |
| 121 return hash; | 123 return hash; |
| 122 } | 124 } |
| 123 | 125 |
| 124 } // namespace net | 126 } // namespace net |
| OLD | NEW |