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

Side by Side Diff: ui/gfx/mojo/accelerated_widget_struct_traits.h

Issue 2071163002: Add StructTraits for AcceleratedWidget instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build Created 4 years, 6 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 | « ui/gfx/mojo/accelerated_widget.typemap ('k') | ui/gfx/mojo/struct_traits_unittest.cc » ('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 #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_
OLDNEW
« no previous file with comments | « ui/gfx/mojo/accelerated_widget.typemap ('k') | ui/gfx/mojo/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698