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

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

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « cc/surfaces/surface_manager.cc ('k') | cc/test/fake_content_layer_client.cc » ('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 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 "base/containers/hash_tables.h"
9
8 namespace cc { 10 namespace cc {
9 11
10 // A per-surface-namespace sequence number that's used to coordinate 12 // A per-surface-namespace sequence number that's used to coordinate
11 // dependencies between frames. A sequence number may be satisfied once, and 13 // dependencies between frames. A sequence number may be satisfied once, and
12 // may be depended on once. 14 // may be depended on once.
13 struct SurfaceSequence { 15 struct SurfaceSequence {
14 SurfaceSequence() : id_namespace(0u), sequence(0u) {} 16 SurfaceSequence() : id_namespace(0u), sequence(0u) {}
15 SurfaceSequence(uint32_t id_namespace, uint32_t sequence) 17 SurfaceSequence(uint32_t id_namespace, uint32_t sequence)
16 : id_namespace(id_namespace), sequence(sequence) {} 18 : id_namespace(id_namespace), sequence(sequence) {}
19 bool is_null() const { return id_namespace == 0u && sequence == 0u; }
17 20
18 uint32_t id_namespace; 21 uint32_t id_namespace;
19 uint32_t sequence; 22 uint32_t sequence;
20 }; 23 };
21 24
22 inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) { 25 inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) {
23 return a.id_namespace == b.id_namespace && a.sequence == b.sequence; 26 return a.id_namespace == b.id_namespace && a.sequence == b.sequence;
24 } 27 }
25 28
26 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { 29 inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) {
27 return !(a == b); 30 return !(a == b);
28 } 31 }
29 32
30 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { 33 inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) {
31 if (a.id_namespace != b.id_namespace) 34 if (a.id_namespace != b.id_namespace)
32 return a.id_namespace < b.id_namespace; 35 return a.id_namespace < b.id_namespace;
33 return a.sequence < b.sequence; 36 return a.sequence < b.sequence;
34 } 37 }
35 38
36 } // namespace cc 39 } // namespace cc
37 40
41 namespace BASE_HASH_NAMESPACE {
42 template <>
43 struct hash<cc::SurfaceSequence> {
44 size_t operator()(cc::SurfaceSequence key) const {
45 return base::HashPair(key.id_namespace, key.sequence);
46 }
47 };
48 } // namespace BASE_HASH_NAMESPACE
49
38 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_ 50 #endif // CC_SURFACES_SURFACE_SEQUENCE_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_manager.cc ('k') | cc/test/fake_content_layer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698