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 #include "ui/gfx/ipc/gfx_param_traits.h" | 5 #include "ui/gfx/ipc/gfx_param_traits.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" | |
12 #include "ui/gfx/range/range.h" | 13 #include "ui/gfx/range/range.h" |
13 | 14 |
14 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
15 #include "ipc/mach_port_mac.h" | 16 #include "ipc/mach_port_mac.h" |
16 #endif | 17 #endif |
17 | 18 |
18 namespace IPC { | 19 namespace IPC { |
19 | 20 |
20 void ParamTraits<gfx::Range>::GetSize(base::PickleSizer* s, | 21 void ParamTraits<gfx::Range>::GetSize(base::PickleSizer* s, |
21 const gfx::Range& r) { | 22 const gfx::Range& r) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 } | 70 } |
70 | 71 |
71 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Log( | 72 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Log( |
72 const param_type& p, | 73 const param_type& p, |
73 std::string* l) { | 74 std::string* l) { |
74 l->append("IOSurface Mach send right: "); | 75 l->append("IOSurface Mach send right: "); |
75 LogParam(p.get(), l); | 76 LogParam(p.get(), l); |
76 } | 77 } |
77 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 78 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
78 | 79 |
80 void ParamTraits<gfx::SelectionBound>::GetSize(base::PickleSizer* s, | |
81 const param_type& p) { | |
82 GetParamSize(s, static_cast<uint32_t>(p.type())); | |
83 GetParamSize(s, p.edge_top()); | |
84 GetParamSize(s, p.edge_bottom()); | |
85 GetParamSize(s, p.visible()); | |
86 } | |
87 | |
88 void ParamTraits<gfx::SelectionBound>::Write(base::Pickle* m, | |
89 const param_type& p) { | |
90 WriteParam(m, static_cast<uint32_t>(p.type())); | |
91 WriteParam(m, p.edge_top()); | |
92 WriteParam(m, p.edge_bottom()); | |
93 WriteParam(m, p.visible()); | |
94 } | |
95 | |
96 bool ParamTraits<gfx::SelectionBound>::Read(const base::Pickle* m, | |
97 base::PickleIterator* iter, | |
98 param_type* r) { | |
99 uint32_t type; | |
100 gfx::PointF edge_top; | |
101 gfx::PointF edge_bottom; | |
102 bool visible = false; | |
103 | |
104 if (!ReadParam(m, iter, &type) || !ReadParam(m, iter, &edge_top) || | |
105 !ReadParam(m, iter, &edge_bottom) || !ReadParam(m, iter, &visible)) { | |
106 return false; | |
107 } | |
108 | |
109 r->set_type(static_cast<gfx::SelectionBound::Type>(type)); | |
Tom Sepez
2016/06/03 17:17:06
We should add traits for the type enum in IDL usin
Fady Samuel
2016/06/03 17:39:06
Done. Added IPC_ENUM_TRAITS_MAX_VALUE to ui/gfx/ip
| |
110 r->SetEdgeTop(edge_top); | |
111 r->SetEdgeBottom(edge_bottom); | |
112 r->set_visible(visible); | |
113 return true; | |
114 } | |
115 | |
116 void ParamTraits<gfx::SelectionBound>::Log(const param_type& p, | |
117 std::string* l) { | |
118 l->append("gfx::SelectionBound("); | |
119 LogParam(static_cast<uint32_t>(p.type()), l); | |
120 l->append(", "); | |
121 LogParam(p.edge_top(), l); | |
122 l->append(", "); | |
123 LogParam(p.edge_bottom(), l); | |
124 l->append(", "); | |
125 LogParam(p.visible(), l); | |
126 l->append(")"); | |
127 } | |
128 | |
79 } // namespace IPC | 129 } // namespace IPC |
80 | 130 |
81 // Generate param traits size methods. | 131 // Generate param traits size methods. |
82 #include "ipc/param_traits_size_macros.h" | 132 #include "ipc/param_traits_size_macros.h" |
83 namespace IPC { | 133 namespace IPC { |
84 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 134 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
85 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 135 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
86 } | 136 } |
87 | 137 |
88 // Generate param traits write methods. | 138 // Generate param traits write methods. |
89 #include "ipc/param_traits_write_macros.h" | 139 #include "ipc/param_traits_write_macros.h" |
90 namespace IPC { | 140 namespace IPC { |
91 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 141 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
92 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 142 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
93 } // namespace IPC | 143 } // namespace IPC |
94 | 144 |
95 // Generate param traits read methods. | 145 // Generate param traits read methods. |
96 #include "ipc/param_traits_read_macros.h" | 146 #include "ipc/param_traits_read_macros.h" |
97 namespace IPC { | 147 namespace IPC { |
98 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 148 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
99 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 149 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
100 } // namespace IPC | 150 } // namespace IPC |
101 | 151 |
102 // Generate param traits log methods. | 152 // Generate param traits log methods. |
103 #include "ipc/param_traits_log_macros.h" | 153 #include "ipc/param_traits_log_macros.h" |
104 namespace IPC { | 154 namespace IPC { |
105 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 155 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
106 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 156 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
107 } // namespace IPC | 157 } // namespace IPC |
OLD | NEW |