| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 29 matching lines...) Expand all Loading... |
| 40 class HostPortPair; | 40 class HostPortPair; |
| 41 class IPAddress; | 41 class IPAddress; |
| 42 class IPEndPoint; | 42 class IPEndPoint; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace IPC { | 45 namespace IPC { |
| 46 | 46 |
| 47 template <> | 47 template <> |
| 48 struct CONTENT_EXPORT ParamTraits<url::Origin> { | 48 struct CONTENT_EXPORT ParamTraits<url::Origin> { |
| 49 typedef url::Origin param_type; | 49 typedef url::Origin param_type; |
| 50 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 50 static void Write(base::Pickle* m, const param_type& p); | 51 static void Write(base::Pickle* m, const param_type& p); |
| 51 static bool Read(const base::Pickle* m, | 52 static bool Read(const base::Pickle* m, |
| 52 base::PickleIterator* iter, | 53 base::PickleIterator* iter, |
| 53 param_type* p); | 54 param_type* p); |
| 54 static void Log(const param_type& p, std::string* l); | 55 static void Log(const param_type& p, std::string* l); |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 template<> | 58 template<> |
| 58 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { | 59 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { |
| 59 typedef net::HostPortPair param_type; | 60 typedef net::HostPortPair param_type; |
| 61 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 60 static void Write(base::Pickle* m, const param_type& p); | 62 static void Write(base::Pickle* m, const param_type& p); |
| 61 static bool Read(const base::Pickle* m, | 63 static bool Read(const base::Pickle* m, |
| 62 base::PickleIterator* iter, | 64 base::PickleIterator* iter, |
| 63 param_type* r); | 65 param_type* r); |
| 64 static void Log(const param_type& p, std::string* l); | 66 static void Log(const param_type& p, std::string* l); |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 template <> | 69 template <> |
| 68 struct CONTENT_EXPORT ParamTraits<net::IPEndPoint> { | 70 struct CONTENT_EXPORT ParamTraits<net::IPEndPoint> { |
| 69 typedef net::IPEndPoint param_type; | 71 typedef net::IPEndPoint param_type; |
| 72 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 70 static void Write(base::Pickle* m, const param_type& p); | 73 static void Write(base::Pickle* m, const param_type& p); |
| 71 static bool Read(const base::Pickle* m, | 74 static bool Read(const base::Pickle* m, |
| 72 base::PickleIterator* iter, | 75 base::PickleIterator* iter, |
| 73 param_type* p); | 76 param_type* p); |
| 74 static void Log(const param_type& p, std::string* l); | 77 static void Log(const param_type& p, std::string* l); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 template <> | 80 template <> |
| 78 struct CONTENT_EXPORT ParamTraits<net::IPAddress> { | 81 struct CONTENT_EXPORT ParamTraits<net::IPAddress> { |
| 79 typedef net::IPAddress param_type; | 82 typedef net::IPAddress param_type; |
| 83 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 80 static void Write(base::Pickle* m, const param_type& p); | 84 static void Write(base::Pickle* m, const param_type& p); |
| 81 static bool Read(const base::Pickle* m, | 85 static bool Read(const base::Pickle* m, |
| 82 base::PickleIterator* iter, | 86 base::PickleIterator* iter, |
| 83 param_type* p); | 87 param_type* p); |
| 84 static void Log(const param_type& p, std::string* l); | 88 static void Log(const param_type& p, std::string* l); |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 template <> | 91 template <> |
| 88 struct CONTENT_EXPORT ParamTraits<content::PageState> { | 92 struct CONTENT_EXPORT ParamTraits<content::PageState> { |
| 89 typedef content::PageState param_type; | 93 typedef content::PageState param_type; |
| 94 static void GetSize(base::PickleSizer* s, const param_type& p); |
| 90 static void Write(base::Pickle* m, const param_type& p); | 95 static void Write(base::Pickle* m, const param_type& p); |
| 91 static bool Read(const base::Pickle* m, | 96 static bool Read(const base::Pickle* m, |
| 92 base::PickleIterator* iter, | 97 base::PickleIterator* iter, |
| 93 param_type* p); | 98 param_type* p); |
| 94 static void Log(const param_type& p, std::string* l); | 99 static void Log(const param_type& p, std::string* l); |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 template <> | 102 template <> |
| 98 struct ParamTraits<gfx::NativeWindow> { | 103 struct ParamTraits<gfx::NativeWindow> { |
| 99 typedef gfx::NativeWindow param_type; | 104 typedef gfx::NativeWindow param_type; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 123 #endif | 128 #endif |
| 124 } | 129 } |
| 125 static void Log(const param_type& p, std::string* l) { | 130 static void Log(const param_type& p, std::string* l) { |
| 126 l->append("<gfx::NativeWindow>"); | 131 l->append("<gfx::NativeWindow>"); |
| 127 } | 132 } |
| 128 }; | 133 }; |
| 129 | 134 |
| 130 } // namespace IPC | 135 } // namespace IPC |
| 131 | 136 |
| 132 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 137 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |