| 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 20 matching lines...) Expand all Loading... |
| 31 namespace gfx { | 31 namespace gfx { |
| 32 class Point; | 32 class Point; |
| 33 class Rect; | 33 class Rect; |
| 34 class RectF; | 34 class RectF; |
| 35 class Size; | 35 class Size; |
| 36 class Vector2d; | 36 class Vector2d; |
| 37 } // namespace gfx | 37 } // namespace gfx |
| 38 | 38 |
| 39 namespace net { | 39 namespace net { |
| 40 class HostPortPair; | 40 class HostPortPair; |
| 41 class IPEndPoint; |
| 41 } | 42 } |
| 42 | 43 |
| 43 namespace IPC { | 44 namespace IPC { |
| 44 | 45 |
| 45 template <> | 46 template <> |
| 46 struct CONTENT_EXPORT ParamTraits<GURL> { | 47 struct CONTENT_EXPORT ParamTraits<GURL> { |
| 47 typedef GURL param_type; | 48 typedef GURL param_type; |
| 48 static void Write(Message* m, const param_type& p); | 49 static void Write(Message* m, const param_type& p); |
| 49 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 50 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 50 static void Log(const param_type& p, std::string* l); | 51 static void Log(const param_type& p, std::string* l); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 template<> | 54 template<> |
| 54 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { | 55 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { |
| 55 typedef net::HostPortPair param_type; | 56 typedef net::HostPortPair param_type; |
| 56 static void Write(Message* m, const param_type& p); | 57 static void Write(Message* m, const param_type& p); |
| 57 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 58 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 58 static void Log(const param_type& p, std::string* l); | 59 static void Log(const param_type& p, std::string* l); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 template <> | 62 template <> |
| 63 struct CONTENT_EXPORT ParamTraits<net::IPEndPoint> { |
| 64 typedef net::IPEndPoint param_type; |
| 65 static void Write(Message* m, const param_type& p); |
| 66 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 67 static void Log(const param_type& p, std::string* l); |
| 68 }; |
| 69 |
| 70 template <> |
| 62 struct CONTENT_EXPORT ParamTraits<content::PageState> { | 71 struct CONTENT_EXPORT ParamTraits<content::PageState> { |
| 63 typedef content::PageState param_type; | 72 typedef content::PageState param_type; |
| 64 static void Write(Message* m, const param_type& p); | 73 static void Write(Message* m, const param_type& p); |
| 65 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 74 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 66 static void Log(const param_type& p, std::string* l); | 75 static void Log(const param_type& p, std::string* l); |
| 67 }; | 76 }; |
| 68 | 77 |
| 69 template <> | 78 template <> |
| 70 struct CONTENT_EXPORT ParamTraits<gfx::Point> { | 79 struct CONTENT_EXPORT ParamTraits<gfx::Point> { |
| 71 typedef gfx::Point param_type; | 80 typedef gfx::Point param_type; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Note: This function expects parameter |r| to be of type &SkBitmap since | 219 // Note: This function expects parameter |r| to be of type &SkBitmap since |
| 211 // r->SetConfig() and r->SetPixels() are called. | 220 // r->SetConfig() and r->SetPixels() are called. |
| 212 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 221 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 213 | 222 |
| 214 static void Log(const param_type& p, std::string* l); | 223 static void Log(const param_type& p, std::string* l); |
| 215 }; | 224 }; |
| 216 | 225 |
| 217 } // namespace IPC | 226 } // namespace IPC |
| 218 | 227 |
| 219 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 228 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |