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

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

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Rebase Created 4 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_factory_unittest.cc ('k') | cc/surfaces/surface_sequence.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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 22 matching lines...) Expand all
33 // that uniquely identifies a sequential set of frames of the same size and 33 // that uniquely identifies a sequential set of frames of the same size and
34 // device scale factor. 34 // device scale factor.
35 // A |nonce| is a cryptographically secure unguessable token that makes it 35 // A |nonce| is a cryptographically secure unguessable token that makes it
36 // impossible for an unprivileged frame source to embed another frame source 36 // impossible for an unprivileged frame source to embed another frame source
37 // without being explicitly given the surface ID of that frame source from a 37 // without being explicitly given the surface ID of that frame source from a
38 // privileged process. 38 // privileged process.
39 constexpr SurfaceId(const FrameSinkId& frame_sink_id, 39 constexpr SurfaceId(const FrameSinkId& frame_sink_id,
40 const LocalFrameId& local_frame_id) 40 const LocalFrameId& local_frame_id)
41 : frame_sink_id_(frame_sink_id), local_frame_id_(local_frame_id) {} 41 : frame_sink_id_(frame_sink_id), local_frame_id_(local_frame_id) {}
42 42
43 bool is_null() const { 43 bool is_valid() const {
44 return frame_sink_id_.is_null() && local_frame_id_.is_null(); 44 return frame_sink_id_.is_valid() && local_frame_id_.is_valid();
45 } 45 }
46 46
47 size_t hash() const { 47 size_t hash() const {
48 return base::HashInts(static_cast<uint64_t>(frame_sink_id_.hash()), 48 return base::HashInts(static_cast<uint64_t>(frame_sink_id_.hash()),
49 static_cast<uint64_t>(local_frame_id_.hash())); 49 static_cast<uint64_t>(local_frame_id_.hash()));
50 } 50 }
51 51
52 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } 52 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
53 53
54 const LocalFrameId& local_frame_id() const { return local_frame_id_; } 54 const LocalFrameId& local_frame_id() const { return local_frame_id_; }
(...skipping 22 matching lines...) Expand all
77 LocalFrameId local_frame_id_; 77 LocalFrameId local_frame_id_;
78 }; 78 };
79 79
80 struct SurfaceIdHash { 80 struct SurfaceIdHash {
81 size_t operator()(const SurfaceId& key) const { return key.hash(); } 81 size_t operator()(const SurfaceId& key) const { return key.hash(); }
82 }; 82 };
83 83
84 } // namespace cc 84 } // namespace cc
85 85
86 #endif // CC_SURFACES_SURFACE_ID_H_ 86 #endif // CC_SURFACES_SURFACE_ID_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_factory_unittest.cc ('k') | cc/surfaces/surface_sequence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698