Chromium Code Reviews| 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 UI_GFX_MOJO_ACCELERATED_WIDGET_STRUCT_TRAITS_H_ | |
| 6 #define UI_GFX_MOJO_ACCELERATED_WIDGET_STRUCT_TRAITS_H_ | |
| 7 | |
| 8 #include "ui/gfx/mojo/accelerated_widget.mojom.h" | |
| 9 #include "ui/gfx/native_widget_types.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 | |
| 13 template <> | |
| 14 struct StructTraits<gfx::mojom::AcceleratedWidget, gfx::AcceleratedWidget> { | |
| 15 static uint64_t widget(const gfx::AcceleratedWidget& widget) { | |
| 16 #if defined(OS_WIN) || defined(USE_OZONE) || defined(USE_X11) | |
| 17 return uint64_t(widget); | |
|
dcheng
2016/06/22 14:18:08
Nit: static_cast here and below rather than using
| |
| 18 #else | |
| 19 NOTIMPLEMENTED(); | |
| 20 return 0; | |
| 21 #endif | |
| 22 } | |
| 23 | |
| 24 static bool Read(gfx::mojom::AcceleratedWidgetDataView data, | |
| 25 gfx::AcceleratedWidget* out) { | |
| 26 #if defined(OS_WIN) || defined(USE_OZONE) || defined(USE_X11) | |
| 27 uint64_t w = data.widget(); | |
| 28 *out = gfx::AcceleratedWidget(w); | |
| 29 #else | |
| 30 NOTIMPLEMENTED(); | |
| 31 *out = 0; | |
| 32 #endif | |
| 33 return true; | |
| 34 } | |
| 35 }; | |
| 36 | |
| 37 } // namespace mojo | |
| 38 | |
| 39 #endif // UI_GFX_MOJO_ACCELERATED_WIDGET_STRUCT_TRAITS_H_ | |
| OLD | NEW |