| 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 namespace cc { | 8 namespace cc { |
| 9 | 9 |
| 10 // A per-surface-namespace sequence number that's used to coordinate | 10 // A per-surface-namespace sequence number that's used to coordinate |
| 11 // dependencies between frames. A sequence number may be satisfied once, and | 11 // dependencies between frames. A sequence number may be satisfied once, and |
| 12 // may be depended on once. | 12 // may be depended on once. |
| 13 struct SurfaceSequence { | 13 struct SurfaceSequence { |
| 14 SurfaceSequence() : id_namespace(0u), sequence(0u) {} | 14 SurfaceSequence() : id_namespace(0u), sequence(0u) {} |
| 15 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) | 15 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) |
| 16 : id_namespace(id_namespace), sequence(sequence) {} | 16 : id_namespace(id_namespace), sequence(sequence) {} |
| 17 bool is_null() const { return id_namespace == 0u && sequence == 0u; } |
| 17 | 18 |
| 18 uint32_t id_namespace; | 19 uint32_t id_namespace; |
| 19 uint32_t sequence; | 20 uint32_t sequence; |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) { | 23 inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) { |
| 23 return a.id_namespace == b.id_namespace && a.sequence == b.sequence; | 24 return a.id_namespace == b.id_namespace && a.sequence == b.sequence; |
| 24 } | 25 } |
| 25 | 26 |
| 26 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { | 27 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { |
| 27 return !(a == b); | 28 return !(a == b); |
| 28 } | 29 } |
| 29 | 30 |
| 30 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { | 31 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { |
| 31 if (a.id_namespace != b.id_namespace) | 32 if (a.id_namespace != b.id_namespace) |
| 32 return a.id_namespace < b.id_namespace; | 33 return a.id_namespace < b.id_namespace; |
| 33 return a.sequence < b.sequence; | 34 return a.sequence < b.sequence; |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace cc | 37 } // namespace cc |
| 37 | 38 |
| 38 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ | 39 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ |
| OLD | NEW |