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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 struct Referrer; | 28 struct Referrer; |
29 } | 29 } |
30 | 30 |
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 } // namespace gfx | 37 } // namespace gfx |
37 | 38 |
38 namespace net { | 39 namespace net { |
39 class HostPortPair; | 40 class HostPortPair; |
40 } | 41 } |
41 | 42 |
42 namespace IPC { | 43 namespace IPC { |
43 | 44 |
44 template <> | 45 template <> |
45 struct CONTENT_EXPORT ParamTraits<GURL> { | 46 struct CONTENT_EXPORT ParamTraits<GURL> { |
(...skipping 29 matching lines...) Expand all Loading... |
75 | 76 |
76 template <> | 77 template <> |
77 struct CONTENT_EXPORT ParamTraits<gfx::Size> { | 78 struct CONTENT_EXPORT ParamTraits<gfx::Size> { |
78 typedef gfx::Size param_type; | 79 typedef gfx::Size param_type; |
79 static void Write(Message* m, const param_type& p); | 80 static void Write(Message* m, const param_type& p); |
80 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 81 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
81 static void Log(const param_type& p, std::string* l); | 82 static void Log(const param_type& p, std::string* l); |
82 }; | 83 }; |
83 | 84 |
84 template <> | 85 template <> |
| 86 struct CONTENT_EXPORT ParamTraits<gfx::Vector2d> { |
| 87 typedef gfx::Vector2d param_type; |
| 88 static void Write(Message* m, const param_type& p); |
| 89 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 90 static void Log(const param_type& p, std::string* l); |
| 91 }; |
| 92 |
| 93 template <> |
85 struct CONTENT_EXPORT ParamTraits<gfx::Rect> { | 94 struct CONTENT_EXPORT ParamTraits<gfx::Rect> { |
86 typedef gfx::Rect param_type; | 95 typedef gfx::Rect param_type; |
87 static void Write(Message* m, const param_type& p); | 96 static void Write(Message* m, const param_type& p); |
88 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 97 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
89 static void Log(const param_type& p, std::string* l); | 98 static void Log(const param_type& p, std::string* l); |
90 }; | 99 }; |
91 | 100 |
92 template <> | 101 template <> |
93 struct CONTENT_EXPORT ParamTraits<gfx::RectF> { | 102 struct CONTENT_EXPORT ParamTraits<gfx::RectF> { |
94 typedef gfx::RectF param_type; | 103 typedef gfx::RectF param_type; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Note: This function expects parameter |r| to be of type &SkBitmap since | 186 // Note: This function expects parameter |r| to be of type &SkBitmap since |
178 // r->SetConfig() and r->SetPixels() are called. | 187 // r->SetConfig() and r->SetPixels() are called. |
179 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 188 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
180 | 189 |
181 static void Log(const param_type& p, std::string* l); | 190 static void Log(const param_type& p, std::string* l); |
182 }; | 191 }; |
183 | 192 |
184 } // namespace IPC | 193 } // namespace IPC |
185 | 194 |
186 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 195 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |