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

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

Issue 2133833002: gpu::GPUInfo::GPUDevice struct traits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change according to comments 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
« no previous file with comments | « gpu/ipc/common/gpu_info_struct_traits.h ('k') | gpu/ipc/common/mailbox.typemap » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gpu/ipc/common/gpu_info_struct_traits.h"
6
7 namespace mojo {
8
9 // static
10 bool StructTraits<gpu::mojom::GpuDevice, gpu::GPUInfo::GPUDevice>::Read(
11 gpu::mojom::GpuDeviceDataView data,
12 gpu::GPUInfo::GPUDevice* out) {
13 out->vendor_id = data.vendor_id();
14 out->device_id = data.device_id();
15 out->active = data.active();
16 return data.ReadVendorString(&out->vendor_string) &&
17 data.ReadDeviceString(&out->device_string);
18 }
19
20 // static
21 gpu::mojom::CollectInfoResult
22 EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult>::ToMojom(
23 gpu::CollectInfoResult collect_info_result) {
24 switch (collect_info_result) {
25 case gpu::CollectInfoResult::kCollectInfoNone:
26 return gpu::mojom::CollectInfoResult::kCollectInfoNone;
27 case gpu::CollectInfoResult::kCollectInfoSuccess:
28 return gpu::mojom::CollectInfoResult::kCollectInfoSuccess;
29 case gpu::CollectInfoResult::kCollectInfoNonFatalFailure:
30 return gpu::mojom::CollectInfoResult::kCollectInfoNonFatalFailure;
31 case gpu::CollectInfoResult::kCollectInfoFatalFailure:
32 return gpu::mojom::CollectInfoResult::kCollectInfoFatalFailure;
33 }
34 NOTREACHED() << "Invalid CollectInfoResult value:" << collect_info_result;
35 return gpu::mojom::CollectInfoResult::kCollectInfoNone;
36 }
37
38 // static
39 bool EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult>::
40 FromMojom(gpu::mojom::CollectInfoResult input,
41 gpu::CollectInfoResult* out) {
42 switch (input) {
43 case gpu::mojom::CollectInfoResult::kCollectInfoNone:
44 *out = gpu::CollectInfoResult::kCollectInfoNone;
45 return true;
46 case gpu::mojom::CollectInfoResult::kCollectInfoSuccess:
47 *out = gpu::CollectInfoResult::kCollectInfoSuccess;
48 return true;
49 case gpu::mojom::CollectInfoResult::kCollectInfoNonFatalFailure:
50 *out = gpu::CollectInfoResult::kCollectInfoNonFatalFailure;
51 return true;
52 case gpu::mojom::CollectInfoResult::kCollectInfoFatalFailure:
53 *out = gpu::CollectInfoResult::kCollectInfoFatalFailure;
54 return true;
55 }
56 NOTREACHED() << "Invalid CollectInfoResult value:" << input;
57 return false;
58 }
59
60 } // namespace mojo
OLDNEW
« no previous file with comments | « gpu/ipc/common/gpu_info_struct_traits.h ('k') | gpu/ipc/common/mailbox.typemap » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698