OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file is used to define IPC::ParamTraits<> specializations for a number | 5 // This file is used to define IPC::ParamTraits<> specializations for a number |
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> | 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> |
7 // specializations for basic types (like int and std::string) and types in the | 7 // specializations for basic types (like int and std::string) and types in the |
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains | 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains |
9 // specializations for types that are shared by more than one child process. | 9 // specializations for types that are shared by more than one child process. |
10 | 10 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 354 } |
355 }; | 355 }; |
356 | 356 |
357 // Traits for net::UploadData. | 357 // Traits for net::UploadData. |
358 template <> | 358 template <> |
359 struct ParamTraits<scoped_refptr<net::UploadData> > { | 359 struct ParamTraits<scoped_refptr<net::UploadData> > { |
360 typedef scoped_refptr<net::UploadData> param_type; | 360 typedef scoped_refptr<net::UploadData> param_type; |
361 static void Write(Message* m, const param_type& p) { | 361 static void Write(Message* m, const param_type& p) { |
362 WriteParam(m, p.get() != NULL); | 362 WriteParam(m, p.get() != NULL); |
363 if (p) { | 363 if (p) { |
364 WriteParam(m, p->elements()); | 364 WriteParam(m, *p->elements()); |
365 WriteParam(m, p->identifier()); | 365 WriteParam(m, p->identifier()); |
366 } | 366 } |
367 } | 367 } |
368 static bool Read(const Message* m, void** iter, param_type* r) { | 368 static bool Read(const Message* m, void** iter, param_type* r) { |
369 bool has_object; | 369 bool has_object; |
370 if (!ReadParam(m, iter, &has_object)) | 370 if (!ReadParam(m, iter, &has_object)) |
371 return false; | 371 return false; |
372 if (!has_object) | 372 if (!has_object) |
373 return true; | 373 return true; |
374 std::vector<net::UploadData::Element> elements; | 374 std::vector<net::UploadData::Element> elements; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 struct ParamTraits<Geoposition::ErrorCode> { | 430 struct ParamTraits<Geoposition::ErrorCode> { |
431 typedef Geoposition::ErrorCode param_type; | 431 typedef Geoposition::ErrorCode param_type; |
432 static void Write(Message* m, const param_type& p); | 432 static void Write(Message* m, const param_type& p); |
433 static bool Read(const Message* m, void** iter, param_type* p); | 433 static bool Read(const Message* m, void** iter, param_type* p); |
434 static void Log(const param_type& p, std::wstring* l); | 434 static void Log(const param_type& p, std::wstring* l); |
435 }; | 435 }; |
436 | 436 |
437 } // namespace IPC | 437 } // namespace IPC |
438 | 438 |
439 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 439 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |