| 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 29 matching lines...) Expand all Loading... |
| 40 namespace net { | 40 namespace net { |
| 41 class HttpResponseHeaders; | 41 class HttpResponseHeaders; |
| 42 class HostPortPair; | 42 class HostPortPair; |
| 43 class UploadData; | 43 class UploadData; |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace ui { | 46 namespace ui { |
| 47 class Range; | 47 class Range; |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace webkit_glue { |
| 51 class ResourceRequestBody; |
| 52 } |
| 53 |
| 50 namespace IPC { | 54 namespace IPC { |
| 51 | 55 |
| 52 template <> | 56 template <> |
| 53 struct CONTENT_EXPORT ParamTraits<GURL> { | 57 struct CONTENT_EXPORT ParamTraits<GURL> { |
| 54 typedef GURL param_type; | 58 typedef GURL param_type; |
| 55 static void Write(Message* m, const param_type& p); | 59 static void Write(Message* m, const param_type& p); |
| 56 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 60 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| 57 static void Log(const param_type& p, std::string* l); | 61 static void Log(const param_type& p, std::string* l); |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 template <> | 64 template <> |
| 61 struct CONTENT_EXPORT ParamTraits<net::URLRequestStatus> { | 65 struct CONTENT_EXPORT ParamTraits<net::URLRequestStatus> { |
| 62 typedef net::URLRequestStatus param_type; | 66 typedef net::URLRequestStatus param_type; |
| 63 static void Write(Message* m, const param_type& p); | 67 static void Write(Message* m, const param_type& p); |
| 64 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 68 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 65 static void Log(const param_type& p, std::string* l); | 69 static void Log(const param_type& p, std::string* l); |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 template <> | 72 template <> |
| 69 struct CONTENT_EXPORT ParamTraits<scoped_refptr<net::UploadData> > { | 73 struct CONTENT_EXPORT ParamTraits<scoped_refptr<net::UploadData> > { |
| 70 typedef scoped_refptr<net::UploadData> param_type; | 74 typedef scoped_refptr<net::UploadData> param_type; |
| 71 static void Write(Message* m, const param_type& p); | 75 static void Write(Message* m, const param_type& p); |
| 72 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 76 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 73 static void Log(const param_type& p, std::string* l); | 77 static void Log(const param_type& p, std::string* l); |
| 74 }; | 78 }; |
| 75 | 79 |
| 80 template <> |
| 81 struct CONTENT_EXPORT ParamTraits<scoped_refptr< |
| 82 webkit_glue::ResourceRequestBody> > { |
| 83 typedef scoped_refptr<webkit_glue::ResourceRequestBody> param_type; |
| 84 static void Write(Message* m, const param_type& p); |
| 85 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 86 static void Log(const param_type& p, std::string* l); |
| 87 }; |
| 88 |
| 76 template<> | 89 template<> |
| 77 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { | 90 struct CONTENT_EXPORT ParamTraits<net::HostPortPair> { |
| 78 typedef net::HostPortPair param_type; | 91 typedef net::HostPortPair param_type; |
| 79 static void Write(Message* m, const param_type& p); | 92 static void Write(Message* m, const param_type& p); |
| 80 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 93 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 81 static void Log(const param_type& p, std::string* l); | 94 static void Log(const param_type& p, std::string* l); |
| 82 }; | 95 }; |
| 83 | 96 |
| 84 template <> | 97 template <> |
| 85 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { | 98 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // Note: This function expects parameter |r| to be of type &SkBitmap since | 238 // Note: This function expects parameter |r| to be of type &SkBitmap since |
| 226 // r->SetConfig() and r->SetPixels() are called. | 239 // r->SetConfig() and r->SetPixels() are called. |
| 227 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 240 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 228 | 241 |
| 229 static void Log(const param_type& p, std::string* l); | 242 static void Log(const param_type& p, std::string* l); |
| 230 }; | 243 }; |
| 231 | 244 |
| 232 } // namespace IPC | 245 } // namespace IPC |
| 233 | 246 |
| 234 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 247 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
| OLD | NEW |