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

Side by Side Diff: content/common/cc_messages.cc

Issue 196423027: Move SoftwareFrameData overflow checks to the IPC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('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 "content/common/cc_messages.h" 5 #include "content/common/cc_messages.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/filter_operations.h" 9 #include "cc/output/filter_operations.h"
10 #include "content/public/common/common_param_traits.h" 10 #include "content/public/common/common_param_traits.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 LogParam(p.resource_list, l); 746 LogParam(p.resource_list, l);
747 l->append(", ["); 747 l->append(", [");
748 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { 748 for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
749 if (i) 749 if (i)
750 l->append(", "); 750 l->append(", ");
751 LogParam(*p.render_pass_list[i], l); 751 LogParam(*p.render_pass_list[i], l);
752 } 752 }
753 l->append("])"); 753 l->append("])");
754 } 754 }
755 755
756 void ParamTraits<cc::SoftwareFrameData>::Write(Message* m,
757 const param_type& p) {
758 m->Reserve(sizeof(cc::SoftwareFrameData));
759 WriteParam(m, p.id);
760 WriteParam(m, p.size);
piman 2014/03/19 18:57:17 Do you want to add a DCHECK here?
danakj 2014/03/19 18:58:32 I did at first, but then the unit test is a death
761 WriteParam(m, p.damage_rect);
762 WriteParam(m, p.handle);
763 }
764
765 bool ParamTraits<cc::SoftwareFrameData>::Read(const Message* m,
766 PickleIterator* iter,
767 param_type* p) {
768 if (!ReadParam(m, iter, &p->id))
769 return false;
770 if (!ReadParam(m, iter, &p->size) || !p->CheckedSizeInBytes().IsValid())
771 return false;
772 if (!ReadParam(m, iter, &p->damage_rect))
773 return false;
774 if (!ReadParam(m, iter, &p->handle))
775 return false;
776 return true;
777 }
778
779 void ParamTraits<cc::SoftwareFrameData>::Log(const param_type& p,
780 std::string* l) {
781 l->append("SoftwareFrameData(");
782 LogParam(p.id, l);
783 l->append(", ");
784 LogParam(p.size, l);
785 l->append(", ");
786 LogParam(p.damage_rect, l);
787 l->append(", ");
788 LogParam(p.handle, l);
789 l->append(")");
790 }
791
756 } // namespace IPC 792 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698