| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // that uniquely identifies a sequential set of frames of the same size and | 34 // that uniquely identifies a sequential set of frames of the same size and |
| 35 // device scale factor. | 35 // device scale factor. |
| 36 // A |nonce| is a cryptographically secure unguessable token that makes it | 36 // A |nonce| is a cryptographically secure unguessable token that makes it |
| 37 // impossible for an unprivileged frame source to embed another frame source | 37 // impossible for an unprivileged frame source to embed another frame source |
| 38 // without being explicitly given the surface ID of that frame source from a | 38 // without being explicitly given the surface ID of that frame source from a |
| 39 // privileged process. | 39 // privileged process. |
| 40 SurfaceId(const FrameSinkId& frame_sink_id, | 40 SurfaceId(const FrameSinkId& frame_sink_id, |
| 41 const LocalFrameId& local_frame_id) | 41 const LocalFrameId& local_frame_id) |
| 42 : frame_sink_id_(frame_sink_id), local_frame_id_(local_frame_id) {} | 42 : frame_sink_id_(frame_sink_id), local_frame_id_(local_frame_id) {} |
| 43 | 43 |
| 44 bool is_valid() const { |
| 45 return frame_sink_id_.is_valid() && local_frame_id_.is_valid(); |
| 46 } |
| 47 |
| 44 bool is_null() const { | 48 bool is_null() const { |
| 45 return frame_sink_id_.is_null() && local_frame_id_.is_null(); | 49 return frame_sink_id_.is_null() && local_frame_id_.is_null(); |
| 46 } | 50 } |
| 47 | 51 |
| 48 size_t hash() const { | 52 size_t hash() const { |
| 49 return base::HashInts(static_cast<uint64_t>(frame_sink_id_.hash()), | 53 return base::HashInts(static_cast<uint64_t>(frame_sink_id_.hash()), |
| 50 static_cast<uint64_t>(local_frame_id_.hash())); | 54 static_cast<uint64_t>(local_frame_id_.hash())); |
| 51 } | 55 } |
| 52 | 56 |
| 53 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 57 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 78 LocalFrameId local_frame_id_; | 82 LocalFrameId local_frame_id_; |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 struct SurfaceIdHash { | 85 struct SurfaceIdHash { |
| 82 size_t operator()(const SurfaceId& key) const { return key.hash(); } | 86 size_t operator()(const SurfaceId& key) const { return key.hash(); } |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 } // namespace cc | 89 } // namespace cc |
| 86 | 90 |
| 87 #endif // CC_SURFACES_SURFACE_ID_H_ | 91 #endif // CC_SURFACES_SURFACE_ID_H_ |
| OLD | NEW |