| 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) | 16 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 17 #include "ui/gfx/mac/io_surface.h" | 17 #include "ui/gfx/mac/io_surface.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class Range; | 21 class Range; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace IPC { | 24 namespace IPC { |
| 25 | 25 |
| 26 template <> | 26 template <> |
| 27 struct GFX_IPC_EXPORT ParamTraits<gfx::Range> { | 27 struct GFX_IPC_EXPORT ParamTraits<gfx::Range> { |
| 28 typedef gfx::Range param_type; | 28 typedef gfx::Range param_type; |
| 29 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 29 static void Write(base::Pickle* m, const param_type& p); | 30 static void Write(base::Pickle* m, const param_type& p); |
| 30 static bool Read(const base::Pickle* m, | 31 static bool Read(const base::Pickle* m, |
| 31 base::PickleIterator* iter, | 32 base::PickleIterator* iter, |
| 32 param_type* r); | 33 param_type* r); |
| 33 static void Log(const param_type& p, std::string* l); | 34 static void Log(const param_type& p, std::string* l); |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 #if defined(OS_MACOSX) && !defined(OS_IOS) | 37 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 37 template <> | 38 template <> |
| 38 struct GFX_IPC_EXPORT ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort> { | 39 struct GFX_IPC_EXPORT ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort> { |
| 39 typedef gfx::ScopedRefCountedIOSurfaceMachPort param_type; | 40 typedef gfx::ScopedRefCountedIOSurfaceMachPort param_type; |
| 41 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 40 static void Write(base::Pickle* m, const param_type p); | 42 static void Write(base::Pickle* m, const param_type p); |
| 41 // Note: Read() passes ownership of the Mach send right from the IPC message | 43 // Note: Read() passes ownership of the Mach send right from the IPC message |
| 42 // to the ScopedRefCountedIOSurfaceMachPort. Therefore, Read() may only be | 44 // to the ScopedRefCountedIOSurfaceMachPort. Therefore, Read() may only be |
| 43 // called once for a given message, otherwise the singular right will be | 45 // called once for a given message, otherwise the singular right will be |
| 44 // managed and released by two objects. | 46 // managed and released by two objects. |
| 45 static bool Read(const base::Pickle* m, | 47 static bool Read(const base::Pickle* m, |
| 46 base::PickleIterator* iter, | 48 base::PickleIterator* iter, |
| 47 param_type* r); | 49 param_type* r); |
| 48 static void Log(const param_type& p, std::string* l); | 50 static void Log(const param_type& p, std::string* l); |
| 49 }; | 51 }; |
| 50 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 52 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 51 | 53 |
| 52 } // namespace IPC | 54 } // namespace IPC |
| 53 | 55 |
| 54 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_ | 56 #endif // UI_GFX_IPC_GFX_PARAM_TRAITS_H_ |
| OLD | NEW |