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

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

Issue 2374183006: Remove GLFrameData from CompositorFrame. (Closed)
Patch Set: Rebase. 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
« no previous file with comments | « cc/BUILD.gn ('k') | cc/ipc/cc_param_traits_macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 LogParam(p.frame_sink_id(), l); 668 LogParam(p.frame_sink_id(), l);
669 l->append(", "); 669 l->append(", ");
670 LogParam(p.local_frame_id(), l); 670 LogParam(p.local_frame_id(), l);
671 l->append(")"); 671 l->append(")");
672 } 672 }
673 673
674 namespace { 674 namespace {
675 enum CompositorFrameType { 675 enum CompositorFrameType {
676 NO_FRAME, 676 NO_FRAME,
677 DELEGATED_FRAME, 677 DELEGATED_FRAME,
678 GL_FRAME,
679 }; 678 };
680 } 679 }
681 680
682 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m, 681 void ParamTraits<cc::CompositorFrame>::Write(base::Pickle* m,
683 const param_type& p) { 682 const param_type& p) {
684 WriteParam(m, p.metadata); 683 WriteParam(m, p.metadata);
685 if (p.delegated_frame_data) { 684 if (p.delegated_frame_data) {
686 DCHECK(!p.gl_frame_data);
687 WriteParam(m, static_cast<int>(DELEGATED_FRAME)); 685 WriteParam(m, static_cast<int>(DELEGATED_FRAME));
688 WriteParam(m, *p.delegated_frame_data); 686 WriteParam(m, *p.delegated_frame_data);
689 } else if (p.gl_frame_data) {
690 WriteParam(m, static_cast<int>(GL_FRAME));
691 WriteParam(m, *p.gl_frame_data);
692 } else { 687 } else {
693 WriteParam(m, static_cast<int>(NO_FRAME)); 688 WriteParam(m, static_cast<int>(NO_FRAME));
694 } 689 }
695 } 690 }
696 691
697 bool ParamTraits<cc::CompositorFrame>::Read(const base::Pickle* m, 692 bool ParamTraits<cc::CompositorFrame>::Read(const base::Pickle* m,
698 base::PickleIterator* iter, 693 base::PickleIterator* iter,
699 param_type* p) { 694 param_type* p) {
700 if (!ReadParam(m, iter, &p->metadata)) 695 if (!ReadParam(m, iter, &p->metadata))
701 return false; 696 return false;
702 697
703 int compositor_frame_type; 698 int compositor_frame_type;
704 if (!ReadParam(m, iter, &compositor_frame_type)) 699 if (!ReadParam(m, iter, &compositor_frame_type))
705 return false; 700 return false;
706 701
707 switch (compositor_frame_type) { 702 switch (compositor_frame_type) {
708 case DELEGATED_FRAME: 703 case DELEGATED_FRAME:
709 p->delegated_frame_data.reset(new cc::DelegatedFrameData()); 704 p->delegated_frame_data.reset(new cc::DelegatedFrameData());
710 if (!ReadParam(m, iter, p->delegated_frame_data.get())) 705 if (!ReadParam(m, iter, p->delegated_frame_data.get()))
711 return false; 706 return false;
712 break; 707 break;
713 case GL_FRAME:
714 p->gl_frame_data.reset(new cc::GLFrameData());
715 if (!ReadParam(m, iter, p->gl_frame_data.get()))
716 return false;
717 break;
718 case NO_FRAME: 708 case NO_FRAME:
719 break; 709 break;
720 default: 710 default:
721 return false; 711 return false;
722 } 712 }
723 return true; 713 return true;
724 } 714 }
725 715
726 void ParamTraits<cc::CompositorFrame>::Log(const param_type& p, 716 void ParamTraits<cc::CompositorFrame>::Log(const param_type& p,
727 std::string* l) { 717 std::string* l) {
728 l->append("CompositorFrame("); 718 l->append("CompositorFrame(");
729 LogParam(p.metadata, l); 719 LogParam(p.metadata, l);
730 l->append(", "); 720 l->append(", ");
731 if (p.delegated_frame_data) 721 if (p.delegated_frame_data)
732 LogParam(*p.delegated_frame_data, l); 722 LogParam(*p.delegated_frame_data, l);
733 else if (p.gl_frame_data)
734 LogParam(*p.gl_frame_data, l);
735 l->append(")"); 723 l->append(")");
736 } 724 }
737 725
738 void ParamTraits<cc::DelegatedFrameData>::Write(base::Pickle* m, 726 void ParamTraits<cc::DelegatedFrameData>::Write(base::Pickle* m,
739 const param_type& p) { 727 const param_type& p) {
740 DCHECK_NE(0u, p.render_pass_list.size()); 728 DCHECK_NE(0u, p.render_pass_list.size());
741 729
742 size_t to_reserve = 0u; 730 size_t to_reserve = 0u;
743 to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource); 731 to_reserve += p.resource_list.size() * sizeof(cc::TransferableResource);
744 for (const auto& pass : p.render_pass_list) { 732 for (const auto& pass : p.render_pass_list) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 1018 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
1031 #include "cc/ipc/cc_param_traits_macros.h" 1019 #include "cc/ipc/cc_param_traits_macros.h"
1032 } // namespace IPC 1020 } // namespace IPC
1033 1021
1034 // Generate param traits log methods. 1022 // Generate param traits log methods.
1035 #include "ipc/param_traits_log_macros.h" 1023 #include "ipc/param_traits_log_macros.h"
1036 namespace IPC { 1024 namespace IPC {
1037 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 1025 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
1038 #include "cc/ipc/cc_param_traits_macros.h" 1026 #include "cc/ipc/cc_param_traits_macros.h"
1039 } // namespace IPC 1027 } // namespace IPC
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/ipc/cc_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698