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

Side by Side Diff: cc/ipc/surface_id_struct_traits.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/ipc/struct_traits_unittest.cc ('k') | cc/ipc/surface_reference.mojom » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_IPC_SURFACE_ID_STRUCT_TRAITS_H_ 5 #ifndef CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_
6 #define CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ 6 #define CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_
7 7
8 #include "cc/ipc/frame_sink_id_struct_traits.h" 8 #include "cc/ipc/frame_sink_id_struct_traits.h"
9 #include "cc/ipc/local_frame_id_struct_traits.h" 9 #include "cc/ipc/local_frame_id_struct_traits.h"
10 #include "cc/ipc/surface_id.mojom-shared.h" 10 #include "cc/ipc/surface_id.mojom-shared.h"
11 #include "cc/surfaces/frame_sink_id.h" 11 #include "cc/surfaces/frame_sink_id.h"
12 #include "cc/surfaces/local_frame_id.h"
12 #include "cc/surfaces/surface_id.h" 13 #include "cc/surfaces/surface_id.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 16
16 template <> 17 template <>
17 struct StructTraits<cc::mojom::SurfaceIdDataView, cc::SurfaceId> { 18 struct StructTraits<cc::mojom::SurfaceIdDataView, cc::SurfaceId> {
18 static const cc::FrameSinkId& frame_sink_id(const cc::SurfaceId& id) { 19 static const cc::FrameSinkId& frame_sink_id(const cc::SurfaceId& id) {
19 return id.frame_sink_id(); 20 return id.frame_sink_id();
20 } 21 }
21 22
22 static const cc::LocalFrameId& local_frame_id(const cc::SurfaceId& id) { 23 static const cc::LocalFrameId& local_frame_id(const cc::SurfaceId& id) {
23 return id.local_frame_id(); 24 return id.local_frame_id();
24 } 25 }
25 26
26 static bool Read(cc::mojom::SurfaceIdDataView data, cc::SurfaceId* out) { 27 static bool Read(cc::mojom::SurfaceIdDataView data, cc::SurfaceId* out) {
27 cc::FrameSinkId frame_sink_id; 28 return data.ReadFrameSinkId(&out->frame_sink_id_) &&
28 if (!data.ReadFrameSinkId(&frame_sink_id)) 29 data.ReadLocalFrameId(&out->local_frame_id_);
29 return false;
30
31 cc::LocalFrameId local_frame_id;
32 if (!data.ReadLocalFrameId(&local_frame_id))
33 return false;
34
35 *out = cc::SurfaceId(frame_sink_id, local_frame_id);
36 return true;
37 } 30 }
38 }; 31 };
39 32
40 } // namespace mojo 33 } // namespace mojo
41 34
42 #endif // CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_ 35 #endif // CC_IPC_SURFACE_ID_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « cc/ipc/struct_traits_unittest.cc ('k') | cc/ipc/surface_reference.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698