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 "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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 LogParam(p.at(i), l); | 203 LogParam(p.at(i), l); |
204 } | 204 } |
205 l->append(")"); | 205 l->append(")"); |
206 } | 206 } |
207 | 207 |
208 void ParamTraits<skia::RefPtr<SkImageFilter> >::Write( | 208 void ParamTraits<skia::RefPtr<SkImageFilter> >::Write( |
209 Message* m, const param_type& p) { | 209 Message* m, const param_type& p) { |
210 SkImageFilter* filter = p.get(); | 210 SkImageFilter* filter = p.get(); |
211 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 211 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
212 if (filter && !command_line.HasSwitch(switches::kDisableFiltersOverIPC)) { | 212 if (filter && !command_line.HasSwitch(switches::kDisableFiltersOverIPC)) { |
213 skia::RefPtr<SkData> data = skia::AdoptRef(SkSerializeFlattenable(filter)); | 213 skia::RefPtr<SkData> data = |
| 214 skia::AdoptRef(SkValidatingSerializeFlattenable(filter)); |
214 m->WriteData(static_cast<const char*>(data->data()), data->size()); | 215 m->WriteData(static_cast<const char*>(data->data()), data->size()); |
215 } else { | 216 } else { |
216 m->WriteData(0, 0); | 217 m->WriteData(0, 0); |
217 } | 218 } |
218 } | 219 } |
219 | 220 |
220 bool ParamTraits<skia::RefPtr<SkImageFilter> >::Read( | 221 bool ParamTraits<skia::RefPtr<SkImageFilter> >::Read( |
221 const Message* m, PickleIterator* iter, param_type* r) { | 222 const Message* m, PickleIterator* iter, param_type* r) { |
222 const char* data = 0; | 223 const char* data = 0; |
223 int length = 0; | 224 int length = 0; |
224 if (!m->ReadData(iter, &data, &length)) | 225 if (!m->ReadData(iter, &data, &length)) |
225 return false; | 226 return false; |
226 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 227 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
227 if ((length > 0) && | 228 if ((length > 0) && |
228 !command_line.HasSwitch(switches::kDisableFiltersOverIPC)) { | 229 !command_line.HasSwitch(switches::kDisableFiltersOverIPC)) { |
229 SkFlattenable* flattenable = SkDeserializeFlattenable(data, length); | 230 SkFlattenable* flattenable = SkValidatingDeserializeFlattenable( |
| 231 data, length, SkImageFilter::GetFlattenableType()); |
230 *r = skia::AdoptRef(static_cast<SkImageFilter*>(flattenable)); | 232 *r = skia::AdoptRef(static_cast<SkImageFilter*>(flattenable)); |
231 } else { | 233 } else { |
232 r->clear(); | 234 r->clear(); |
233 } | 235 } |
234 return true; | 236 return true; |
235 } | 237 } |
236 | 238 |
237 void ParamTraits<skia::RefPtr<SkImageFilter> >::Log( | 239 void ParamTraits<skia::RefPtr<SkImageFilter> >::Log( |
238 const param_type& p, std::string* l) { | 240 const param_type& p, std::string* l) { |
239 l->append("("); | 241 l->append("("); |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 l->append(", ["); | 736 l->append(", ["); |
735 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { | 737 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { |
736 if (i) | 738 if (i) |
737 l->append(", "); | 739 l->append(", "); |
738 LogParam(*p.render_pass_list[i], l); | 740 LogParam(*p.render_pass_list[i], l); |
739 } | 741 } |
740 l->append("])"); | 742 l->append("])"); |
741 } | 743 } |
742 | 744 |
743 } // namespace IPC | 745 } // namespace IPC |
OLD | NEW |