OLD | NEW |
---|---|
(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 CC_IPC_GPU_STRUCT_TRAITS_H_ | |
6 #define CC_IPC_GPU_STRUCT_TRAITS_H_ | |
7 | |
8 #include "gpu/config/gpu_info.h" | |
9 #include "gpu/ipc/common/gpu_info.mojom.h" | |
10 | |
11 namespace mojo { | |
12 | |
13 template <> | |
14 struct StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice> { | |
15 static bool Read(gpu::mojom::GpuDeviceDataView data, | |
16 gpu::GPUInfo::GPUDevice* out); | |
17 | |
18 static uint32_t vendor_id(const gpu::GPUInfo::GPUDevice& input) { | |
19 return input.vendor_id; | |
20 } | |
21 | |
22 static uint32_t device_id(const gpu::GPUInfo::GPUDevice& input) { | |
23 return input.device_id; | |
24 } | |
25 | |
26 static bool active(const gpu::GPUInfo::GPUDevice& input) { | |
27 return input.active; | |
28 } | |
29 | |
30 static std::string vendor_string(const gpu::GPUInfo::GPUDevice& input) { | |
dcheng
2016/07/13 14:36:26
const std::string& to avoid the copy, here and bel
| |
31 return input.vendor_string; | |
32 } | |
33 | |
34 static std::string device_string(const gpu::GPUInfo::GPUDevice& input) { | |
35 return input.device_string; | |
36 } | |
37 }; | |
38 | |
39 template <> | |
40 struct EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult> { | |
41 static gpu::mojom::CollectInfoResult ToMojom( | |
42 gpu::CollectInfoResult collect_info_result); | |
43 | |
44 static bool FromMojom(gpu::mojom::CollectInfoResult input, | |
45 gpu::CollectInfoResult* out); | |
46 }; | |
47 | |
48 } // namespace mojo | |
49 #endif // CC_IPC_GPU_STRUCT_TRAITS_H_ | |
OLD | NEW |