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 |
11 // public members.. | 11 // public members.. |
12 | 12 |
13 #ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 13 #ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
14 #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
15 #pragma once | 15 #pragma once |
16 | 16 |
17 #include "base/platform_file.h" | 17 #include "base/platform_file.h" |
18 #include "base/ref_counted.h" | 18 #include "base/ref_counted.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "ipc/ipc_message_utils.h" | 20 #include "ipc/ipc_message_utils.h" |
| 21 #include "net/base/ip_endpoint.h" |
21 #include "net/url_request/url_request_status.h" | 22 #include "net/url_request/url_request_status.h" |
22 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! | 23 // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! |
23 // | 24 // |
24 // That means don't add #includes to any file in 'webkit/' or | 25 // That means don't add #includes to any file in 'webkit/' or |
25 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and | 26 // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and |
26 // content/common/ for a mini-library that doesn't depend on webkit. | 27 // content/common/ for a mini-library that doesn't depend on webkit. |
27 | 28 |
28 // TODO(erg): The following headers are historical and only work because | 29 // TODO(erg): The following headers are historical and only work because |
29 // their definitions are inlined, which also needs to be fixed. | 30 // their definitions are inlined, which also needs to be fixed. |
30 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 95 |
95 template <> | 96 template <> |
96 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { | 97 struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { |
97 typedef scoped_refptr<net::HttpResponseHeaders> param_type; | 98 typedef scoped_refptr<net::HttpResponseHeaders> param_type; |
98 static void Write(Message* m, const param_type& p); | 99 static void Write(Message* m, const param_type& p); |
99 static bool Read(const Message* m, void** iter, param_type* r); | 100 static bool Read(const Message* m, void** iter, param_type* r); |
100 static void Log(const param_type& p, std::string* l); | 101 static void Log(const param_type& p, std::string* l); |
101 }; | 102 }; |
102 | 103 |
103 template <> | 104 template <> |
| 105 struct ParamTraits<net::IPEndPoint> { |
| 106 typedef net::IPEndPoint param_type; |
| 107 static void Write(Message* m, const param_type& p); |
| 108 static bool Read(const Message* m, void** iter, param_type* p); |
| 109 static void Log(const param_type& p, std::string* l); |
| 110 }; |
| 111 |
| 112 template <> |
104 struct ParamTraits<webkit_glue::ResourceLoadTimingInfo> { | 113 struct ParamTraits<webkit_glue::ResourceLoadTimingInfo> { |
105 typedef webkit_glue::ResourceLoadTimingInfo param_type; | 114 typedef webkit_glue::ResourceLoadTimingInfo param_type; |
106 static void Write(Message* m, const param_type& p); | 115 static void Write(Message* m, const param_type& p); |
107 static bool Read(const Message* m, void** iter, param_type* r); | 116 static bool Read(const Message* m, void** iter, param_type* r); |
108 static void Log(const param_type& p, std::string* l); | 117 static void Log(const param_type& p, std::string* l); |
109 }; | 118 }; |
110 | 119 |
111 template <> | 120 template <> |
112 struct ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> > { | 121 struct ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> > { |
113 typedef scoped_refptr<webkit_glue::ResourceDevToolsInfo> param_type; | 122 typedef scoped_refptr<webkit_glue::ResourceDevToolsInfo> param_type; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 #endif | 190 #endif |
182 } | 191 } |
183 static void Log(const param_type& p, std::string* l) { | 192 static void Log(const param_type& p, std::string* l) { |
184 l->append("<gfx::NativeWindow>"); | 193 l->append("<gfx::NativeWindow>"); |
185 } | 194 } |
186 }; | 195 }; |
187 | 196 |
188 } // namespace IPC | 197 } // namespace IPC |
189 | 198 |
190 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ | 199 #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |