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

Side by Side Diff: cc/surfaces/surface_sequence.h

Issue 2136413002: Update Surface ID Terminology (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix webkit_unit_tests Created 4 years, 5 months 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
OLDNEW
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/hash.h" 13 #include "base/hash.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 // A per-surface-namespace sequence number that's used to coordinate 17 // A per-surface-namespace sequence number that's used to coordinate
18 // dependencies between frames. A sequence number may be satisfied once, and 18 // dependencies between frames. A sequence number may be satisfied once, and
19 // may be depended on once. 19 // may be depended on once.
20 struct SurfaceSequence { 20 struct SurfaceSequence {
21 SurfaceSequence() : id_namespace(0u), sequence(0u) {} 21 SurfaceSequence() : client_id(0u), sequence(0u) {}
piman 2016/07/12 20:57:19 Do we need the gpu_id here too? Or is the assumpti
Fady Samuel 2016/07/12 22:45:34 gpu_id is now gone.
22 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) 22 SurfaceSequence(uint32_t client_id, uint32_t sequence)
23 : id_namespace(id_namespace), sequence(sequence) {} 23 : client_id(client_id), sequence(sequence) {}
24 bool is_null() const { return id_namespace == 0u && sequence == 0u; } 24 bool is_null() const { return client_id == 0u && sequence == 0u; }
25 25
26 uint32_t id_namespace; 26 uint32_t client_id;
27 uint32_t sequence; 27 uint32_t sequence;
28 }; 28 };
29 29
30 inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) { 30 inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) {
31 return a.id_namespace == b.id_namespace && a.sequence == b.sequence; 31 return a.client_id == b.client_id && a.sequence == b.sequence;
32 } 32 }
33 33
34 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { 34 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) {
35 return !(a == b); 35 return !(a == b);
36 } 36 }
37 37
38 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { 38 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) {
39 return std::tie(a.id_namespace, a.sequence) < 39 return std::tie(a.client_id, a.sequence) < std::tie(b.client_id, b.sequence);
40 std::tie(b.id_namespace, b.sequence);
41 } 40 }
42 41
43 struct SurfaceSequenceHash { 42 struct SurfaceSequenceHash {
44 size_t operator()(SurfaceSequence key) const { 43 size_t operator()(SurfaceSequence key) const {
45 return base::HashInts(key.id_namespace, key.sequence); 44 return base::HashInts(key.client_id, key.sequence);
46 } 45 }
47 }; 46 };
48 47
49 } // namespace cc 48 } // namespace cc
50 49
51 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ 50 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698