| 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.client_id()); | 
|  | 608   GetParamSize(s, p.sink_id()); | 
| 574   GetParamSize(s, p.local_id()); | 609   GetParamSize(s, p.local_id()); | 
| 575   GetParamSize(s, p.nonce()); | 610   GetParamSize(s, p.nonce()); | 
| 576 } | 611 } | 
| 577 | 612 | 
| 578 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { | 613 void ParamTraits<cc::SurfaceId>::Write(base::Pickle* m, const param_type& p) { | 
| 579   WriteParam(m, p.client_id()); | 614   WriteParam(m, p.client_id()); | 
|  | 615   WriteParam(m, p.sink_id()); | 
| 580   WriteParam(m, p.local_id()); | 616   WriteParam(m, p.local_id()); | 
| 581   WriteParam(m, p.nonce()); | 617   WriteParam(m, p.nonce()); | 
| 582 } | 618 } | 
| 583 | 619 | 
| 584 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, | 620 bool ParamTraits<cc::SurfaceId>::Read(const base::Pickle* m, | 
| 585                                       base::PickleIterator* iter, | 621                                       base::PickleIterator* iter, | 
| 586                                       param_type* p) { | 622                                       param_type* p) { | 
| 587   uint32_t client_id; | 623   uint32_t client_id; | 
| 588   if (!ReadParam(m, iter, &client_id)) | 624   if (!ReadParam(m, iter, &client_id)) | 
| 589     return false; | 625     return false; | 
| 590 | 626 | 
|  | 627   uint32_t sink_id; | 
|  | 628   if (!ReadParam(m, iter, &sink_id)) | 
|  | 629     return false; | 
|  | 630 | 
| 591   uint32_t local_id; | 631   uint32_t local_id; | 
| 592   if (!ReadParam(m, iter, &local_id)) | 632   if (!ReadParam(m, iter, &local_id)) | 
| 593     return false; | 633     return false; | 
| 594 | 634 | 
| 595   uint64_t nonce; | 635   uint64_t nonce; | 
| 596   if (!ReadParam(m, iter, &nonce)) | 636   if (!ReadParam(m, iter, &nonce)) | 
| 597     return false; | 637     return false; | 
| 598 | 638 | 
| 599   *p = cc::SurfaceId(client_id, local_id, nonce); | 639   *p = cc::SurfaceId(cc::FrameSinkId(client_id, sink_id), local_id, nonce); | 
| 600   return true; | 640   return true; | 
| 601 } | 641 } | 
| 602 | 642 | 
| 603 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { | 643 void ParamTraits<cc::SurfaceId>::Log(const param_type& p, std::string* l) { | 
| 604   l->append("SurfaceId("); | 644   l->append("SurfaceId("); | 
| 605   LogParam(p.client_id(), l); | 645   LogParam(p.client_id(), l); | 
| 606   l->append(", "); | 646   l->append(", "); | 
|  | 647   LogParam(p.sink_id(), l); | 
|  | 648   l->append(", "); | 
| 607   LogParam(p.local_id(), l); | 649   LogParam(p.local_id(), l); | 
| 608   l->append(", "); | 650   l->append(", "); | 
| 609   LogParam(p.nonce(), l); | 651   LogParam(p.nonce(), l); | 
| 610   l->append(")"); | 652   l->append(")"); | 
| 611 } | 653 } | 
| 612 | 654 | 
| 613 namespace { | 655 namespace { | 
| 614 enum CompositorFrameType { | 656 enum CompositorFrameType { | 
| 615   NO_FRAME, | 657   NO_FRAME, | 
| 616   DELEGATED_FRAME, | 658   DELEGATED_FRAME, | 
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 969 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 1011 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 
| 970 #include "cc/ipc/cc_param_traits_macros.h" | 1012 #include "cc/ipc/cc_param_traits_macros.h" | 
| 971 }  // namespace IPC | 1013 }  // namespace IPC | 
| 972 | 1014 | 
| 973 // Generate param traits log methods. | 1015 // Generate param traits log methods. | 
| 974 #include "ipc/param_traits_log_macros.h" | 1016 #include "ipc/param_traits_log_macros.h" | 
| 975 namespace IPC { | 1017 namespace IPC { | 
| 976 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 1018 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ | 
| 977 #include "cc/ipc/cc_param_traits_macros.h" | 1019 #include "cc/ipc/cc_param_traits_macros.h" | 
| 978 }  // namespace IPC | 1020 }  // namespace IPC | 
| OLD | NEW | 
|---|