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

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

Issue 2537343004: Add SurfaceReference class. (Closed)
Patch Set: Fixes. Created 4 years 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/local_frame_id.h ('k') | cc/surfaces/surface_reference.h » ('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_ID_H_ 5 #ifndef CC_SURFACES_SURFACE_ID_H_
6 #define CC_SURFACES_SURFACE_ID_H_ 6 #define CC_SURFACES_SURFACE_ID_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
11 #include <string> 11 #include <string>
12 12
13 #include "base/format_macros.h" 13 #include "base/format_macros.h"
14 #include "base/hash.h" 14 #include "base/hash.h"
15 #include "cc/surfaces/frame_sink_id.h" 15 #include "cc/surfaces/frame_sink_id.h"
16 #include "cc/surfaces/local_frame_id.h" 16 #include "cc/surfaces/local_frame_id.h"
17 #include "mojo/public/cpp/bindings/struct_traits.h"
17 18
18 namespace cc { 19 namespace cc {
20 namespace mojom {
21 class SurfaceIdDataView;
22 }
19 23
20 class SurfaceId { 24 class SurfaceId {
21 public: 25 public:
22 constexpr SurfaceId() = default; 26 constexpr SurfaceId() = default;
23 27
24 constexpr SurfaceId(const SurfaceId& other) = default; 28 constexpr SurfaceId(const SurfaceId& other) = default;
25 29
26 // A SurfaceId consists of two components: FrameSinkId and LocalFrameId. 30 // A SurfaceId consists of two components: FrameSinkId and LocalFrameId.
27 // A |frame_sink_id| consists of two components; one is allocated by the 31 // A |frame_sink_id| consists of two components; one is allocated by the
28 // display compositor service and one is allocated by the client. The 32 // display compositor service and one is allocated by the client. The
(...skipping 26 matching lines...) Expand all
55 } 59 }
56 60
57 bool operator!=(const SurfaceId& other) const { return !(*this == other); } 61 bool operator!=(const SurfaceId& other) const { return !(*this == other); }
58 62
59 bool operator<(const SurfaceId& other) const { 63 bool operator<(const SurfaceId& other) const {
60 return std::tie(frame_sink_id_, local_frame_id_) < 64 return std::tie(frame_sink_id_, local_frame_id_) <
61 std::tie(other.frame_sink_id_, other.local_frame_id_); 65 std::tie(other.frame_sink_id_, other.local_frame_id_);
62 } 66 }
63 67
64 private: 68 private:
69 friend struct mojo::StructTraits<mojom::SurfaceIdDataView, SurfaceId>;
70
65 // See SurfaceIdAllocator::GenerateId. 71 // See SurfaceIdAllocator::GenerateId.
66 FrameSinkId frame_sink_id_; 72 FrameSinkId frame_sink_id_;
67 LocalFrameId local_frame_id_; 73 LocalFrameId local_frame_id_;
68 }; 74 };
69 75
70 std::ostream& operator<<(std::ostream& out, const SurfaceId& surface_id); 76 std::ostream& operator<<(std::ostream& out, const SurfaceId& surface_id);
71 77
72 struct SurfaceIdHash { 78 struct SurfaceIdHash {
73 size_t operator()(const SurfaceId& key) const { return key.hash(); } 79 size_t operator()(const SurfaceId& key) const { return key.hash(); }
74 }; 80 };
75 81
76 } // namespace cc 82 } // namespace cc
77 83
78 #endif // CC_SURFACES_SURFACE_ID_H_ 84 #endif // CC_SURFACES_SURFACE_ID_H_
OLDNEW
« no previous file with comments | « cc/surfaces/local_frame_id.h ('k') | cc/surfaces/surface_reference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698