Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: ppapi/proxy/ppapi_param_traits.cc

Issue 11450025: Revert 171389 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppapi_param_traits.h ('k') | ppapi/proxy/ppb_flash_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // static 339 // static
340 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, 340 void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m,
341 const param_type& p) { 341 const param_type& p) {
342 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); 342 ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m);
343 switch (p.type()) { 343 switch (p.type()) {
344 case ppapi::proxy::SerializedHandle::SHARED_MEMORY: 344 case ppapi::proxy::SerializedHandle::SHARED_MEMORY:
345 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem()); 345 ParamTraits<base::SharedMemoryHandle>::Write(m, p.shmem());
346 break; 346 break;
347 case ppapi::proxy::SerializedHandle::SOCKET: 347 case ppapi::proxy::SerializedHandle::SOCKET:
348 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: 348 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE:
349 case ppapi::proxy::SerializedHandle::FILE:
349 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor()); 350 ParamTraits<IPC::PlatformFileForTransit>::Write(m, p.descriptor());
350 break; 351 break;
351 case ppapi::proxy::SerializedHandle::INVALID: 352 case ppapi::proxy::SerializedHandle::INVALID:
352 break; 353 break;
353 // No default so the compiler will warn on new types. 354 // No default so the compiler will warn on new types.
354 } 355 }
355 } 356 }
356 357
357 // static 358 // static
358 bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m, 359 bool ParamTraits<ppapi::proxy::SerializedHandle>::Read(const Message* m,
(...skipping 20 matching lines...) Expand all
379 break; 380 break;
380 } 381 }
381 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: { 382 case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: {
382 IPC::PlatformFileForTransit desc; 383 IPC::PlatformFileForTransit desc;
383 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) { 384 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) {
384 r->set_channel_handle(desc); 385 r->set_channel_handle(desc);
385 return true; 386 return true;
386 } 387 }
387 break; 388 break;
388 } 389 }
390 case ppapi::proxy::SerializedHandle::FILE: {
391 IPC::PlatformFileForTransit desc;
392 if (ParamTraits<IPC::PlatformFileForTransit>::Read(m, iter, &desc)) {
393 r->set_file_handle(desc);
394 return true;
395 }
396 break;
397 }
389 case ppapi::proxy::SerializedHandle::INVALID: 398 case ppapi::proxy::SerializedHandle::INVALID:
390 return true; 399 return true;
391 // No default so the compiler will warn us if a new type is added. 400 // No default so the compiler will warn us if a new type is added.
392 } 401 }
393 return false; 402 return false;
394 } 403 }
395 404
396 // static 405 // static
397 void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p, 406 void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p,
398 std::string* l) { 407 std::string* l) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 ParamTraits<int32_t>::Read(m, iter, &r->letter_spacing) && 554 ParamTraits<int32_t>::Read(m, iter, &r->letter_spacing) &&
546 ParamTraits<int32_t>::Read(m, iter, &r->word_spacing); 555 ParamTraits<int32_t>::Read(m, iter, &r->word_spacing);
547 } 556 }
548 557
549 // static 558 // static
550 void ParamTraits<ppapi::proxy::SerializedFontDescription>::Log( 559 void ParamTraits<ppapi::proxy::SerializedFontDescription>::Log(
551 const param_type& p, 560 const param_type& p,
552 std::string* l) { 561 std::string* l) {
553 } 562 }
554 563
564 // ppapi::PepperFilePath -------------------------------------------------------
565
566 // static
567 void ParamTraits<ppapi::PepperFilePath>::Write(Message* m,
568 const param_type& p) {
569 WriteParam(m, static_cast<unsigned>(p.domain()));
570 WriteParam(m, p.path());
571 }
572
573 // static
574 bool ParamTraits<ppapi::PepperFilePath>::Read(const Message* m,
575 PickleIterator* iter,
576 param_type* p) {
577 unsigned domain;
578 FilePath path;
579 if (!ReadParam(m, iter, &domain) || !ReadParam(m, iter, &path))
580 return false;
581 if (domain > ppapi::PepperFilePath::DOMAIN_MAX_VALID)
582 return false;
583
584 *p = ppapi::PepperFilePath(
585 static_cast<ppapi::PepperFilePath::Domain>(domain), path);
586 return true;
587 }
588
589 // static
590 void ParamTraits<ppapi::PepperFilePath>::Log(const param_type& p,
591 std::string* l) {
592 l->append("(");
593 LogParam(static_cast<unsigned>(p.domain()), l);
594 l->append(", ");
595 LogParam(p.path(), l);
596 l->append(")");
597 }
598
555 // SerializedFlashMenu --------------------------------------------------------- 599 // SerializedFlashMenu ---------------------------------------------------------
556 600
557 // static 601 // static
558 void ParamTraits<ppapi::proxy::SerializedFlashMenu>::Write( 602 void ParamTraits<ppapi::proxy::SerializedFlashMenu>::Write(
559 Message* m, 603 Message* m,
560 const param_type& p) { 604 const param_type& p) {
561 p.WriteToMessage(m); 605 p.WriteToMessage(m);
562 } 606 }
563 607
564 // static 608 // static
(...skipping 24 matching lines...) Expand all
589 param_type* r) { 633 param_type* r) {
590 return ParamTraits<ListValue>::Read(m, iter, &(r->values_)); 634 return ParamTraits<ListValue>::Read(m, iter, &(r->values_));
591 } 635 }
592 636
593 // static 637 // static
594 void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, 638 void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p,
595 std::string* l) { 639 std::string* l) {
596 } 640 }
597 641
598 } // namespace IPC 642 } // namespace IPC
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_param_traits.h ('k') | ppapi/proxy/ppb_flash_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698