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 20 matching lines...) Expand all Loading... |
31 class Rect; | 31 class Rect; |
32 class Size; | 32 class Size; |
33 } // namespace gfx | 33 } // namespace gfx |
34 | 34 |
35 namespace net { | 35 namespace net { |
36 class HttpResponseHeaders; | 36 class HttpResponseHeaders; |
37 class HostPortPair; | 37 class HostPortPair; |
38 class UploadData; | 38 class UploadData; |
39 } | 39 } |
40 | 40 |
| 41 namespace ui { |
| 42 class Range; |
| 43 } |
| 44 |
41 namespace IPC { | 45 namespace IPC { |
42 | 46 |
43 template <> | 47 template <> |
44 struct ParamTraits<GURL> { | 48 struct ParamTraits<GURL> { |
45 typedef GURL param_type; | 49 typedef GURL param_type; |
46 static void Write(Message* m, const param_type& p); | 50 static void Write(Message* m, const param_type& p); |
47 static bool Read(const Message* m, void** iter, param_type* p); | 51 static bool Read(const Message* m, void** iter, param_type* p); |
48 static void Log(const param_type& p, std::string* l); | 52 static void Log(const param_type& p, std::string* l); |
49 }; | 53 }; |
50 | 54 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 NOTREACHED(); | 162 NOTREACHED(); |
159 } | 163 } |
160 return result; | 164 return result; |
161 #endif | 165 #endif |
162 } | 166 } |
163 static void Log(const param_type& p, std::string* l) { | 167 static void Log(const param_type& p, std::string* l) { |
164 l->append("<gfx::NativeWindow>"); | 168 l->append("<gfx::NativeWindow>"); |
165 } | 169 } |
166 }; | 170 }; |
167 | 171 |
| 172 template <> |
| 173 struct ParamTraits<ui::Range> { |
| 174 typedef ui::Range param_type; |
| 175 static void Write(Message* m, const param_type& p); |
| 176 static bool Read(const Message* m, void** iter, param_type* r); |
| 177 static void Log(const param_type& p, std::string* l); |
| 178 }; |
| 179 |
168 #if defined(OS_WIN) | 180 #if defined(OS_WIN) |
169 template<> | 181 template<> |
170 struct ParamTraits<TransportDIB::Id> { | 182 struct ParamTraits<TransportDIB::Id> { |
171 typedef TransportDIB::Id param_type; | 183 typedef TransportDIB::Id param_type; |
172 static void Write(Message* m, const param_type& p) { | 184 static void Write(Message* m, const param_type& p) { |
173 WriteParam(m, p.handle); | 185 WriteParam(m, p.handle); |
174 WriteParam(m, p.sequence_num); | 186 WriteParam(m, p.sequence_num); |
175 } | 187 } |
176 static bool Read(const Message* m, void** iter, param_type* r) { | 188 static bool Read(const Message* m, void** iter, param_type* r) { |
177 return (ReadParam(m, iter, &r->handle) && | 189 return (ReadParam(m, iter, &r->handle) && |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Note: This function expects parameter |r| to be of type &SkBitmap since | 225 // Note: This function expects parameter |r| to be of type &SkBitmap since |
214 // r->SetConfig() and r->SetPixels() are called. | 226 // r->SetConfig() and r->SetPixels() are called. |
215 static bool Read(const Message* m, void** iter, param_type* r); | 227 static bool Read(const Message* m, void** iter, param_type* r); |
216 | 228 |
217 static void Log(const param_type& p, std::string* l); | 229 static void Log(const param_type& p, std::string* l); |
218 }; | 230 }; |
219 | 231 |
220 } // namespace IPC | 232 } // namespace IPC |
221 | 233 |
222 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 234 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |