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

Side by Side Diff: components/arc/video_accelerator/video_accelerator_struct_traits.h

Issue 2513973002: Use mojo typemap to simplify the code using DmabufPlane (Closed)
Patch Set: Addressed comments 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENT_ARC_COMMON_VIDEO_ACCELERATOR_STRUCT_TRAITS_H_
6 #define COMPONENT_ARC_COMMON_VIDEO_ACCELERATOR_STRUCT_TRAITS_H_
7
8 #include "components/arc/common/video_accelerator.mojom.h"
9 #include "components/arc/video_accelerator/video_accelerator.h"
10
11 namespace mojo {
12
13 template <>
14 struct StructTraits<arc::mojom::ArcVideoAcceleratorDmabufPlaneDataView,
15 arc::ArcVideoAcceleratorDmabufPlane> {
16 static uint32_t offset(const arc::ArcVideoAcceleratorDmabufPlane& r) {
17 return r.offset;
dcheng 2016/12/01 01:30:50 Perhaps DCHECK(r.offset > 0)
yoshiki 2016/12/06 16:48:34 I believe this can be 0. Added DCHECK(r.offset >=
18 }
19 static uint32_t stride(const arc::ArcVideoAcceleratorDmabufPlane& r) {
Luis Héctor Chávez 2016/11/30 17:57:01 nit: blank line before, for consistency.
yoshiki 2016/12/06 16:48:34 Done.
20 return r.stride;
dcheng 2016/12/01 01:30:50 Ditto
yoshiki 2016/12/06 16:48:34 Done.
21 }
22
23 static bool Read(arc::mojom::ArcVideoAcceleratorDmabufPlaneDataView data,
24 arc::ArcVideoAcceleratorDmabufPlane* out) {
25 if (data.offset() < 0 || data.stride() < 0) {
dcheng 2016/12/01 01:30:50 Nit: please out-of-line this to a .cc file
yoshiki 2016/12/06 16:48:33 Done.
26 // Invalid offset/stride.
27 return false;
Yusuke Sato 2016/11/30 18:08:34 qq: How is the false return handled? The original
dcheng 2016/12/01 01:30:50 When StructTraits::Read() returns false, the messa
Yusuke Sato 2016/12/01 02:23:08 Got it, thanks!
28 }
29
30 out->offset = data.offset();
31 out->stride = data.stride();
32 return true;
33 }
34 };
35
36 } // namespace arc
Luis Héctor Chávez 2016/11/30 17:57:01 nit: namespace mojo
yoshiki 2016/12/06 16:48:34 Done.
37
38 #endif // COMPONENT_ARC_COMMON_VIDEO_ACCELERATOR_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698