OLD | NEW |
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 Loading... |
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 gpu::VideoCodecProfile profile( |
| 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 gpu::VideoCodecProfile profile( |
| 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_ |
OLD | NEW |