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

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: Changed 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
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 return gpu::mojom::CollectInfoResult::kCollectInfoNone;
35 }
36
37 // static
38 bool EnumTraits<gpu::mojom::CollectInfoResult, gpu::CollectInfoResult>::
39 FromMojom(gpu::mojom::CollectInfoResult input,
40 gpu::CollectInfoResult* out) {
41 switch (input) {
42 case gpu::mojom::CollectInfoResult::kCollectInfoNone:
43 *out = gpu::CollectInfoResult::kCollectInfoNone;
44 return true;
45 case gpu::mojom::CollectInfoResult::kCollectInfoSuccess:
46 *out = gpu::CollectInfoResult::kCollectInfoSuccess;
47 return true;
48 case gpu::mojom::CollectInfoResult::kCollectInfoNonFatalFailure:
49 *out = gpu::CollectInfoResult::kCollectInfoNonFatalFailure;
50 return true;
51 case gpu::mojom::CollectInfoResult::kCollectInfoFatalFailure:
52 *out = gpu::CollectInfoResult::kCollectInfoFatalFailure;
53 return true;
54 }
55 return false;
dcheng 2016/07/13 14:36:26 Nit: NOREACHED() this (as well as line 34)
56 }
57
58 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698