blob: b5792962afb3dea8644404ad45764c50d05fa46d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_SURFACES_SURFACE_SEQUENCE_H_
#define CC_SURFACES_SURFACE_SEQUENCE_H_
#include <tuple>
#include "base/containers/hash_tables.h"
namespace cc {
// A per-surface-namespace sequence number that's used to coordinate
// dependencies between frames. A sequence number may be satisfied once, and
// may be depended on once.
struct SurfaceSequence {
SurfaceSequence() : id_namespace(0u), sequence(0u) {}
SurfaceSequence(uint32_t id_namespace, uint32_t sequence)
: id_namespace(id_namespace), sequence(sequence) {}
bool is_null() const { return id_namespace == 0u && sequence == 0u; }
uint32_t id_namespace;
uint32_t sequence;
};
inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) {
return a.id_namespace == b.id_namespace && a.sequence == b.sequence;
}
inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) {
return !(a == b);
}
inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) {
return std::tie(a.id_namespace, a.sequence) <
std::tie(b.id_namespace, b.sequence);
}
} // namespace cc
namespace BASE_HASH_NAMESPACE {
template <>
struct hash<cc::SurfaceSequence> {
size_t operator()(cc::SurfaceSequence key) const {
return base::HashPair(key.id_namespace, key.sequence);
}
};
} // namespace BASE_HASH_NAMESPACE
#endif // CC_SURFACES_SURFACE_SEQUENCE_H_
|