| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 static void Log(const param_type& p, std::string* l) { | 197 static void Log(const param_type& p, std::string* l) { |
| 198 l->append("TransportDIB("); | 198 l->append("TransportDIB("); |
| 199 LogParam(p.handle, l); | 199 LogParam(p.handle, l); |
| 200 l->append(", "); | 200 l->append(", "); |
| 201 LogParam(p.sequence_num, l); | 201 LogParam(p.sequence_num, l); |
| 202 l->append(")"); | 202 l->append(")"); |
| 203 } | 203 } |
| 204 }; | 204 }; |
| 205 #endif | 205 #endif |
| 206 | 206 |
| 207 #if defined(TOOLKIT_GTK) | |
| 208 template<> | |
| 209 struct ParamTraits<TransportDIB::Id> { | |
| 210 typedef TransportDIB::Id param_type; | |
| 211 static void Write(Message* m, const param_type& p) { | |
| 212 WriteParam(m, p.shmkey); | |
| 213 } | |
| 214 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | |
| 215 return ReadParam(m, iter, &r->shmkey); | |
| 216 } | |
| 217 static void Log(const param_type& p, std::string* l) { | |
| 218 l->append("TransportDIB("); | |
| 219 LogParam(p.shmkey, l); | |
| 220 l->append(")"); | |
| 221 } | |
| 222 }; | |
| 223 #endif | |
| 224 | |
| 225 template <> | 207 template <> |
| 226 struct CONTENT_EXPORT ParamTraits<SkBitmap> { | 208 struct CONTENT_EXPORT ParamTraits<SkBitmap> { |
| 227 typedef SkBitmap param_type; | 209 typedef SkBitmap param_type; |
| 228 static void Write(Message* m, const param_type& p); | 210 static void Write(Message* m, const param_type& p); |
| 229 | 211 |
| 230 // Note: This function expects parameter |r| to be of type &SkBitmap since | 212 // Note: This function expects parameter |r| to be of type &SkBitmap since |
| 231 // r->SetConfig() and r->SetPixels() are called. | 213 // r->SetConfig() and r->SetPixels() are called. |
| 232 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 214 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 233 | 215 |
| 234 static void Log(const param_type& p, std::string* l); | 216 static void Log(const param_type& p, std::string* l); |
| 235 }; | 217 }; |
| 236 | 218 |
| 237 } // namespace IPC | 219 } // namespace IPC |
| 238 | 220 |
| 239 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 221 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |