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 #include "content/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
10 #include "content/public/common/message_port.h" | |
10 #include "content/public/common/page_state.h" | 11 #include "content/public/common/page_state.h" |
11 #include "content/public/common/referrer.h" | 12 #include "content/public/common/referrer.h" |
13 #include "ipc/ipc_mojo_param_traits.h" | |
12 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
13 #include "net/base/ip_address.h" | 15 #include "net/base/ip_address.h" |
14 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
15 | 17 |
16 namespace IPC { | 18 namespace IPC { |
17 | 19 |
18 void ParamTraits<url::Origin>::GetSize(base::PickleSizer* s, | 20 void ParamTraits<url::Origin>::GetSize(base::PickleSizer* s, |
19 const param_type& p) { | 21 const param_type& p) { |
20 GetParamSize(s, p.unique()); | 22 GetParamSize(s, p.unique()); |
21 GetParamSize(s, p.scheme()); | 23 GetParamSize(s, p.scheme()); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 return false; | 141 return false; |
140 } | 142 } |
141 *p = net::IPAddress(bytes); | 143 *p = net::IPAddress(bytes); |
142 return true; | 144 return true; |
143 } | 145 } |
144 | 146 |
145 void ParamTraits<net::IPAddress>::Log(const param_type& p, std::string* l) { | 147 void ParamTraits<net::IPAddress>::Log(const param_type& p, std::string* l) { |
146 LogParam("IPAddress:" + (p.empty() ? "(empty)" : p.ToString()), l); | 148 LogParam("IPAddress:" + (p.empty() ? "(empty)" : p.ToString()), l); |
147 } | 149 } |
148 | 150 |
151 void ParamTraits<content::MessagePort>::GetSize(base::PickleSizer* s, | |
152 const param_type& p) { | |
jam
2017/01/23 18:08:56
nit: indentation here, 157, 173
| |
153 ParamTraits<mojo::MessagePipeHandle>::GetSize(s, p.GetHandle().get()); | |
154 } | |
155 | |
156 void ParamTraits<content::MessagePort>::Write(base::Pickle* m, | |
157 const param_type& p) { | |
158 ParamTraits<mojo::MessagePipeHandle>::Write(m, p.ReleaseHandle().release()); | |
159 } | |
160 | |
161 bool ParamTraits<content::MessagePort>::Read( | |
162 const base::Pickle* m, | |
163 base::PickleIterator* iter, | |
164 param_type* r) { | |
165 mojo::MessagePipeHandle handle; | |
166 if (!ParamTraits<mojo::MessagePipeHandle>::Read(m, iter, &handle)) | |
167 return false; | |
168 *r = content::MessagePort(mojo::ScopedMessagePipeHandle(handle)); | |
169 return true; | |
170 } | |
171 | |
172 void ParamTraits<content::MessagePort>::Log( | |
173 const param_type& p, std::string* l) { | |
174 } | |
175 | |
149 void ParamTraits<content::PageState>::GetSize(base::PickleSizer* s, | 176 void ParamTraits<content::PageState>::GetSize(base::PickleSizer* s, |
150 const param_type& p) { | 177 const param_type& p) { |
151 GetParamSize(s, p.ToEncodedData()); | 178 GetParamSize(s, p.ToEncodedData()); |
152 } | 179 } |
153 | 180 |
154 void ParamTraits<content::PageState>::Write(base::Pickle* m, | 181 void ParamTraits<content::PageState>::Write(base::Pickle* m, |
155 const param_type& p) { | 182 const param_type& p) { |
156 WriteParam(m, p.ToEncodedData()); | 183 WriteParam(m, p.ToEncodedData()); |
157 } | 184 } |
158 | 185 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 222 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
196 #include "content/public/common/common_param_traits_macros.h" | 223 #include "content/public/common/common_param_traits_macros.h" |
197 } // namespace IPC | 224 } // namespace IPC |
198 | 225 |
199 // Generate param traits log methods. | 226 // Generate param traits log methods. |
200 #include "ipc/param_traits_log_macros.h" | 227 #include "ipc/param_traits_log_macros.h" |
201 namespace IPC { | 228 namespace IPC { |
202 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 229 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
203 #include "content/public/common/common_param_traits_macros.h" | 230 #include "content/public/common/common_param_traits_macros.h" |
204 } // namespace IPC | 231 } // namespace IPC |
OLD | NEW |