Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: base/unguessable_token.h

Issue 2379653006: Replaced cc::SurfaceId::nonce_ with base::UnguessableToken (Closed)
Patch Set: Changed SurfaceManager::kRootSurfaceId to a private field to avoid static initialization Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/ipc/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <iosfwd>
(...skipping 27 matching lines...) Expand all
38 38
39 // Return a UnguessableToken built from the high/low bytes provided. 39 // Return a UnguessableToken built from the high/low bytes provided.
40 // It should only be used in deserialization scenarios. 40 // It should only be used in deserialization scenarios.
41 // 41 //
42 // NOTE: If the deserialized token is empty, it means that it was never 42 // NOTE: If the deserialized token is empty, it means that it was never
43 // initialized via Create(). This is a security issue, and should be handled. 43 // initialized via Create(). This is a security issue, and should be handled.
44 static UnguessableToken Deserialize(uint64_t high, uint64_t low); 44 static UnguessableToken Deserialize(uint64_t high, uint64_t low);
45 45
46 // Creates an empty UnguessableToken. 46 // Creates an empty UnguessableToken.
47 // Assign to it with Create() before using it. 47 // Assign to it with Create() before using it.
48 UnguessableToken() = default; 48 constexpr UnguessableToken() = default;
49 49
50 // NOTE: Serializing an empty UnguessableToken is an illegal operation. 50 // NOTE: Serializing an empty UnguessableToken is an illegal operation.
51 uint64_t GetHighForSerialization() const { 51 uint64_t GetHighForSerialization() const {
52 DCHECK(!is_empty()); 52 DCHECK(!is_empty());
53 return high_; 53 return high_;
54 }; 54 };
55 55
56 // NOTE: Serializing an empty UnguessableToken is an illegal operation. 56 // NOTE: Serializing an empty UnguessableToken is an illegal operation.
57 uint64_t GetLowForSerialization() const { 57 uint64_t GetLowForSerialization() const {
58 DCHECK(!is_empty()); 58 DCHECK(!is_empty());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 struct UnguessableTokenHash { 94 struct UnguessableTokenHash {
95 size_t operator()(const base::UnguessableToken& token) const { 95 size_t operator()(const base::UnguessableToken& token) const {
96 DCHECK(token); 96 DCHECK(token);
97 return base::HashInts64(token.high_, token.low_); 97 return base::HashInts64(token.high_, token.low_);
98 } 98 }
99 }; 99 };
100 100
101 } // namespace base 101 } // namespace base
102 102
103 #endif // BASE_UNGUESSABLE_TOKEN_H_ 103 #endif // BASE_UNGUESSABLE_TOKEN_H_
OLDNEW
« no previous file with comments | « no previous file | cc/ipc/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698