1 // Copyright 2019 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 "ui/gfx/mojom/gpu_extra_info_mojom_traits.h"
6 
7 #include "build/build_config.h"
8 #include "ui/gfx/mojom/buffer_types_mojom_traits.h"
9 
10 namespace mojo {
11 
12 // static
Read(gfx::mojom::ANGLEFeatureDataView data,gfx::ANGLEFeature * out)13 bool StructTraits<gfx::mojom::ANGLEFeatureDataView, gfx::ANGLEFeature>::Read(
14     gfx::mojom::ANGLEFeatureDataView data,
15     gfx::ANGLEFeature* out) {
16   return data.ReadName(&out->name) && data.ReadCategory(&out->category) &&
17          data.ReadDescription(&out->description) && data.ReadBug(&out->bug) &&
18          data.ReadStatus(&out->status) && data.ReadCondition(&out->condition);
19 }
20 
21 // static
Read(gfx::mojom::GpuExtraInfoDataView data,gfx::GpuExtraInfo * out)22 bool StructTraits<gfx::mojom::GpuExtraInfoDataView, gfx::GpuExtraInfo>::Read(
23     gfx::mojom::GpuExtraInfoDataView data,
24     gfx::GpuExtraInfo* out) {
25   if (!data.ReadAngleFeatures(&out->angle_features))
26     return false;
27 #if defined(USE_OZONE) || defined(USE_X11)
28   out->system_visual = data.system_visual();
29   out->rgba_visual = data.rgba_visual();
30   if (!data.ReadGpuMemoryBufferSupportX11(&out->gpu_memory_buffer_support_x11))
31     return false;
32 #endif
33   return true;
34 }
35 
36 }  // namespace mojo
37