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 #ifndef CC_SURFACES_SURFACE_SEQUENCE_H_ | 5 #ifndef CC_SURFACES_SURFACE_SEQUENCE_H_ |
6 #define CC_SURFACES_SURFACE_SEQUENCE_H_ | 6 #define CC_SURFACES_SURFACE_SEQUENCE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <tuple> | 11 #include <tuple> |
12 | 12 |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/hash.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 // A per-surface-namespace sequence number that's used to coordinate | 18 // A per-surface-namespace sequence number that's used to coordinate |
18 // dependencies between frames. A sequence number may be satisfied once, and | 19 // dependencies between frames. A sequence number may be satisfied once, and |
19 // may be depended on once. | 20 // may be depended on once. |
20 struct SurfaceSequence { | 21 struct SurfaceSequence { |
21 SurfaceSequence() : id_namespace(0u), sequence(0u) {} | 22 SurfaceSequence() : id_namespace(0u), sequence(0u) {} |
22 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) | 23 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) |
23 : id_namespace(id_namespace), sequence(sequence) {} | 24 : id_namespace(id_namespace), sequence(sequence) {} |
(...skipping 15 matching lines...) Expand all Loading... |
39 return std::tie(a.id_namespace, a.sequence) < | 40 return std::tie(a.id_namespace, a.sequence) < |
40 std::tie(b.id_namespace, b.sequence); | 41 std::tie(b.id_namespace, b.sequence); |
41 } | 42 } |
42 | 43 |
43 } // namespace cc | 44 } // namespace cc |
44 | 45 |
45 namespace BASE_HASH_NAMESPACE { | 46 namespace BASE_HASH_NAMESPACE { |
46 template <> | 47 template <> |
47 struct hash<cc::SurfaceSequence> { | 48 struct hash<cc::SurfaceSequence> { |
48 size_t operator()(cc::SurfaceSequence key) const { | 49 size_t operator()(cc::SurfaceSequence key) const { |
49 return base::HashPair(key.id_namespace, key.sequence); | 50 return base::HashInts(key.id_namespace, key.sequence); |
50 } | 51 } |
51 }; | 52 }; |
52 } // namespace BASE_HASH_NAMESPACE | 53 } // namespace BASE_HASH_NAMESPACE |
53 | 54 |
54 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ | 55 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ |
OLD | NEW |