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> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return false; | 54 return false; |
55 memcpy(bitmap->getPixels(), pixels, pixels_size); | 55 memcpy(bitmap->getPixels(), pixels, pixels_size); |
56 return true; | 56 return true; |
57 } | 57 } |
58 }; | 58 }; |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 namespace IPC { | 62 namespace IPC { |
63 | 63 |
64 void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { | 64 void ParamTraits<gfx::Point>::Write(base::Pickle* m, const gfx::Point& p) { |
65 WriteParam(m, p.x()); | 65 WriteParam(m, p.x()); |
66 WriteParam(m, p.y()); | 66 WriteParam(m, p.y()); |
67 } | 67 } |
68 | 68 |
69 bool ParamTraits<gfx::Point>::Read(const Message* m, | 69 bool ParamTraits<gfx::Point>::Read(const base::Pickle* m, |
70 base::PickleIterator* iter, | 70 base::PickleIterator* iter, |
71 gfx::Point* r) { | 71 gfx::Point* r) { |
72 int x, y; | 72 int x, y; |
73 if (!ReadParam(m, iter, &x) || !ReadParam(m, iter, &y)) | 73 if (!ReadParam(m, iter, &x) || !ReadParam(m, iter, &y)) |
74 return false; | 74 return false; |
75 r->set_x(x); | 75 r->set_x(x); |
76 r->set_y(y); | 76 r->set_y(y); |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::string* l) { | 80 void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::string* l) { |
81 l->append(base::StringPrintf("(%d, %d)", p.x(), p.y())); | 81 l->append(base::StringPrintf("(%d, %d)", p.x(), p.y())); |
82 } | 82 } |
83 | 83 |
84 void ParamTraits<gfx::PointF>::Write(Message* m, const gfx::PointF& p) { | 84 void ParamTraits<gfx::PointF>::Write(base::Pickle* m, const gfx::PointF& p) { |
85 WriteParam(m, p.x()); | 85 WriteParam(m, p.x()); |
86 WriteParam(m, p.y()); | 86 WriteParam(m, p.y()); |
87 } | 87 } |
88 | 88 |
89 bool ParamTraits<gfx::PointF>::Read(const Message* m, | 89 bool ParamTraits<gfx::PointF>::Read(const base::Pickle* m, |
90 base::PickleIterator* iter, | 90 base::PickleIterator* iter, |
91 gfx::PointF* r) { | 91 gfx::PointF* r) { |
92 float x, y; | 92 float x, y; |
93 if (!ReadParam(m, iter, &x) || !ReadParam(m, iter, &y)) | 93 if (!ReadParam(m, iter, &x) || !ReadParam(m, iter, &y)) |
94 return false; | 94 return false; |
95 r->set_x(x); | 95 r->set_x(x); |
96 r->set_y(y); | 96 r->set_y(y); |
97 return true; | 97 return true; |
98 } | 98 } |
99 | 99 |
100 void ParamTraits<gfx::PointF>::Log(const gfx::PointF& p, std::string* l) { | 100 void ParamTraits<gfx::PointF>::Log(const gfx::PointF& p, std::string* l) { |
101 l->append(base::StringPrintf("(%f, %f)", p.x(), p.y())); | 101 l->append(base::StringPrintf("(%f, %f)", p.x(), p.y())); |
102 } | 102 } |
103 | 103 |
104 void ParamTraits<gfx::Point3F>::Write(Message* m, const gfx::Point3F& p) { | 104 void ParamTraits<gfx::Point3F>::Write(base::Pickle* m, const gfx::Point3F& p) { |
105 WriteParam(m, p.x()); | 105 WriteParam(m, p.x()); |
106 WriteParam(m, p.y()); | 106 WriteParam(m, p.y()); |
107 WriteParam(m, p.z()); | 107 WriteParam(m, p.z()); |
108 } | 108 } |
109 | 109 |
110 bool ParamTraits<gfx::Point3F>::Read(const Message* m, | 110 bool ParamTraits<gfx::Point3F>::Read(const base::Pickle* m, |
111 base::PickleIterator* iter, | 111 base::PickleIterator* iter, |
112 gfx::Point3F* r) { | 112 gfx::Point3F* r) { |
113 float x, y, z; | 113 float x, y, z; |
114 if (!ReadParam(m, iter, &x) || !ReadParam(m, iter, &y) || | 114 if (!ReadParam(m, iter, &x) || !ReadParam(m, iter, &y) || |
115 !ReadParam(m, iter, &z)) | 115 !ReadParam(m, iter, &z)) |
116 return false; | 116 return false; |
117 r->set_x(x); | 117 r->set_x(x); |
118 r->set_y(y); | 118 r->set_y(y); |
119 r->set_z(z); | 119 r->set_z(z); |
120 return true; | 120 return true; |
121 } | 121 } |
122 | 122 |
123 void ParamTraits<gfx::Point3F>::Log(const gfx::Point3F& p, std::string* l) { | 123 void ParamTraits<gfx::Point3F>::Log(const gfx::Point3F& p, std::string* l) { |
124 l->append(base::StringPrintf("(%f, %f, %f)", p.x(), p.y(), p.z())); | 124 l->append(base::StringPrintf("(%f, %f, %f)", p.x(), p.y(), p.z())); |
125 } | 125 } |
126 | 126 |
127 void ParamTraits<gfx::Size>::Write(Message* m, const gfx::Size& p) { | 127 void ParamTraits<gfx::Size>::Write(base::Pickle* m, const gfx::Size& p) { |
128 DCHECK_GE(p.width(), 0); | 128 DCHECK_GE(p.width(), 0); |
129 DCHECK_GE(p.height(), 0); | 129 DCHECK_GE(p.height(), 0); |
130 int values[2] = { p.width(), p.height() }; | 130 int values[2] = { p.width(), p.height() }; |
131 m->WriteBytes(&values, sizeof(int) * 2); | 131 m->WriteBytes(&values, sizeof(int) * 2); |
132 } | 132 } |
133 | 133 |
134 bool ParamTraits<gfx::Size>::Read(const Message* m, | 134 bool ParamTraits<gfx::Size>::Read(const base::Pickle* m, |
135 base::PickleIterator* iter, | 135 base::PickleIterator* iter, |
136 gfx::Size* r) { | 136 gfx::Size* r) { |
137 const char* char_values; | 137 const char* char_values; |
138 if (!iter->ReadBytes(&char_values, sizeof(int) * 2)) | 138 if (!iter->ReadBytes(&char_values, sizeof(int) * 2)) |
139 return false; | 139 return false; |
140 const int* values = reinterpret_cast<const int*>(char_values); | 140 const int* values = reinterpret_cast<const int*>(char_values); |
141 if (values[0] < 0 || values[1] < 0) | 141 if (values[0] < 0 || values[1] < 0) |
142 return false; | 142 return false; |
143 r->set_width(values[0]); | 143 r->set_width(values[0]); |
144 r->set_height(values[1]); | 144 r->set_height(values[1]); |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
148 void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { | 148 void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { |
149 l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); | 149 l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); |
150 } | 150 } |
151 | 151 |
152 void ParamTraits<gfx::SizeF>::Write(Message* m, const gfx::SizeF& p) { | 152 void ParamTraits<gfx::SizeF>::Write(base::Pickle* m, const gfx::SizeF& p) { |
153 float values[2] = { p.width(), p.height() }; | 153 float values[2] = { p.width(), p.height() }; |
154 m->WriteBytes(&values, sizeof(float) * 2); | 154 m->WriteBytes(&values, sizeof(float) * 2); |
155 } | 155 } |
156 | 156 |
157 bool ParamTraits<gfx::SizeF>::Read(const Message* m, | 157 bool ParamTraits<gfx::SizeF>::Read(const base::Pickle* m, |
158 base::PickleIterator* iter, | 158 base::PickleIterator* iter, |
159 gfx::SizeF* r) { | 159 gfx::SizeF* r) { |
160 const char* char_values; | 160 const char* char_values; |
161 if (!iter->ReadBytes(&char_values, sizeof(float) * 2)) | 161 if (!iter->ReadBytes(&char_values, sizeof(float) * 2)) |
162 return false; | 162 return false; |
163 const float* values = reinterpret_cast<const float*>(char_values); | 163 const float* values = reinterpret_cast<const float*>(char_values); |
164 r->set_width(values[0]); | 164 r->set_width(values[0]); |
165 r->set_height(values[1]); | 165 r->set_height(values[1]); |
166 return true; | 166 return true; |
167 } | 167 } |
168 | 168 |
169 void ParamTraits<gfx::SizeF>::Log(const gfx::SizeF& p, std::string* l) { | 169 void ParamTraits<gfx::SizeF>::Log(const gfx::SizeF& p, std::string* l) { |
170 l->append(base::StringPrintf("(%f, %f)", p.width(), p.height())); | 170 l->append(base::StringPrintf("(%f, %f)", p.width(), p.height())); |
171 } | 171 } |
172 | 172 |
173 void ParamTraits<gfx::Vector2d>::Write(Message* m, const gfx::Vector2d& p) { | 173 void ParamTraits<gfx::Vector2d>::Write(base::Pickle* m, |
| 174 const gfx::Vector2d& p) { |
174 int values[2] = { p.x(), p.y() }; | 175 int values[2] = { p.x(), p.y() }; |
175 m->WriteBytes(&values, sizeof(int) * 2); | 176 m->WriteBytes(&values, sizeof(int) * 2); |
176 } | 177 } |
177 | 178 |
178 bool ParamTraits<gfx::Vector2d>::Read(const Message* m, | 179 bool ParamTraits<gfx::Vector2d>::Read(const base::Pickle* m, |
179 base::PickleIterator* iter, | 180 base::PickleIterator* iter, |
180 gfx::Vector2d* r) { | 181 gfx::Vector2d* r) { |
181 const char* char_values; | 182 const char* char_values; |
182 if (!iter->ReadBytes(&char_values, sizeof(int) * 2)) | 183 if (!iter->ReadBytes(&char_values, sizeof(int) * 2)) |
183 return false; | 184 return false; |
184 const int* values = reinterpret_cast<const int*>(char_values); | 185 const int* values = reinterpret_cast<const int*>(char_values); |
185 r->set_x(values[0]); | 186 r->set_x(values[0]); |
186 r->set_y(values[1]); | 187 r->set_y(values[1]); |
187 return true; | 188 return true; |
188 } | 189 } |
189 | 190 |
190 void ParamTraits<gfx::Vector2d>::Log(const gfx::Vector2d& v, std::string* l) { | 191 void ParamTraits<gfx::Vector2d>::Log(const gfx::Vector2d& v, std::string* l) { |
191 l->append(base::StringPrintf("(%d, %d)", v.x(), v.y())); | 192 l->append(base::StringPrintf("(%d, %d)", v.x(), v.y())); |
192 } | 193 } |
193 | 194 |
194 void ParamTraits<gfx::Vector2dF>::Write(Message* m, const gfx::Vector2dF& p) { | 195 void ParamTraits<gfx::Vector2dF>::Write(base::Pickle* m, |
| 196 const gfx::Vector2dF& p) { |
195 float values[2] = { p.x(), p.y() }; | 197 float values[2] = { p.x(), p.y() }; |
196 m->WriteBytes(&values, sizeof(float) * 2); | 198 m->WriteBytes(&values, sizeof(float) * 2); |
197 } | 199 } |
198 | 200 |
199 bool ParamTraits<gfx::Vector2dF>::Read(const Message* m, | 201 bool ParamTraits<gfx::Vector2dF>::Read(const base::Pickle* m, |
200 base::PickleIterator* iter, | 202 base::PickleIterator* iter, |
201 gfx::Vector2dF* r) { | 203 gfx::Vector2dF* r) { |
202 const char* char_values; | 204 const char* char_values; |
203 if (!iter->ReadBytes(&char_values, sizeof(float) * 2)) | 205 if (!iter->ReadBytes(&char_values, sizeof(float) * 2)) |
204 return false; | 206 return false; |
205 const float* values = reinterpret_cast<const float*>(char_values); | 207 const float* values = reinterpret_cast<const float*>(char_values); |
206 r->set_x(values[0]); | 208 r->set_x(values[0]); |
207 r->set_y(values[1]); | 209 r->set_y(values[1]); |
208 return true; | 210 return true; |
209 } | 211 } |
210 | 212 |
211 void ParamTraits<gfx::Vector2dF>::Log(const gfx::Vector2dF& v, std::string* l) { | 213 void ParamTraits<gfx::Vector2dF>::Log(const gfx::Vector2dF& v, std::string* l) { |
212 l->append(base::StringPrintf("(%f, %f)", v.x(), v.y())); | 214 l->append(base::StringPrintf("(%f, %f)", v.x(), v.y())); |
213 } | 215 } |
214 | 216 |
215 void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) { | 217 void ParamTraits<gfx::Rect>::Write(base::Pickle* m, const gfx::Rect& p) { |
216 int values[4] = { p.x(), p.y(), p.width(), p.height() }; | 218 int values[4] = { p.x(), p.y(), p.width(), p.height() }; |
217 m->WriteBytes(&values, sizeof(int) * 4); | 219 m->WriteBytes(&values, sizeof(int) * 4); |
218 } | 220 } |
219 | 221 |
220 bool ParamTraits<gfx::Rect>::Read(const Message* m, | 222 bool ParamTraits<gfx::Rect>::Read(const base::Pickle* m, |
221 base::PickleIterator* iter, | 223 base::PickleIterator* iter, |
222 gfx::Rect* r) { | 224 gfx::Rect* r) { |
223 const char* char_values; | 225 const char* char_values; |
224 if (!iter->ReadBytes(&char_values, sizeof(int) * 4)) | 226 if (!iter->ReadBytes(&char_values, sizeof(int) * 4)) |
225 return false; | 227 return false; |
226 const int* values = reinterpret_cast<const int*>(char_values); | 228 const int* values = reinterpret_cast<const int*>(char_values); |
227 if (values[2] < 0 || values[3] < 0) | 229 if (values[2] < 0 || values[3] < 0) |
228 return false; | 230 return false; |
229 r->SetRect(values[0], values[1], values[2], values[3]); | 231 r->SetRect(values[0], values[1], values[2], values[3]); |
230 return true; | 232 return true; |
231 } | 233 } |
232 | 234 |
233 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { | 235 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { |
234 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), | 236 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), |
235 p.width(), p.height())); | 237 p.width(), p.height())); |
236 } | 238 } |
237 | 239 |
238 void ParamTraits<gfx::RectF>::Write(Message* m, const gfx::RectF& p) { | 240 void ParamTraits<gfx::RectF>::Write(base::Pickle* m, const gfx::RectF& p) { |
239 float values[4] = { p.x(), p.y(), p.width(), p.height() }; | 241 float values[4] = { p.x(), p.y(), p.width(), p.height() }; |
240 m->WriteBytes(&values, sizeof(float) * 4); | 242 m->WriteBytes(&values, sizeof(float) * 4); |
241 } | 243 } |
242 | 244 |
243 bool ParamTraits<gfx::RectF>::Read(const Message* m, | 245 bool ParamTraits<gfx::RectF>::Read(const base::Pickle* m, |
244 base::PickleIterator* iter, | 246 base::PickleIterator* iter, |
245 gfx::RectF* r) { | 247 gfx::RectF* r) { |
246 const char* char_values; | 248 const char* char_values; |
247 if (!iter->ReadBytes(&char_values, sizeof(float) * 4)) | 249 if (!iter->ReadBytes(&char_values, sizeof(float) * 4)) |
248 return false; | 250 return false; |
249 const float* values = reinterpret_cast<const float*>(char_values); | 251 const float* values = reinterpret_cast<const float*>(char_values); |
250 r->SetRect(values[0], values[1], values[2], values[3]); | 252 r->SetRect(values[0], values[1], values[2], values[3]); |
251 return true; | 253 return true; |
252 } | 254 } |
253 | 255 |
254 void ParamTraits<gfx::RectF>::Log(const gfx::RectF& p, std::string* l) { | 256 void ParamTraits<gfx::RectF>::Log(const gfx::RectF& p, std::string* l) { |
255 l->append(base::StringPrintf("(%f, %f, %f, %f)", p.x(), p.y(), | 257 l->append(base::StringPrintf("(%f, %f, %f, %f)", p.x(), p.y(), |
256 p.width(), p.height())); | 258 p.width(), p.height())); |
257 } | 259 } |
258 | 260 |
259 void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) { | 261 void ParamTraits<SkBitmap>::Write(base::Pickle* m, const SkBitmap& p) { |
260 size_t fixed_size = sizeof(SkBitmap_Data); | 262 size_t fixed_size = sizeof(SkBitmap_Data); |
261 SkBitmap_Data bmp_data; | 263 SkBitmap_Data bmp_data; |
262 bmp_data.InitSkBitmapDataForTransfer(p); | 264 bmp_data.InitSkBitmapDataForTransfer(p); |
263 m->WriteData(reinterpret_cast<const char*>(&bmp_data), | 265 m->WriteData(reinterpret_cast<const char*>(&bmp_data), |
264 static_cast<int>(fixed_size)); | 266 static_cast<int>(fixed_size)); |
265 size_t pixel_size = p.getSize(); | 267 size_t pixel_size = p.getSize(); |
266 SkAutoLockPixels p_lock(p); | 268 SkAutoLockPixels p_lock(p); |
267 m->WriteData(reinterpret_cast<const char*>(p.getPixels()), | 269 m->WriteData(reinterpret_cast<const char*>(p.getPixels()), |
268 static_cast<int>(pixel_size)); | 270 static_cast<int>(pixel_size)); |
269 } | 271 } |
270 | 272 |
271 bool ParamTraits<SkBitmap>::Read(const Message* m, | 273 bool ParamTraits<SkBitmap>::Read(const base::Pickle* m, |
272 base::PickleIterator* iter, | 274 base::PickleIterator* iter, |
273 SkBitmap* r) { | 275 SkBitmap* r) { |
274 const char* fixed_data; | 276 const char* fixed_data; |
275 int fixed_data_size = 0; | 277 int fixed_data_size = 0; |
276 if (!iter->ReadData(&fixed_data, &fixed_data_size) || | 278 if (!iter->ReadData(&fixed_data, &fixed_data_size) || |
277 (fixed_data_size <= 0)) { | 279 (fixed_data_size <= 0)) { |
278 NOTREACHED(); | 280 NOTREACHED(); |
279 return false; | 281 return false; |
280 } | 282 } |
281 if (fixed_data_size != sizeof(SkBitmap_Data)) | 283 if (fixed_data_size != sizeof(SkBitmap_Data)) |
282 return false; // Message is malformed. | 284 return false; // Message is malformed. |
283 | 285 |
284 const char* variable_data; | 286 const char* variable_data; |
285 int variable_data_size = 0; | 287 int variable_data_size = 0; |
286 if (!iter->ReadData(&variable_data, &variable_data_size) || | 288 if (!iter->ReadData(&variable_data, &variable_data_size) || |
287 (variable_data_size < 0)) { | 289 (variable_data_size < 0)) { |
288 NOTREACHED(); | 290 NOTREACHED(); |
289 return false; | 291 return false; |
290 } | 292 } |
291 const SkBitmap_Data* bmp_data = | 293 const SkBitmap_Data* bmp_data = |
292 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 294 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
293 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 295 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
294 } | 296 } |
295 | 297 |
296 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { | 298 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { |
297 l->append("<SkBitmap>"); | 299 l->append("<SkBitmap>"); |
298 } | 300 } |
299 | 301 |
300 void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) { | 302 void ParamTraits<gfx::Range>::Write(base::Pickle* m, const gfx::Range& r) { |
301 m->WriteSizeT(r.start()); | 303 m->WriteSizeT(r.start()); |
302 m->WriteSizeT(r.end()); | 304 m->WriteSizeT(r.end()); |
303 } | 305 } |
304 | 306 |
305 bool ParamTraits<gfx::Range>::Read(const Message* m, | 307 bool ParamTraits<gfx::Range>::Read(const base::Pickle* m, |
306 base::PickleIterator* iter, | 308 base::PickleIterator* iter, |
307 gfx::Range* r) { | 309 gfx::Range* r) { |
308 size_t start, end; | 310 size_t start, end; |
309 if (!iter->ReadSizeT(&start) || !iter->ReadSizeT(&end)) | 311 if (!iter->ReadSizeT(&start) || !iter->ReadSizeT(&end)) |
310 return false; | 312 return false; |
311 r->set_start(start); | 313 r->set_start(start); |
312 r->set_end(end); | 314 r->set_end(end); |
313 return true; | 315 return true; |
314 } | 316 } |
315 | 317 |
316 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { | 318 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { |
317 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); | 319 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); |
318 } | 320 } |
319 | 321 |
320 void ParamTraits<gfx::ScrollOffset>::Write(Message* m, const param_type& p) { | 322 void ParamTraits<gfx::ScrollOffset>::Write(base::Pickle* m, |
| 323 const param_type& p) { |
321 m->WriteDouble(p.x()); | 324 m->WriteDouble(p.x()); |
322 m->WriteDouble(p.y()); | 325 m->WriteDouble(p.y()); |
323 } | 326 } |
324 | 327 |
325 bool ParamTraits<gfx::ScrollOffset>::Read(const Message* m, | 328 bool ParamTraits<gfx::ScrollOffset>::Read(const base::Pickle* m, |
326 base::PickleIterator* iter, | 329 base::PickleIterator* iter, |
327 param_type* r) { | 330 param_type* r) { |
328 double x = 0.f; | 331 double x = 0.f; |
329 double y = 0.f; | 332 double y = 0.f; |
330 if (!iter->ReadDouble(&x)) | 333 if (!iter->ReadDouble(&x)) |
331 return false; | 334 return false; |
332 if (!iter->ReadDouble(&y)) | 335 if (!iter->ReadDouble(&y)) |
333 return false; | 336 return false; |
334 r->set_x(x); | 337 r->set_x(x); |
335 r->set_y(y); | 338 r->set_y(y); |
336 return true; | 339 return true; |
337 } | 340 } |
338 | 341 |
339 void ParamTraits<gfx::ScrollOffset>::Log(const param_type& p, std::string* l) { | 342 void ParamTraits<gfx::ScrollOffset>::Log(const param_type& p, std::string* l) { |
340 l->append("("); | 343 l->append("("); |
341 LogParam(p.x(), l); | 344 LogParam(p.x(), l); |
342 l->append(", "); | 345 l->append(", "); |
343 LogParam(p.y(), l); | 346 LogParam(p.y(), l); |
344 l->append(")"); | 347 l->append(")"); |
345 } | 348 } |
346 | 349 |
347 #if defined(OS_MACOSX) && !defined(OS_IOS) | 350 #if defined(OS_MACOSX) && !defined(OS_IOS) |
348 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Write( | 351 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Write( |
349 Message* m, | 352 base::Pickle* m, |
350 const param_type p) { | 353 const param_type p) { |
351 MachPortMac mach_port_mac(p.get()); | 354 MachPortMac mach_port_mac(p.get()); |
352 ParamTraits<MachPortMac>::Write(m, mach_port_mac); | 355 ParamTraits<MachPortMac>::Write(m, mach_port_mac); |
353 } | 356 } |
354 | 357 |
355 bool ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Read( | 358 bool ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Read( |
356 const Message* m, | 359 const base::Pickle* m, |
357 base::PickleIterator* iter, | 360 base::PickleIterator* iter, |
358 param_type* r) { | 361 param_type* r) { |
359 MachPortMac mach_port_mac; | 362 MachPortMac mach_port_mac; |
360 if (!ParamTraits<MachPortMac>::Read(m, iter, &mach_port_mac)) | 363 if (!ParamTraits<MachPortMac>::Read(m, iter, &mach_port_mac)) |
361 return false; | 364 return false; |
362 r->reset(mach_port_mac.get_mach_port()); | 365 r->reset(mach_port_mac.get_mach_port()); |
363 return true; | 366 return true; |
364 } | 367 } |
365 | 368 |
366 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Log( | 369 void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Log( |
(...skipping 19 matching lines...) Expand all Loading... |
386 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 389 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
387 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 390 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
388 } // namespace IPC | 391 } // namespace IPC |
389 | 392 |
390 // Generate param traits log methods. | 393 // Generate param traits log methods. |
391 #include "ipc/param_traits_log_macros.h" | 394 #include "ipc/param_traits_log_macros.h" |
392 namespace IPC { | 395 namespace IPC { |
393 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 396 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
394 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 397 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
395 } // namespace IPC | 398 } // namespace IPC |
OLD | NEW |