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

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

Issue 2379653006: Replaced cc::SurfaceId::nonce_ with base::UnguessableToken (Closed)
Patch Set: Changed comments in surface_id.h to reflect the change Created 4 years, 2 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 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
11 #include <functional> 11 #include <functional>
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 "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "cc/surfaces/frame_sink_id.h" 16 #include "cc/surfaces/frame_sink_id.h"
17 #include "cc/surfaces/local_frame_id.h" 17 #include "cc/surfaces/local_frame_id.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 class SurfaceId { 21 class SurfaceId {
22 public: 22 public:
23 SurfaceId() = default; 23 SurfaceId() = default;
24 24
25 SurfaceId(const SurfaceId& other) 25 SurfaceId(const SurfaceId& other)
26 : frame_sink_id_(other.frame_sink_id_), 26 : frame_sink_id_(other.frame_sink_id_),
27 local_frame_id_(other.local_frame_id_) {} 27 local_frame_id_(other.local_frame_id_) {}
28 28
29 // A SurfaceId consists of three components: FrameSinkId, local Id, and nonce. 29 // A SurfaceId consists of two components: FrameSinkId and local_frame_id.
30 // A |frame_sink_id| consists of two components; one is allocated by the 30 // A |frame_sink_id| consists of two components; one is allocated by the
31 // display compositor service and one is allocated by the client. The 31 // display compositor service and one is allocated by the client. The
32 // |frame_sink_id| uniquely identifies a FrameSink (and frame source). 32 // |frame_sink_id| uniquely identifies a FrameSink (and frame source).
33 // A |local_id| is a sequentially allocated ID generated by the frame source 33 // A |local_frame_id| is a sequentially allocated ID generated by the frame
34 // source
34 // that uniquely identifies a sequential set of frames of the same size and 35 // that uniquely identifies a sequential set of frames of the same size and
35 // device scale factor. 36 // device scale factor.
36 // A |nonce| is a cryptographically secure unguessable token that makes it
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
39 // privileged process.
40 SurfaceId(const FrameSinkId& frame_sink_id, 37 SurfaceId(const FrameSinkId& frame_sink_id,
41 const LocalFrameId& local_frame_id) 38 const LocalFrameId& local_frame_id)
42 : frame_sink_id_(frame_sink_id), local_frame_id_(local_frame_id) {} 39 : frame_sink_id_(frame_sink_id), local_frame_id_(local_frame_id) {}
43 40
44 bool is_null() const { 41 bool is_null() const {
45 return frame_sink_id_.is_null() && local_frame_id_.is_null(); 42 return frame_sink_id_.is_null() && local_frame_id_.is_null();
46 } 43 }
47 44
48 size_t hash() const { 45 size_t hash() const {
49 return base::HashInts(static_cast<uint64_t>(frame_sink_id_.hash()), 46 return base::HashInts(static_cast<uint64_t>(frame_sink_id_.hash()),
(...skipping 28 matching lines...) Expand all
78 LocalFrameId local_frame_id_; 75 LocalFrameId local_frame_id_;
79 }; 76 };
80 77
81 struct SurfaceIdHash { 78 struct SurfaceIdHash {
82 size_t operator()(const SurfaceId& key) const { return key.hash(); } 79 size_t operator()(const SurfaceId& key) const { return key.hash(); }
83 }; 80 };
84 81
85 } // namespace cc 82 } // namespace cc
86 83
87 #endif // CC_SURFACES_SURFACE_ID_H_ 84 #endif // CC_SURFACES_SURFACE_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698