Chromium Code Reviews| 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 #ifndef BASE_UNGUESSABLE_TOKEN_H_ | 5 #ifndef BASE_UNGUESSABLE_TOKEN_H_ |
| 6 #define BASE_UNGUESSABLE_TOKEN_H_ | 6 #define BASE_UNGUESSABLE_TOKEN_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <iosfwd> | |
| 10 #include <tuple> | 11 #include <tuple> |
| 11 | 12 |
| 12 #include "base/base_export.h" | 13 #include "base/base_export.h" |
| 13 #include "base/hash.h" | 14 #include "base/hash.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 | 18 |
| 18 struct UnguessableTokenHash; | 19 struct UnguessableTokenHash; |
| 19 | 20 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 // For use in std::unordered_map. | 90 // For use in std::unordered_map. |
| 90 struct UnguessableTokenHash { | 91 struct UnguessableTokenHash { |
| 91 size_t operator()(const base::UnguessableToken& token) const { | 92 size_t operator()(const base::UnguessableToken& token) const { |
| 92 DCHECK(token); | 93 DCHECK(token); |
| 93 return base::HashInts64(token.high_, token.low_); | 94 return base::HashInts64(token.high_, token.low_); |
| 94 } | 95 } |
| 95 }; | 96 }; |
| 96 | 97 |
| 98 BASE_EXPORT inline std::ostream& operator<<(std::ostream& out, | |
| 99 const UnguessableToken& token) { | |
| 100 return out << token.ToString(); | |
|
danakj
2016/09/19 23:41:05
Can you put the defn in the .cc file?
tguilbert
2016/09/20 00:04:53
Done.
| |
| 101 } | |
| 102 | |
| 97 } // namespace base | 103 } // namespace base |
| 98 | 104 |
| 99 #endif // BASE_UNGUESSABLE_TOKEN_H_ | 105 #endif // BASE_UNGUESSABLE_TOKEN_H_ |
| OLD | NEW |