| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 612 } |
| 613 | 613 |
| 614 void ParamTraits<cc::FrameSinkId>::Log(const param_type& p, std::string* l) { | 614 void ParamTraits<cc::FrameSinkId>::Log(const param_type& p, std::string* l) { |
| 615 l->append("FrameSinkId("); | 615 l->append("FrameSinkId("); |
| 616 LogParam(p.client_id(), l); | 616 LogParam(p.client_id(), l); |
| 617 l->append(", "); | 617 l->append(", "); |
| 618 LogParam(p.sink_id(), l); | 618 LogParam(p.sink_id(), l); |
| 619 l->append(")"); | 619 l->append(")"); |
| 620 } | 620 } |
| 621 | 621 |
| 622 void ParamTraits<cc::LocalFrameId>::GetSize(base::PickleSizer* s, | 622 void ParamTraits<cc::LocalSurfaceId>::GetSize(base::PickleSizer* s, |
| 623 const param_type& p) { | 623 const param_type& p) { |
| 624 GetParamSize(s, p.local_id()); | 624 GetParamSize(s, p.local_id()); |
| 625 GetParamSize(s, p.nonce()); | 625 GetParamSize(s, p.nonce()); |
| 626 } | 626 } |
| 627 | 627 |
| 628 void ParamTraits<cc::LocalFrameId>::Write(base::Pickle* m, | 628 void ParamTraits<cc::LocalSurfaceId>::Write(base::Pickle* m, |
| 629 const param_type& p) { | 629 const param_type& p) { |
| 630 WriteParam(m, p.local_id()); | 630 WriteParam(m, p.local_id()); |
| 631 WriteParam(m, p.nonce()); | 631 WriteParam(m, p.nonce()); |
| 632 } | 632 } |
| 633 | 633 |
| 634 bool ParamTraits<cc::LocalFrameId>::Read(const base::Pickle* m, | 634 bool ParamTraits<cc::LocalSurfaceId>::Read(const base::Pickle* m, |
| 635 base::PickleIterator* iter, | 635 base::PickleIterator* iter, |
| 636 param_type* p) { | 636 param_type* p) { |
| 637 uint32_t local_id; | 637 uint32_t local_id; |
| 638 if (!ReadParam(m, iter, &local_id)) | 638 if (!ReadParam(m, iter, &local_id)) |
| 639 return false; | 639 return false; |
| 640 | 640 |
| 641 base::UnguessableToken nonce; | 641 base::UnguessableToken nonce; |
| 642 if (!ReadParam(m, iter, &nonce)) | 642 if (!ReadParam(m, iter, &nonce)) |
| 643 return false; | 643 return false; |
| 644 | 644 |
| 645 *p = cc::LocalFrameId(local_id, nonce); | 645 *p = cc::LocalSurfaceId(local_id, nonce); |
| 646 return true; | 646 return true; |
| 647 } | 647 } |
| 648 | 648 |
| 649 void ParamTraits<cc::LocalFrameId>::Log(const param_type& p, std::string* l) { | 649 void ParamTraits<cc::LocalSurfaceId>::Log(const param_type& p, std::string* l) { |
| 650 l->append("LocalFrameId("); | 650 l->append("LocalSurfaceId("); |
| 651 LogParam(p.local_id(), l); | 651 LogParam(p.local_id(), l); |
| 652 l->append(", "); | 652 l->append(", "); |
| 653 LogParam(p.nonce(), l); | 653 LogParam(p.nonce(), l); |
| 654 l->append(")"); | 654 l->append(")"); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, | 657 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, |
| 658 const param_type& p) { | 658 const param_type& p) { |
| 659 GetParamSize(s, p.frame_sink_id()); | 659 GetParamSize(s, p.frame_sink_id()); |
| 660 GetParamSize(s, p.local_frame_id()); | 660 GetParamSize(s, p.local_surface_id()); |
| 661 } | 661 } |
| 662 | 662 |
| 663 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { | 663 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { |
| 664 WriteParam(m, p.frame_sink_id()); | 664 WriteParam(m, p.frame_sink_id()); |
| 665 WriteParam(m, p.local_frame_id()); | 665 WriteParam(m, p.local_surface_id()); |
| 666 } | 666 } |
| 667 | 667 |
| 668 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, | 668 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, |
| 669 base::PickleIterator* iter, | 669 base::PickleIterator* iter, |
| 670 param_type* p) { | 670 param_type* p) { |
| 671 cc::FrameSinkId frame_sink_id; | 671 cc::FrameSinkId frame_sink_id; |
| 672 if (!ReadParam(m, iter, &frame_sink_id)) | 672 if (!ReadParam(m, iter, &frame_sink_id)) |
| 673 return false; | 673 return false; |
| 674 | 674 |
| 675 cc::LocalFrameId local_frame_id; | 675 cc::LocalSurfaceId local_surface_id; |
| 676 if (!ReadParam(m, iter, &local_frame_id)) | 676 if (!ReadParam(m, iter, &local_surface_id)) |
| 677 return false; | 677 return false; |
| 678 | 678 |
| 679 *p = cc::SurfaceId(frame_sink_id, local_frame_id); | 679 *p = cc::SurfaceId(frame_sink_id, local_surface_id); |
| 680 return true; | 680 return true; |
| 681 } | 681 } |
| 682 | 682 |
| 683 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { | 683 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { |
| 684 l->append("SurfaceId("); | 684 l->append("SurfaceId("); |
| 685 LogParam(p.frame_sink_id(), l); | 685 LogParam(p.frame_sink_id(), l); |
| 686 l->append(", "); | 686 l->append(", "); |
| 687 LogParam(p.local_frame_id(), l); | 687 LogParam(p.local_surface_id(), l); |
| 688 l->append(")"); | 688 l->append(")"); |
| 689 } | 689 } |
| 690 | 690 |
| 691 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m, | 691 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m, |
| 692 const param_type& p) { | 692 const param_type& p) { |
| 693 WriteParam(m, p.metadata); | 693 WriteParam(m, p.metadata); |
| 694 size_t to_reserve = 0u; | 694 size_t to_reserve = 0u; |
| 695 to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource); | 695 to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource); |
| 696 for (const auto& pass : p.render_pass_list) { | 696 for (const auto& pass : p.render_pass_list) { |
| 697 to_reserve += sizeof(size_t) * 2; | 697 to_reserve += sizeof(size_t) * 2; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 988 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 989 #include "cc/ipc/cc_param_traits_macros.h" | 989 #include "cc/ipc/cc_param_traits_macros.h" |
| 990 } // namespace IPC | 990 } // namespace IPC |
| 991 | 991 |
| 992 // Generate param traits log methods. | 992 // Generate param traits log methods. |
| 993 #include "ipc/param_traits_log_macros.h" | 993 #include "ipc/param_traits_log_macros.h" |
| 994 namespace IPC { | 994 namespace IPC { |
| 995 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 995 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 996 #include "cc/ipc/cc_param_traits_macros.h" | 996 #include "cc/ipc/cc_param_traits_macros.h" |
| 997 } // namespace IPC | 997 } // namespace IPC |
| OLD | NEW |