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

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: Moved Read() to .cc file Created 4 years, 4 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 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
93 static uint32_t flags(const gpu::VideoDecodeAcceleratorCapabilities& input) {
94 return input.flags;
95 }
96 };
97
98 template <>
99 struct StructTraits<gpu::mojom::VideoEncodeAcceleratorSupportedProfile,
100 gpu::VideoEncodeAcceleratorSupportedProfile> {
101 static bool Read(
102 gpu::mojom::VideoEncodeAcceleratorSupportedProfileDataView data,
103 gpu::VideoEncodeAcceleratorSupportedProfile* out);
104
105 static gpu::VideoCodecProfile profile(
106 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
107 return input.profile;
108 }
109
110 static const gfx::Size& max_resolution(
111 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
112 return input.max_resolution;
113 }
114
115 static uint32_t max_framerate_numerator(
116 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
117 return input.max_framerate_numerator;
118 }
119
120 static uint32_t max_framerate_denominator(
121 const gpu::VideoEncodeAcceleratorSupportedProfile& input) {
122 return input.max_framerate_denominator;
123 }
124 };
125
50 } // namespace mojo 126 } // namespace mojo
51 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ 127 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698