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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 param_type* r) { | 305 param_type* r) { |
306 return ReadVectorWithoutCopy(m, iter, r); | 306 return ReadVectorWithoutCopy(m, iter, r); |
307 } | 307 } |
308 | 308 |
309 // static | 309 // static |
310 void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Log( | 310 void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Log( |
311 const param_type& p, | 311 const param_type& p, |
312 std::string* l) { | 312 std::string* l) { |
313 } | 313 } |
314 | 314 |
315 #if !defined(OS_NACL) | 315 // SerializedHandle ------------------------------------------------------------ |
| 316 |
| 317 // static |
| 318 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, |
| 319 const param_type& p) { |
| 320 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); |
| 321 switch (p.type()) { |
| 322 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: |
| 323 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem()); |
| 324 break; |
| 325 case ppapi::proxy::SerializedHandle::SOCKET: |
| 326 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor()); |
| 327 break; |
| 328 case ppapi::proxy::SerializedHandle::INVALID: |
| 329 break; |
| 330 // No default so the compiler will warn on new types. |
| 331 } |
| 332 } |
| 333 |
| 334 // static |
| 335 bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m, |
| 336 PickleIterator* iter, |
| 337 param_type* r) { |
| 338 ppapi::proxy::SerializedHandle::Header header; |
| 339 if (!ppapi::proxy::SerializedHandle::ReadHeader(iter, &header)) |
| 340 return false; |
| 341 switch (header.type) { |
| 342 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: { |
| 343 base::SharedMemoryHandle handle; |
| 344 if (ParamTraits<base::SharedMemoryHandle>::Read(m, iter, &handle)) { |
| 345 r->set_shmem(handle, header.size); |
| 346 return true; |
| 347 } |
| 348 break; |
| 349 } |
| 350 case ppapi::proxy::SerializedHandle::SOCKET: { |
| 351 IPC::PlatformFileForTransit socket; |
| 352 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &socket)) { |
| 353 r->set_socket(socket); |
| 354 return true; |
| 355 } |
| 356 break; |
| 357 } |
| 358 case ppapi::proxy::SerializedHandle::INVALID: |
| 359 return true; |
| 360 // No default so the compiler will warn us if a new type is added. |
| 361 } |
| 362 return false; |
| 363 } |
| 364 |
| 365 // static |
| 366 void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p, |
| 367 std::string* l) { |
| 368 } |
| 369 |
| 370 #if !defined(OS_NACL) && !defined(NACL_WIN64) |
316 // PPBFlash_DrawGlyphs_Params -------------------------------------------------- | 371 // PPBFlash_DrawGlyphs_Params -------------------------------------------------- |
317 // static | 372 // static |
318 void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write( | 373 void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write( |
319 Message* m, | 374 Message* m, |
320 const param_type& p) { | 375 const param_type& p) { |
321 ParamTraits<PP_Instance>::Write(m, p.instance); | 376 ParamTraits<PP_Instance>::Write(m, p.instance); |
322 ParamTraits<ppapi::HostResource>::Write(m, p.image_data); | 377 ParamTraits<ppapi::HostResource>::Write(m, p.image_data); |
323 ParamTraits<ppapi::proxy::SerializedFontDescription>::Write(m, p.font_desc); | 378 ParamTraits<ppapi::proxy::SerializedFontDescription>::Write(m, p.font_desc); |
324 ParamTraits<uint32_t>::Write(m, p.color); | 379 ParamTraits<uint32_t>::Write(m, p.color); |
325 ParamTraits<PP_Point>::Write(m, p.position); | 380 ParamTraits<PP_Point>::Write(m, p.position); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 bool ParamTraits<ppapi::PPB_X509Certificate_Fields>::Read(const Message* m, | 555 bool ParamTraits<ppapi::PPB_X509Certificate_Fields>::Read(const Message* m, |
501 PickleIterator* iter, | 556 PickleIterator* iter, |
502 param_type* r) { | 557 param_type* r) { |
503 return ParamTraits<ListValue>::Read(m, iter, &(r->values_)); | 558 return ParamTraits<ListValue>::Read(m, iter, &(r->values_)); |
504 } | 559 } |
505 | 560 |
506 // static | 561 // static |
507 void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, | 562 void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, |
508 std::string* l) { | 563 std::string* l) { |
509 } | 564 } |
510 #endif // !defined(OS_NACL) | 565 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
511 | 566 |
512 } // namespace IPC | 567 } // namespace IPC |
OLD | NEW |