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

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

Issue 2676373004: Implement service-side surface synchronization (Closed)
Patch Set: Better unit test name Created 3 years, 10 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_LOCAL_SURFACE_ID_H_ 5 #ifndef CC_SURFACES_LOCAL_SURFACE_ID_H_
6 #define CC_SURFACES_LOCAL_SURFACE_ID_H_ 6 #define CC_SURFACES_LOCAL_SURFACE_ID_H_
7 7
8 #include <inttypes.h> 8 #include <inttypes.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 bool operator!=(const LocalSurfaceId& other) const { 46 bool operator!=(const LocalSurfaceId& other) const {
47 return !(*this == other); 47 return !(*this == other);
48 } 48 }
49 49
50 bool operator<(const LocalSurfaceId& other) const { 50 bool operator<(const LocalSurfaceId& other) const {
51 return std::tie(local_id_, nonce_) < 51 return std::tie(local_id_, nonce_) <
52 std::tie(other.local_id_, other.nonce_); 52 std::tie(other.local_id_, other.nonce_);
53 } 53 }
54 54
55 size_t hash() const { 55 size_t hash() const {
56 DCHECK(is_valid()) << ToString();
56 return base::HashInts( 57 return base::HashInts(
57 local_id_, static_cast<uint64_t>(base::UnguessableTokenHash()(nonce_))); 58 local_id_, static_cast<uint64_t>(base::UnguessableTokenHash()(nonce_)));
58 } 59 }
59 60
60 std::string ToString() const; 61 std::string ToString() const;
61 62
62 private: 63 private:
63 friend struct mojo::StructTraits<mojom::LocalSurfaceIdDataView, 64 friend struct mojo::StructTraits<mojom::LocalSurfaceIdDataView,
64 LocalSurfaceId>; 65 LocalSurfaceId>;
65 66
66 uint32_t local_id_; 67 uint32_t local_id_;
67 base::UnguessableToken nonce_; 68 base::UnguessableToken nonce_;
68 }; 69 };
69 70
70 std::ostream& operator<<(std::ostream& out, 71 std::ostream& operator<<(std::ostream& out,
71 const LocalSurfaceId& local_surface_id); 72 const LocalSurfaceId& local_surface_id);
72 73
73 struct LocalSurfaceIdHash { 74 struct LocalSurfaceIdHash {
74 size_t operator()(const LocalSurfaceId& key) const { return key.hash(); } 75 size_t operator()(const LocalSurfaceId& key) const { return key.hash(); }
75 }; 76 };
76 77
77 } // namespace cc 78 } // namespace cc
78 79
79 #endif // CC_SURFACES_LOCAL_SURFACE_ID_H_ 80 #endif // CC_SURFACES_LOCAL_SURFACE_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698