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

Side by Side Diff: cc/ipc/cc_param_traits.cc

Issue 2374183006: Remove GLFrameData from CompositorFrame. (Closed)
Patch Set: Address comments. Created 4 years, 2 months 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
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 "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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 LogParam(p.local_id(), l); 641 LogParam(p.local_id(), l);
642 l->append(", "); 642 l->append(", ");
643 LogParam(p.nonce(), l); 643 LogParam(p.nonce(), l);
644 l->append(")"); 644 l->append(")");
645 } 645 }
646 646
647 namespace { 647 namespace {
648 enum CompositorFrameType { 648 enum CompositorFrameType {
649 NO_FRAME, 649 NO_FRAME,
650 DELEGATED_FRAME, 650 DELEGATED_FRAME,
651 GL_FRAME,
652 }; 651 };
653 } 652 }
654 653
655 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m, 654 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m,
656 const param_type& p) { 655 const param_type& p) {
657 WriteParam(m, p.metadata); 656 WriteParam(m, p.metadata);
658 if (p.delegated_frame_data) { 657 if (p.delegated_frame_data) {
659 DCHECK(!p.gl_frame_data);
660 WriteParam(m, static_cast<int>(DELEGATED_FRAME)); 658 WriteParam(m, static_cast<int>(DELEGATED_FRAME));
661 WriteParam(m, *p.delegated_frame_data); 659 WriteParam(m, *p.delegated_frame_data);
662 } else if (p.gl_frame_data) {
663 WriteParam(m, static_cast<int>(GL_FRAME));
664 WriteParam(m, *p.gl_frame_data);
665 } else { 660 } else {
666 WriteParam(m, static_cast<int>(NO_FRAME)); 661 WriteParam(m, static_cast<int>(NO_FRAME));
667 } 662 }
668 } 663 }
669 664
670 bool ParamTraits<cc::CompositorFrame>::Read(const base::Pickle* m, 665 bool ParamTraits<cc::CompositorFrame>::Read(const base::Pickle* m,
671 base::PickleIterator* iter, 666 base::PickleIterator* iter,
672 param_type* p) { 667 param_type* p) {
673 if (!ReadParam(m, iter, &p->metadata)) 668 if (!ReadParam(m, iter, &p->metadata))
674 return false; 669 return false;
675 670
676 int compositor_frame_type; 671 int compositor_frame_type;
677 if (!ReadParam(m, iter, &compositor_frame_type)) 672 if (!ReadParam(m, iter, &compositor_frame_type))
678 return false; 673 return false;
679 674
680 switch (compositor_frame_type) { 675 switch (compositor_frame_type) {
681 case DELEGATED_FRAME: 676 case DELEGATED_FRAME:
682 p->delegated_frame_data.reset(new cc::DelegatedFrameData()); 677 p->delegated_frame_data.reset(new cc::DelegatedFrameData());
683 if (!ReadParam(m, iter, p->delegated_frame_data.get())) 678 if (!ReadParam(m, iter, p->delegated_frame_data.get()))
684 return false; 679 return false;
685 break; 680 break;
686 case GL_FRAME:
687 p->gl_frame_data.reset(new cc::GLFrameData());
688 if (!ReadParam(m, iter, p->gl_frame_data.get()))
689 return false;
690 break;
691 case NO_FRAME: 681 case NO_FRAME:
692 break; 682 break;
693 default: 683 default:
694 return false; 684 return false;
695 } 685 }
696 return true; 686 return true;
697 } 687 }
698 688
699 void ParamTraits<cc::CompositorFrame>::Log(const param_type& p, 689 void ParamTraits<cc::CompositorFrame>::Log(const param_type& p,
700 std::string* l) { 690 std::string* l) {
701 l->append("CompositorFrame("); 691 l->append("CompositorFrame(");
702 LogParam(p.metadata, l); 692 LogParam(p.metadata, l);
703 l->append(", "); 693 l->append(", ");
704 if (p.delegated_frame_data) 694 if (p.delegated_frame_data)
705 LogParam(*p.delegated_frame_data, l); 695 LogParam(*p.delegated_frame_data, l);
706 else if (p.gl_frame_data)
707 LogParam(*p.gl_frame_data, l);
708 l->append(")"); 696 l->append(")");
709 } 697 }
710 698
711 void ParamTraits<cc::DelegatedFrameData>::Write(base::Pickle* m, 699 void ParamTraits<cc::DelegatedFrameData>::Write(base::Pickle* m,
712 const param_type& p) { 700 const param_type& p) {
713 DCHECK_NE(0u, p.render_pass_list.size()); 701 DCHECK_NE(0u, p.render_pass_list.size());
714 702
715 size_t to_reserve = 0u; 703 size_t to_reserve = 0u;
716 to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource); 704 to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource);
717 for (const auto& pass : p.render_pass_list) { 705 for (const auto& pass : p.render_pass_list) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 991 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
1004 #include "cc/ipc/cc_param_traits_macros.h" 992 #include "cc/ipc/cc_param_traits_macros.h"
1005 } // namespace IPC 993 } // namespace IPC
1006 994
1007 // Generate param traits log methods. 995 // Generate param traits log methods.
1008 #include "ipc/param_traits_log_macros.h" 996 #include "ipc/param_traits_log_macros.h"
1009 namespace IPC { 997 namespace IPC {
1010 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 998 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
1011 #include "cc/ipc/cc_param_traits_macros.h" 999 #include "cc/ipc/cc_param_traits_macros.h"
1012 } // namespace IPC 1000 } // namespace IPC
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/ipc/cc_param_traits_macros.h » ('j') | cc/output/output_surface_frame.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698