OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GFX_IPC_GFX_PARAM_TRAITS_H_ | 5 #ifndef UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
6 #define UI_GFX_IPC_GFX_PARAM_TRAITS_H_ | 6 #define UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ipc/ipc_message_utils.h" | 10 #include "ipc/ipc_message_utils.h" |
11 #include "ipc/param_traits_macros.h" | 11 #include "ipc/param_traits_macros.h" |
12 #include "ui/gfx/buffer_types.h" | 12 #include "ui/gfx/buffer_types.h" |
13 #include "ui/gfx/ipc/gfx_ipc_export.h" | 13 #include "ui/gfx/ipc/gfx_ipc_export.h" |
14 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 14 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
15 | 15 |
| 16 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 17 #include "ui/gfx/mac/io_surface.h" |
| 18 #endif |
| 19 |
16 class SkBitmap; | 20 class SkBitmap; |
17 | 21 |
18 namespace gfx { | 22 namespace gfx { |
19 class Point; | 23 class Point; |
20 class PointF; | 24 class PointF; |
21 class Point3F; | 25 class Point3F; |
22 class Range; | 26 class Range; |
23 class Rect; | 27 class Rect; |
24 class RectF; | 28 class RectF; |
25 class ScrollOffset; | 29 class ScrollOffset; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 }; | 128 }; |
125 | 129 |
126 template <> | 130 template <> |
127 struct GFX_IPC_EXPORT ParamTraits<gfx::ScrollOffset> { | 131 struct GFX_IPC_EXPORT ParamTraits<gfx::ScrollOffset> { |
128 typedef gfx::ScrollOffset param_type; | 132 typedef gfx::ScrollOffset param_type; |
129 static void Write(Message* m, const param_type& p); | 133 static void Write(Message* m, const param_type& p); |
130 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); | 134 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
131 static void Log(const param_type& p, std::string* l); | 135 static void Log(const param_type& p, std::string* l); |
132 }; | 136 }; |
133 | 137 |
| 138 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 139 template <> |
| 140 struct GFX_IPC_EXPORT ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort> { |
| 141 typedef gfx::ScopedRefCountedIOSurfaceMachPort param_type; |
| 142 static void Write(Message* m, const param_type p); |
| 143 // Note: Read() passes ownership of the Mach send right from the IPC message |
| 144 // to the ScopedRefCountedIOSurfaceMachPort. Therefore, Read() may only be |
| 145 // called once for a given message, otherwise the singular right will be |
| 146 // managed and released by two objects. |
| 147 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 148 static void Log(const param_type& p, std::string* l); |
| 149 }; |
| 150 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 151 |
134 } // namespace IPC | 152 } // namespace IPC |
135 | 153 |
136 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_ | 154 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
OLD | NEW |