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

Side by Side Diff: gpu/ipc/common/gpu_info_struct_traits.h

Issue 2147693002: Struct traits used by GpuInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VideoEncodeAcceleratorSupportedProfile Created 4 years, 5 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 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_GPU_STRUCT_TRAITS_H_ 5 #ifndef CC_IPC_GPU_STRUCT_TRAITS_H_
6 #define CC_IPC_GPU_STRUCT_TRAITS_H_ 6 #define CC_IPC_GPU_STRUCT_TRAITS_H_
7 7
8 #include "gpu/config/gpu_info.h" 8 #include "gpu/config/gpu_info.h"
9 #include "gpu/ipc/common/gpu_info.mojom.h" 9 #include "gpu/ipc/common/gpu_info.mojom.h"
10 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 13
13 template <> 14 template <>
14 struct StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice> { 15 struct StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice> {
15 static bool Read(gpu::mojom::GpuDeviceDataView data, 16 static bool Read(gpu::mojom::GpuDeviceDataView data,
16 gpu::GPUInfo::GPUDevice* out); 17 gpu::GPUInfo::GPUDevice* out);
17 18
18 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) { 19 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) {
19 return input.vendor_id; 20 return input.vendor_id;
(...skipping 20 matching lines...) Expand all
40 41
41 template <> 42 template <>
42 struct EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult> { 43 struct EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult> {
43 static gpu::mojom::CollectInfoResult ToMojom( 44 static gpu::mojom::CollectInfoResult ToMojom(
44 gpu::CollectInfoResult collect_info_result); 45 gpu::CollectInfoResult collect_info_result);
45 46
46 static bool FromMojom(gpu::mojom::CollectInfoResult input, 47 static bool FromMojom(gpu::mojom::CollectInfoResult input,
47 gpu::CollectInfoResult* out); 48 gpu::CollectInfoResult* out);
48 }; 49 };
49 50
51 template <>
52 struct EnumTraits<gpu::mojom::VideoCodecProfile, gpu::VideoCodecProfile> {
53 static gpu::mojom::VideoCodecProfile ToMojom(
54 gpu::VideoCodecProfile video_codec_profile);
55 static bool FromMojom(gpu::mojom::VideoCodecProfile input,
56 gpu::VideoCodecProfile* out);
57 };
58
59 template <>
60 struct StructTraits<gpu::mojom::VideoDecodeAcceleratorSupportedProfile,
61 gpu::VideoDecodeAcceleratorSupportedProfile> {
62 static bool Read(
63 gpu::mojom::VideoDecodeAcceleratorSupportedProfileDataView data,
64 gpu::VideoDecodeAcceleratorSupportedProfile* out);
65
66 static const gpu::VideoCodecProfile& profile(
Fady Samuel 2016/07/15 18:08:38 Just return by value. This is a small type.
Alex Z. 2016/07/18 12:50:05 Done.
67 const gpu::VideoDecodeAcceleratorSupportedProfile& input) {
68 return input.profile;
69 }
70
71 static const gfx::Size& max_resolution(
72 const gpu::VideoDecodeAcceleratorSupportedProfile& input) {
73 return input.max_resolution;
74 }
75
76 static const gfx::Size& min_resolution(
77 const gpu::VideoDecodeAcceleratorSupportedProfile& input) {
78 return input.min_resolution;
79 }
80
81 static bool encrypted_only(
82 const gpu::VideoDecodeAcceleratorSupportedProfile& input) {
83 return input.encrypted_only;
84 }
85 };
86
87 template <>
88 struct StructTraits<gpu::mojom::VideoDecodeAcceleratorCapabilities,
89 gpu::VideoDecodeAcceleratorCapabilities> {
90 static bool Read(gpu::mojom::VideoDecodeAcceleratorCapabilitiesDataView data,
91 gpu::VideoDecodeAcceleratorCapabilities* out) {
92 out->flags = data.flags();
93 return true;
94 }
95
96 static uint32_t flags(const gpu::VideoDecodeAcceleratorCapabilities& input) {
97 return input.flags;
98 }
99 };
100
101 template <>
102 struct StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile,
103 gpu::VideoEncodeAcceleratorSupportedProfile> {
104 static bool Read(
105 gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data,
106 gpu::VideoEncodeAcceleratorSupportedProfile* out);
107
108 static const gpu::VideoCodecProfile& profile(
Fady Samuel 2016/07/15 18:08:38 pass by value.
Alex Z. 2016/07/18 12:50:05 Done.
109 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
110 return input.profile;
111 }
112
113 static const gfx::Size& max_resolution(
114 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
115 return input.max_resolution;
116 }
117
118 static uint32_t max_framerate_numerator(
119 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
120 return input.max_framerate_numerator;
121 }
122
123 static uint32_t max_framerate_denominator(
124 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
125 return input.max_framerate_denominator;
126 }
127 };
128
50 } // namespace mojo 129 } // namespace mojo
51 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ 130 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698