| 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 18 matching lines...) Expand all Loading... |
| 29 #include "base/win/win_util.h" | 29 #include "base/win/win_util.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 class PageState; | 33 class PageState; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace net { | 36 namespace net { |
| 37 class HostPortPair; | 37 class HostPortPair; |
| 38 class IPEndPoint; | 38 class IPEndPoint; |
| 39 class IPAddress; |
| 39 } | 40 } |
| 40 | 41 |
| 41 namespace IPC { | 42 namespace IPC { |
| 42 | 43 |
| 43 template <> | 44 template <> |
| 44 struct CONTENT_EXPORT ParamTraits<GURL> { | 45 struct CONTENT_EXPORT ParamTraits<GURL> { |
| 45 typedef GURL param_type; | 46 typedef GURL param_type; |
| 46 static void Write(Message* m, const param_type& p); | 47 static void Write(Message* m, const param_type& p); |
| 47 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); | 48 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); |
| 48 static void Log(const param_type& p, std::string* l); | 49 static void Log(const param_type& p, std::string* l); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 template <> | 68 template <> |
| 68 struct CONTENT_EXPORT ParamTraits<net::IPEndPoint> { | 69 struct CONTENT_EXPORT ParamTraits<net::IPEndPoint> { |
| 69 typedef net::IPEndPoint param_type; | 70 typedef net::IPEndPoint param_type; |
| 70 static void Write(Message* m, const param_type& p); | 71 static void Write(Message* m, const param_type& p); |
| 71 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); | 72 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); |
| 72 static void Log(const param_type& p, std::string* l); | 73 static void Log(const param_type& p, std::string* l); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 template <> | 76 template <> |
| 77 struct CONTENT_EXPORT ParamTraits<net::IPAddress> { |
| 78 typedef net::IPAddress param_type; |
| 79 static void Write(Message* m, const param_type& p); |
| 80 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); |
| 81 static void Log(const param_type& p, std::string* l); |
| 82 }; |
| 83 |
| 84 template <> |
| 76 struct CONTENT_EXPORT ParamTraits<content::PageState> { | 85 struct CONTENT_EXPORT ParamTraits<content::PageState> { |
| 77 typedef content::PageState param_type; | 86 typedef content::PageState param_type; |
| 78 static void Write(Message* m, const param_type& p); | 87 static void Write(Message* m, const param_type& p); |
| 79 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); | 88 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); |
| 80 static void Log(const param_type& p, std::string* l); | 89 static void Log(const param_type& p, std::string* l); |
| 81 }; | 90 }; |
| 82 | 91 |
| 83 template <> | 92 template <> |
| 84 struct ParamTraits<gfx::NativeWindow> { | 93 struct ParamTraits<gfx::NativeWindow> { |
| 85 typedef gfx::NativeWindow param_type; | 94 typedef gfx::NativeWindow param_type; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 108 #endif | 117 #endif |
| 109 } | 118 } |
| 110 static void Log(const param_type& p, std::string* l) { | 119 static void Log(const param_type& p, std::string* l) { |
| 111 l->append("<gfx::NativeWindow>"); | 120 l->append("<gfx::NativeWindow>"); |
| 112 } | 121 } |
| 113 }; | 122 }; |
| 114 | 123 |
| 115 } // namespace IPC | 124 } // namespace IPC |
| 116 | 125 |
| 117 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 126 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |