| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 case cc::DrawQuad::YUV_VIDEO_CONTENT: | 561 case cc::DrawQuad::YUV_VIDEO_CONTENT: |
| 562 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l); | 562 LogParam(*cc::YUVVideoDrawQuad::MaterialCast(quad), l); |
| 563 break; | 563 break; |
| 564 case cc::DrawQuad::INVALID: | 564 case cc::DrawQuad::INVALID: |
| 565 break; | 565 break; |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 l->append("])"); | 568 l->append("])"); |
| 569 } | 569 } |
| 570 | 570 |
| 571 void ParamTraits<cc::FrameSinkId>::GetSize(base::PickleSizer* s, |
| 572 const param_type& p) { |
| 573 GetParamSize(s, p.client_id()); |
| 574 GetParamSize(s, p.sink_id()); |
| 575 } |
| 576 |
| 577 void ParamTraits<cc::FrameSinkId>::Write(base::Pickle* m, const param_type& p) { |
| 578 WriteParam(m, p.client_id()); |
| 579 WriteParam(m, p.sink_id()); |
| 580 } |
| 581 |
| 582 bool ParamTraits<cc::FrameSinkId>::Read(const base::Pickle* m, |
| 583 base::PickleIterator* iter, |
| 584 param_type* p) { |
| 585 uint32_t client_id; |
| 586 if (!ReadParam(m, iter, &client_id)) |
| 587 return false; |
| 588 |
| 589 uint32_t sink_id; |
| 590 if (!ReadParam(m, iter, &sink_id)) |
| 591 return false; |
| 592 |
| 593 *p = cc::FrameSinkId(client_id, sink_id); |
| 594 return true; |
| 595 } |
| 596 |
| 597 void ParamTraits<cc::FrameSinkId>::Log(const param_type& p, std::string* l) { |
| 598 l->append("FrameSinkId("); |
| 599 LogParam(p.client_id(), l); |
| 600 l->append(", "); |
| 601 LogParam(p.sink_id(), l); |
| 602 l->append(")"); |
| 603 } |
| 604 |
| 571 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, | 605 void ParamTraits<cc::SurfaceId>::GetSize(base::PickleSizer* s, |
| 572 const param_type& p) { | 606 const param_type& p) { |
| 573 GetParamSize(s, p.client_id()); | 607 GetParamSize(s, p.frame_sink_id()); |
| 574 GetParamSize(s, p.local_id()); | 608 GetParamSize(s, p.local_id()); |
| 575 GetParamSize(s, p.nonce()); | 609 GetParamSize(s, p.nonce()); |
| 576 } | 610 } |
| 577 | 611 |
| 578 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { | 612 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { |
| 579 WriteParam(m, p.client_id()); | 613 WriteParam(m, p.frame_sink_id()); |
| 580 WriteParam(m, p.local_id()); | 614 WriteParam(m, p.local_id()); |
| 581 WriteParam(m, p.nonce()); | 615 WriteParam(m, p.nonce()); |
| 582 } | 616 } |
| 583 | 617 |
| 584 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, | 618 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, |
| 585 base::PickleIterator* iter, | 619 base::PickleIterator* iter, |
| 586 param_type* p) { | 620 param_type* p) { |
| 587 uint32_t client_id; | 621 cc::FrameSinkId frame_sink_id; |
| 588 if (!ReadParam(m, iter, &client_id)) | 622 if (!ReadParam(m, iter, &frame_sink_id)) |
| 589 return false; | 623 return false; |
| 590 | 624 |
| 591 uint32_t local_id; | 625 uint32_t local_id; |
| 592 if (!ReadParam(m, iter, &local_id)) | 626 if (!ReadParam(m, iter, &local_id)) |
| 593 return false; | 627 return false; |
| 594 | 628 |
| 595 uint64_t nonce; | 629 uint64_t nonce; |
| 596 if (!ReadParam(m, iter, &nonce)) | 630 if (!ReadParam(m, iter, &nonce)) |
| 597 return false; | 631 return false; |
| 598 | 632 |
| 599 *p = cc::SurfaceId(client_id, local_id, nonce); | 633 *p = cc::SurfaceId(frame_sink_id, local_id, nonce); |
| 600 return true; | 634 return true; |
| 601 } | 635 } |
| 602 | 636 |
| 603 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { | 637 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { |
| 604 l->append("SurfaceId("); | 638 l->append("SurfaceId("); |
| 605 LogParam(p.client_id(), l); | 639 LogParam(p.frame_sink_id(), l); |
| 606 l->append(", "); | 640 l->append(", "); |
| 607 LogParam(p.local_id(), l); | 641 LogParam(p.local_id(), l); |
| 608 l->append(", "); | 642 l->append(", "); |
| 609 LogParam(p.nonce(), l); | 643 LogParam(p.nonce(), l); |
| 610 l->append(")"); | 644 l->append(")"); |
| 611 } | 645 } |
| 612 | 646 |
| 613 namespace { | 647 namespace { |
| 614 enum CompositorFrameType { | 648 enum CompositorFrameType { |
| 615 NO_FRAME, | 649 NO_FRAME, |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 1003 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 970 #include "cc/ipc/cc_param_traits_macros.h" | 1004 #include "cc/ipc/cc_param_traits_macros.h" |
| 971 } // namespace IPC | 1005 } // namespace IPC |
| 972 | 1006 |
| 973 // Generate param traits log methods. | 1007 // Generate param traits log methods. |
| 974 #include "ipc/param_traits_log_macros.h" | 1008 #include "ipc/param_traits_log_macros.h" |
| 975 namespace IPC { | 1009 namespace IPC { |
| 976 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 1010 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ |
| 977 #include "cc/ipc/cc_param_traits_macros.h" | 1011 #include "cc/ipc/cc_param_traits_macros.h" |
| 978 } // namespace IPC | 1012 } // namespace IPC |
| OLD | NEW |