| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 // static | 317 // static |
| 318 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, | 318 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, |
| 319 const param_type& p) { | 319 const param_type& p) { |
| 320 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); | 320 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); |
| 321 switch (p.type()) { | 321 switch (p.type()) { |
| 322 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: | 322 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: |
| 323 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem()); | 323 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem()); |
| 324 break; | 324 break; |
| 325 case ppapi::proxy::SerializedHandle::SOCKET: | 325 case ppapi::proxy::SerializedHandle::SOCKET: |
| 326 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: |
| 326 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor()); | 327 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor()); |
| 327 break; | 328 break; |
| 328 case ppapi::proxy::SerializedHandle::INVALID: | 329 case ppapi::proxy::SerializedHandle::INVALID: |
| 329 break; | 330 break; |
| 330 // No default so the compiler will warn on new types. | 331 // No default so the compiler will warn on new types. |
| 331 } | 332 } |
| 332 } | 333 } |
| 333 | 334 |
| 334 // static | 335 // static |
| 335 bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m, | 336 bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 348 break; | 349 break; |
| 349 } | 350 } |
| 350 case ppapi::proxy::SerializedHandle::SOCKET: { | 351 case ppapi::proxy::SerializedHandle::SOCKET: { |
| 351 IPC::PlatformFileForTransit socket; | 352 IPC::PlatformFileForTransit socket; |
| 352 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &socket)) { | 353 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &socket)) { |
| 353 r->set_socket(socket); | 354 r->set_socket(socket); |
| 354 return true; | 355 return true; |
| 355 } | 356 } |
| 356 break; | 357 break; |
| 357 } | 358 } |
| 359 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { |
| 360 IPC::PlatformFileForTransit desc; |
| 361 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) { |
| 362 r->set_channel_handle(desc); |
| 363 return true; |
| 364 } |
| 365 break; |
| 366 } |
| 358 case ppapi::proxy::SerializedHandle::INVALID: | 367 case ppapi::proxy::SerializedHandle::INVALID: |
| 359 return true; | 368 return true; |
| 360 // No default so the compiler will warn us if a new type is added. | 369 // No default so the compiler will warn us if a new type is added. |
| 361 } | 370 } |
| 362 return false; | 371 return false; |
| 363 } | 372 } |
| 364 | 373 |
| 365 // static | 374 // static |
| 366 void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p, | 375 void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p, |
| 367 std::string* l) { | 376 std::string* l) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 return ParamTraits<ListValue>::Read(m, iter, &(r->values_)); | 567 return ParamTraits<ListValue>::Read(m, iter, &(r->values_)); |
| 559 } | 568 } |
| 560 | 569 |
| 561 // static | 570 // static |
| 562 void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, | 571 void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, |
| 563 std::string* l) { | 572 std::string* l) { |
| 564 } | 573 } |
| 565 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) | 574 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
| 566 | 575 |
| 567 } // namespace IPC | 576 } // namespace IPC |
| OLD | NEW |