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

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

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix reflector Created 4 years, 6 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 l->append("CompositorFrame("); 667 l->append("CompositorFrame(");
668 LogParam(p.metadata, l); 668 LogParam(p.metadata, l);
669 l->append(", "); 669 l->append(", ");
670 if (p.delegated_frame_data) 670 if (p.delegated_frame_data)
671 LogParam(*p.delegated_frame_data, l); 671 LogParam(*p.delegated_frame_data, l);
672 else if (p.gl_frame_data) 672 else if (p.gl_frame_data)
673 LogParam(*p.gl_frame_data, l); 673 LogParam(*p.gl_frame_data, l);
674 l->append(")"); 674 l->append(")");
675 } 675 }
676 676
677 void ParamTraits<std::unique_ptr<cc::CompositorFrame>>::Write(
dcheng 2016/06/23 18:39:40 Shouldn't the existing ParamTraits partial special
Fady Samuel 2016/06/23 18:47:29 One exists but it doesn't do what I want. In parti
danakj 2016/06/23 20:34:40 I want to remove all Create() methods that are not
678 base::Pickle* m,
679 const param_type& p) {
680 bool valid = !!p;
681 WriteParam(m, valid);
682 if (valid)
683 WriteParam(m, *p);
684 }
685
686 bool ParamTraits<std::unique_ptr<cc::CompositorFrame>>::Read(
687 const base::Pickle* m,
688 base::PickleIterator* iter,
689 param_type* r) {
690 bool valid = false;
691 if (!ReadParam(m, iter, &valid))
692 return false;
693
694 if (!valid) {
695 r->reset();
696 return true;
697 }
698
699 param_type temp(cc::CompositorFrame::Create());
700 if (!ReadParam(m, iter, temp.get()))
701 return false;
702
703 r->swap(temp);
704 return true;
705 }
706
707 void ParamTraits<std::unique_ptr<cc::CompositorFrame>>::Log(const param_type& p,
708 std::string* l) {
709 if (p)
710 LogParam(*p, l);
711 else
712 l->append("NULL");
713 }
714
677 void ParamTraits<cc::CompositorFrameAck>::Write(base::Pickle* m, 715 void ParamTraits<cc::CompositorFrameAck>::Write(base::Pickle* m,
678 const param_type& p) { 716 const param_type& p) {
679 WriteParam(m, p.resources); 717 WriteParam(m, p.resources);
680 if (p.gl_frame_data) { 718 if (p.gl_frame_data) {
681 WriteParam(m, static_cast<int>(GL_FRAME)); 719 WriteParam(m, static_cast<int>(GL_FRAME));
682 WriteParam(m, *p.gl_frame_data); 720 WriteParam(m, *p.gl_frame_data);
683 } else { 721 } else {
684 WriteParam(m, static_cast<int>(NO_FRAME)); 722 WriteParam(m, static_cast<int>(NO_FRAME));
685 } 723 }
686 } 724 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 987 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
950 #include "cc/ipc/cc_param_traits_macros.h" 988 #include "cc/ipc/cc_param_traits_macros.h"
951 } // namespace IPC 989 } // namespace IPC
952 990
953 // Generate param traits log methods. 991 // Generate param traits log methods.
954 #include "ipc/param_traits_log_macros.h" 992 #include "ipc/param_traits_log_macros.h"
955 namespace IPC { 993 namespace IPC {
956 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_ 994 #undef CC_IPC_CC_PARAM_TRAITS_MACROS_H_
957 #include "cc/ipc/cc_param_traits_macros.h" 995 #include "cc/ipc/cc_param_traits_macros.h"
958 } // namespace IPC 996 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698