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

Side by Side Diff: mojo/converters/surfaces/surfaces_type_converters.cc

Issue 1996783002: Make cc::SurfaceId unguessable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 #include "mojo/converters/surfaces/surfaces_type_converters.h" 5 #include "mojo/converters/surfaces/surfaces_type_converters.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 const cc::SurfaceId& input) { 257 const cc::SurfaceId& input) {
258 SurfaceIdPtr id(SurfaceId::New()); 258 SurfaceIdPtr id(SurfaceId::New());
259 id->local = static_cast<uint32_t>(input.id); 259 id->local = static_cast<uint32_t>(input.id);
260 id->id_namespace = cc::SurfaceIdAllocator::NamespaceForId(input); 260 id->id_namespace = cc::SurfaceIdAllocator::NamespaceForId(input);
261 return id; 261 return id;
262 } 262 }
263 263
264 // static 264 // static
265 cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( 265 cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert(
266 const SurfaceIdPtr& input) { 266 const SurfaceIdPtr& input) {
267 uint64_t packed_id = input->id_namespace; 267 return cc::SurfaceId(input->id_namespace, input->local);
268 packed_id <<= 32ull;
269 packed_id |= input->local;
270 return cc::SurfaceId(packed_id);
271 } 268 }
272 269
273 // static 270 // static
274 ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { 271 ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) {
275 ColorPtr color(Color::New()); 272 ColorPtr color(Color::New());
276 color->rgba = input; 273 color->rgba = input;
277 return color; 274 return color;
278 } 275 }
279 276
280 // static 277 // static
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 625 }
629 626
630 // static 627 // static
631 std::unique_ptr<cc::CompositorFrame> 628 std::unique_ptr<cc::CompositorFrame>
632 TypeConverter<std::unique_ptr<cc::CompositorFrame>, 629 TypeConverter<std::unique_ptr<cc::CompositorFrame>,
633 CompositorFramePtr>::Convert(const CompositorFramePtr& input) { 630 CompositorFramePtr>::Convert(const CompositorFramePtr& input) {
634 return ConvertToCompositorFrame(input, nullptr); 631 return ConvertToCompositorFrame(input, nullptr);
635 } 632 }
636 633
637 } // namespace mojo 634 } // namespace mojo
OLDNEW
« cc/surfaces/surface_id.h ('K') | « cc/surfaces/surface_id_allocator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698