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 "cc/ipc/cc_param_traits.h" | 5 #include "cc/ipc/cc_param_traits.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 } | 595 } |
596 | 596 |
597 void ParamTraits<cc::FrameSinkId>::Log(const param_type& p, std::string* l) { | 597 void ParamTraits<cc::FrameSinkId>::Log(const param_type& p, std::string* l) { |
598 l->append("FrameSinkId("); | 598 l->append("FrameSinkId("); |
599 LogParam(p.client_id(), l); | 599 LogParam(p.client_id(), l); |
600 l->append(", "); | 600 l->append(", "); |
601 LogParam(p.sink_id(), l); | 601 LogParam(p.sink_id(), l); |
602 l->append(")"); | 602 l->append(")"); |
603 } | 603 } |
604 | 604 |
| 605 void ParamTraits<cc::LocalFrameId>::GetSize(base::PickleSizer* s, |
| 606 const param_type& p) { |
| 607 GetParamSize(s, p.local_id()); |
| 608 GetParamSize(s, p.nonce()); |
| 609 } |
| 610 |
| 611 void ParamTraits<cc::LocalFrameId>::Write(base::Pickle* m, |
| 612 const param_type& p) { |
| 613 WriteParam(m, p.local_id()); |
| 614 WriteParam(m, p.nonce()); |
| 615 } |
| 616 |
| 617 bool ParamTraits<cc::LocalFrameId>::Read(const base::Pickle* m, |
| 618 base::PickleIterator* iter, |
| 619 param_type* p) { |
| 620 uint32_t local_id; |
| 621 if (!ReadParam(m, iter, &local_id)) |
| 622 return false; |
| 623 |
| 624 uint64_t nonce; |
| 625 if (!ReadParam(m, iter, &nonce)) |
| 626 return false; |
| 627 |
| 628 *p = cc::LocalFrameId(local_id, nonce); |
| 629 return true; |
| 630 } |
| 631 |
| 632 void ParamTraits<cc::LocalFrameId>::Log(const param_type& p, std::string* l) { |
| 633 l->append("LocalFrameId("); |
| 634 LogParam(p.local_id(), l); |
| 635 l->append(", "); |
| 636 LogParam(p.nonce(), l); |
| 637 l->append(")"); |
| 638 } |
| 639 |
605 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, | 640 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, |
606 const param_type& p) { | 641 const param_type& p) { |
607 GetParamSize(s, p.frame_sink_id()); | 642 GetParamSize(s, p.frame_sink_id()); |
608 GetParamSize(s, p.local_id()); | 643 GetParamSize(s, p.local_frame_id()); |
609 GetParamSize(s, p.nonce()); | |
610 } | 644 } |
611 | 645 |
612 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { | 646 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { |
613 WriteParam(m, p.frame_sink_id()); | 647 WriteParam(m, p.frame_sink_id()); |
614 WriteParam(m, p.local_id()); | 648 WriteParam(m, p.local_frame_id()); |
615 WriteParam(m, p.nonce()); | |
616 } | 649 } |
617 | 650 |
618 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, | 651 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, |
619 base::PickleIterator* iter, | 652 base::PickleIterator* iter, |
620 param_type* p) { | 653 param_type* p) { |
621 cc::FrameSinkId frame_sink_id; | 654 cc::FrameSinkId frame_sink_id; |
622 if (!ReadParam(m, iter, &frame_sink_id)) | 655 if (!ReadParam(m, iter, &frame_sink_id)) |
623 return false; | 656 return false; |
624 | 657 |
625 uint32_t local_id; | 658 cc::LocalFrameId local_frame_id; |
626 if (!ReadParam(m, iter, &local_id)) | 659 if (!ReadParam(m, iter, &local_frame_id)) |
627 return false; | 660 return false; |
628 | 661 |
629 uint64_t nonce; | 662 *p = cc::SurfaceId(frame_sink_id, local_frame_id); |
630 if (!ReadParam(m, iter, &nonce)) | |
631 return false; | |
632 | |
633 *p = cc::SurfaceId(frame_sink_id, local_id, nonce); | |
634 return true; | 663 return true; |
635 } | 664 } |
636 | 665 |
637 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { | 666 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { |
638 l->append("SurfaceId("); | 667 l->append("SurfaceId("); |
639 LogParam(p.frame_sink_id(), l); | 668 LogParam(p.frame_sink_id(), l); |
640 l->append(", "); | 669 l->append(", "); |
641 LogParam(p.local_id(), l); | 670 LogParam(p.local_frame_id(), l); |
642 l->append(", "); | |
643 LogParam(p.nonce(), l); | |
644 l->append(")"); | 671 l->append(")"); |
645 } | 672 } |
646 | 673 |
647 namespace { | 674 namespace { |
648 enum CompositorFrameType { | 675 enum CompositorFrameType { |
649 NO_FRAME, | 676 NO_FRAME, |
650 DELEGATED_FRAME, | 677 DELEGATED_FRAME, |
651 GL_FRAME, | 678 GL_FRAME, |
652 }; | 679 }; |
653 } | 680 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 1030 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
1004 #include "cc/ipc/cc_param_traits_macros.h" | 1031 #include "cc/ipc/cc_param_traits_macros.h" |
1005 } // namespace IPC | 1032 } // namespace IPC |
1006 | 1033 |
1007 // Generate param traits log methods. | 1034 // Generate param traits log methods. |
1008 #include "ipc/param_traits_log_macros.h" | 1035 #include "ipc/param_traits_log_macros.h" |
1009 namespace IPC { | 1036 namespace IPC { |
1010 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 1037 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
1011 #include "cc/ipc/cc_param_traits_macros.h" | 1038 #include "cc/ipc/cc_param_traits_macros.h" |
1012 } // namespace IPC | 1039 } // namespace IPC |
OLD | NEW |