OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 used by the content code, and which need | 9 // specializations for types that are used by the content code, and which need |
10 // manual serialization code. This is usually because they're not structs with | 10 // manual serialization code. This is usually because they're not structs with |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 static void Log(const param_type& p, std::string* l) { | 376 static void Log(const param_type& p, std::string* l) { |
377 l->append("TransportDIB("); | 377 l->append("TransportDIB("); |
378 LogParam(p.handle, l); | 378 LogParam(p.handle, l); |
379 l->append(", "); | 379 l->append(", "); |
380 LogParam(p.sequence_num, l); | 380 LogParam(p.sequence_num, l); |
381 l->append(")"); | 381 l->append(")"); |
382 } | 382 } |
383 }; | 383 }; |
384 #endif | 384 #endif |
385 | 385 |
386 #if defined(USE_X11) | |
387 template<> | |
388 struct ParamTraits<TransportDIB::Id> { | |
389 typedef TransportDIB::Id param_type; | |
390 static void Write(Message* m, const param_type& p) { | |
391 WriteParam(m, p.shmkey); | |
392 } | |
393 static bool Read(const Message* m, void** iter, param_type* r) { | |
394 return (ReadParam(m, iter, &r->shmkey)); | |
brettw
2011/03/24 23:54:34
I wouldn't do the extra parens around ReadParam.
| |
395 } | |
396 static void Log(const param_type& p, std::string* l) { | |
397 l->append("TransportDIB("); | |
398 LogParam(p.shmkey, l); | |
399 l->append(")"); | |
400 } | |
401 }; | |
402 #endif | |
403 | |
386 template <> | 404 template <> |
387 struct SimilarTypeTraits<WebKit::WebTextDirection> { | 405 struct SimilarTypeTraits<WebKit::WebTextDirection> { |
388 typedef int Type; | 406 typedef int Type; |
389 }; | 407 }; |
390 | 408 |
391 template <> | 409 template <> |
392 struct ParamTraits<SkBitmap> { | 410 struct ParamTraits<SkBitmap> { |
393 typedef SkBitmap param_type; | 411 typedef SkBitmap param_type; |
394 static void Write(Message* m, const param_type& p); | 412 static void Write(Message* m, const param_type& p); |
395 | 413 |
(...skipping 13 matching lines...) Expand all Loading... | |
409 struct ParamTraits<webkit_glue::PasswordForm> { | 427 struct ParamTraits<webkit_glue::PasswordForm> { |
410 typedef webkit_glue::PasswordForm param_type; | 428 typedef webkit_glue::PasswordForm param_type; |
411 static void Write(Message* m, const param_type& p); | 429 static void Write(Message* m, const param_type& p); |
412 static bool Read(const Message* m, void** iter, param_type* p); | 430 static bool Read(const Message* m, void** iter, param_type* p); |
413 static void Log(const param_type& p, std::string* l); | 431 static void Log(const param_type& p, std::string* l); |
414 }; | 432 }; |
415 | 433 |
416 } // namespace IPC | 434 } // namespace IPC |
417 | 435 |
418 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 436 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |