| 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" | |
| 14 #include "base/hash.h" | 13 #include "base/hash.h" |
| 15 | 14 |
| 16 namespace cc { | 15 namespace cc { |
| 17 | 16 |
| 18 // A per-surface-namespace sequence number that's used to coordinate | 17 // A per-surface-namespace sequence number that's used to coordinate |
| 19 // dependencies between frames. A sequence number may be satisfied once, and | 18 // dependencies between frames. A sequence number may be satisfied once, and |
| 20 // may be depended on once. | 19 // may be depended on once. |
| 21 struct SurfaceSequence { | 20 struct SurfaceSequence { |
| 22 SurfaceSequence() : id_namespace(0u), sequence(0u) {} | 21 SurfaceSequence() : id_namespace(0u), sequence(0u) {} |
| 23 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) | 22 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 | 33 |
| 35 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { | 34 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { |
| 36 return !(a == b); | 35 return !(a == b); |
| 37 } | 36 } |
| 38 | 37 |
| 39 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { | 38 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { |
| 40 return std::tie(a.id_namespace, a.sequence) < | 39 return std::tie(a.id_namespace, a.sequence) < |
| 41 std::tie(b.id_namespace, b.sequence); | 40 std::tie(b.id_namespace, b.sequence); |
| 42 } | 41 } |
| 43 | 42 |
| 44 } // namespace cc | 43 struct SurfaceSequenceHash { |
| 45 | 44 size_t operator()(SurfaceSequence key) const { |
| 46 namespace BASE_HASH_NAMESPACE { | |
| 47 template <> | |
| 48 struct hash<cc::SurfaceSequence> { | |
| 49 size_t operator()(cc::SurfaceSequence key) const { | |
| 50 return base::HashInts(key.id_namespace, key.sequence); | 45 return base::HashInts(key.id_namespace, key.sequence); |
| 51 } | 46 } |
| 52 }; | 47 }; |
| 53 } // namespace BASE_HASH_NAMESPACE | 48 |
| 49 } // namespace cc |
| 54 | 50 |
| 55 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ | 51 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ |
| OLD | NEW |