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 "ppapi/proxy/ppapi_param_traits.h" | 5 #include "ppapi/proxy/ppapi_param_traits.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include "ppapi/c/pp_file_info.h" | 9 #include "ppapi/c/pp_file_info.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 // static | 170 // static |
171 void ParamTraits<PP_NetAddress_Private>::Log(const param_type& p, | 171 void ParamTraits<PP_NetAddress_Private>::Log(const param_type& p, |
172 std::string* l) { | 172 std::string* l) { |
173 l->append("<PP_NetAddress_Private ("); | 173 l->append("<PP_NetAddress_Private ("); |
174 LogParam(p.size, l); | 174 LogParam(p.size, l); |
175 l->append(" bytes)>"); | 175 l->append(" bytes)>"); |
176 } | 176 } |
177 | 177 |
178 // TODO(teravest): Remove this when FileRef is moved to the "new" proxy. | |
179 // PPB_FileRef_CreateInfo ------------------------------------------------------ | |
180 | |
181 // static | |
182 void ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Write(Message* m, | |
183 const param_type& p) { | |
184 ParamTraits<ppapi::HostResource>::Write(m, p.resource); | |
185 ParamTraits<int>::Write(m, p.file_system_type); | |
186 ParamTraits<std::string>::Write(m, p.path); | |
187 ParamTraits<std::string>::Write(m, p.name); | |
188 ParamTraits<PP_Resource>::Write(m, p.file_system_plugin_resource); | |
189 } | |
190 | |
191 // static | |
192 bool ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Read(const Message* m, | |
193 PickleIterator* iter, | |
194 param_type* r) { | |
195 return | |
196 ParamTraits<ppapi::HostResource>::Read(m, iter, &r->resource) && | |
197 ParamTraits<int>::Read(m, iter, &r->file_system_type) && | |
198 ParamTraits<std::string>::Read(m, iter, &r->path) && | |
199 ParamTraits<std::string>::Read(m, iter, &r->name) && | |
200 ParamTraits<PP_Resource>::Read(m, iter, &r->file_system_plugin_resource); | |
201 } | |
202 | |
203 // static | |
204 void ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Log(const param_type& p, | |
205 std::string* l) { | |
206 } | |
207 | |
208 // HostResource ---------------------------------------------------------------- | 178 // HostResource ---------------------------------------------------------------- |
209 | 179 |
210 // static | 180 // static |
211 void ParamTraits<ppapi::HostResource>::Write(Message* m, | 181 void ParamTraits<ppapi::HostResource>::Write(Message* m, |
212 const param_type& p) { | 182 const param_type& p) { |
213 ParamTraits<PP_Instance>::Write(m, p.instance()); | 183 ParamTraits<PP_Instance>::Write(m, p.instance()); |
214 ParamTraits<PP_Resource>::Write(m, p.host_resource()); | 184 ParamTraits<PP_Resource>::Write(m, p.host_resource()); |
215 } | 185 } |
216 | 186 |
217 // static | 187 // static |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 param_type* r) { | 237 param_type* r) { |
268 return ReadVectorWithoutCopy(m, iter, r); | 238 return ReadVectorWithoutCopy(m, iter, r); |
269 } | 239 } |
270 | 240 |
271 // static | 241 // static |
272 void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( | 242 void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( |
273 const param_type& p, | 243 const param_type& p, |
274 std::string* l) { | 244 std::string* l) { |
275 } | 245 } |
276 | 246 |
277 // std::vector<PPB_FileRef_CreateInfo> ----------------------------------------- | |
278 | |
279 void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Write( | |
280 Message* m, | |
281 const param_type& p) { | |
282 WriteVectorWithoutCopy(m, p); | |
283 } | |
284 | |
285 // static | |
286 bool ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Read( | |
287 const Message* m, | |
288 PickleIterator* iter, | |
289 param_type* r) { | |
290 return ReadVectorWithoutCopy(m, iter, r); | |
291 } | |
292 | |
293 // static | |
294 void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Log( | |
295 const param_type& p, | |
296 std::string* l) { | |
297 } | |
298 | |
299 // ppapi::PpapiPermissions ----------------------------------------------------- | 247 // ppapi::PpapiPermissions ----------------------------------------------------- |
300 | 248 |
301 void ParamTraits<ppapi::PpapiPermissions>::Write(Message* m, | 249 void ParamTraits<ppapi::PpapiPermissions>::Write(Message* m, |
302 const param_type& p) { | 250 const param_type& p) { |
303 ParamTraits<uint32_t>::Write(m, p.GetBits()); | 251 ParamTraits<uint32_t>::Write(m, p.GetBits()); |
304 } | 252 } |
305 | 253 |
306 // static | 254 // static |
307 bool ParamTraits<ppapi::PpapiPermissions>::Read(const Message* m, | 255 bool ParamTraits<ppapi::PpapiPermissions>::Read(const Message* m, |
308 PickleIterator* iter, | 256 PickleIterator* iter, |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 679 } |
732 return false; | 680 return false; |
733 } | 681 } |
734 | 682 |
735 // static | 683 // static |
736 void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, | 684 void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, |
737 std::string* l) { | 685 std::string* l) { |
738 } | 686 } |
739 | 687 |
740 } // namespace IPC | 688 } // namespace IPC |
OLD | NEW |