| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OBJECT_H_ | 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OBJECT_H_ |
| 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OBJECT_H_ | 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OBJECT_H_ |
| 7 | 7 |
| 8 #include <wayland-client-core.h> | 8 #include <wayland-client-core.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 | 11 |
| 12 struct wl_buffer; | 12 struct wl_buffer; |
| 13 struct wl_compositor; | 13 struct wl_compositor; |
| 14 struct wl_pointer; |
| 14 struct wl_registry; | 15 struct wl_registry; |
| 16 struct wl_seat; |
| 15 struct wl_shm; | 17 struct wl_shm; |
| 16 struct wl_shm_pool; | 18 struct wl_shm_pool; |
| 17 struct wl_surface; | 19 struct wl_surface; |
| 18 struct xdg_shell; | 20 struct xdg_shell; |
| 19 struct xdg_surface; | 21 struct xdg_surface; |
| 20 | 22 |
| 21 namespace wl { | 23 namespace wl { |
| 22 | 24 |
| 23 template <typename T> | 25 template <typename T> |
| 24 struct ObjectTraits; | 26 struct ObjectTraits; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 static void (*deleter)(wl_compositor*); | 37 static void (*deleter)(wl_compositor*); |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 template <> | 40 template <> |
| 39 struct ObjectTraits<wl_display> { | 41 struct ObjectTraits<wl_display> { |
| 40 static const wl_interface* interface; | 42 static const wl_interface* interface; |
| 41 static void (*deleter)(wl_display*); | 43 static void (*deleter)(wl_display*); |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 template <> | 46 template <> |
| 47 struct ObjectTraits<wl_pointer> { |
| 48 static const wl_interface* interface; |
| 49 static void (*deleter)(wl_pointer*); |
| 50 }; |
| 51 |
| 52 template <> |
| 45 struct ObjectTraits<wl_registry> { | 53 struct ObjectTraits<wl_registry> { |
| 46 static const wl_interface* interface; | 54 static const wl_interface* interface; |
| 47 static void (*deleter)(wl_registry*); | 55 static void (*deleter)(wl_registry*); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 template <> | 58 template <> |
| 59 struct ObjectTraits<wl_seat> { |
| 60 static const wl_interface* interface; |
| 61 static void (*deleter)(wl_seat*); |
| 62 }; |
| 63 |
| 64 template <> |
| 51 struct ObjectTraits<wl_shm> { | 65 struct ObjectTraits<wl_shm> { |
| 52 static const wl_interface* interface; | 66 static const wl_interface* interface; |
| 53 static void (*deleter)(wl_shm*); | 67 static void (*deleter)(wl_shm*); |
| 54 }; | 68 }; |
| 55 | 69 |
| 56 template <> | 70 template <> |
| 57 struct ObjectTraits<wl_shm_pool> { | 71 struct ObjectTraits<wl_shm_pool> { |
| 58 static const wl_interface* interface; | 72 static const wl_interface* interface; |
| 59 static void (*deleter)(wl_shm_pool*); | 73 static void (*deleter)(wl_shm_pool*); |
| 60 }; | 74 }; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 112 |
| 99 template <typename T> | 113 template <typename T> |
| 100 wl::Object<T> Bind(wl_registry* registry, uint32_t name, uint32_t version) { | 114 wl::Object<T> Bind(wl_registry* registry, uint32_t name, uint32_t version) { |
| 101 return wl::Object<T>(static_cast<T*>( | 115 return wl::Object<T>(static_cast<T*>( |
| 102 wl_registry_bind(registry, name, ObjectTraits<T>::interface, version))); | 116 wl_registry_bind(registry, name, ObjectTraits<T>::interface, version))); |
| 103 } | 117 } |
| 104 | 118 |
| 105 } // namespace wl | 119 } // namespace wl |
| 106 | 120 |
| 107 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OBJECT_H_ | 121 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_OBJECT_H_ |
| OLD | NEW |