| 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" | |
| 8 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/filter_operations.h" | 8 #include "cc/output/filter_operations.h" |
| 10 #include "content/public/common/common_param_traits.h" | 9 #include "content/public/common/common_param_traits.h" |
| 11 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| 12 #include "third_party/skia/include/core/SkData.h" | 11 #include "third_party/skia/include/core/SkData.h" |
| 13 #include "third_party/skia/include/core/SkFlattenableSerialization.h" | 12 #include "third_party/skia/include/core/SkFlattenableSerialization.h" |
| 14 #include "ui/gfx/transform.h" | 13 #include "ui/gfx/transform.h" |
| 15 | 14 |
| 16 namespace IPC { | 15 namespace IPC { |
| 17 | 16 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 if (i) | 208 if (i) |
| 210 l->append(", "); | 209 l->append(", "); |
| 211 LogParam(p.at(i), l); | 210 LogParam(p.at(i), l); |
| 212 } | 211 } |
| 213 l->append(")"); | 212 l->append(")"); |
| 214 } | 213 } |
| 215 | 214 |
| 216 void ParamTraits<skia::RefPtr<SkImageFilter> >::Write( | 215 void ParamTraits<skia::RefPtr<SkImageFilter> >::Write( |
| 217 Message* m, const param_type& p) { | 216 Message* m, const param_type& p) { |
| 218 SkImageFilter* filter = p.get(); | 217 SkImageFilter* filter = p.get(); |
| 219 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 218 if (filter) { |
| 220 if (filter && !command_line.HasSwitch(switches::kDisableFiltersOverIPC)) { | |
| 221 skia::RefPtr<SkData> data = | 219 skia::RefPtr<SkData> data = |
| 222 skia::AdoptRef(SkValidatingSerializeFlattenable(filter)); | 220 skia::AdoptRef(SkValidatingSerializeFlattenable(filter)); |
| 223 m->WriteData(static_cast<const char*>(data->data()), data->size()); | 221 m->WriteData(static_cast<const char*>(data->data()), data->size()); |
| 224 } else { | 222 } else { |
| 225 m->WriteData(0, 0); | 223 m->WriteData(0, 0); |
| 226 } | 224 } |
| 227 } | 225 } |
| 228 | 226 |
| 229 bool ParamTraits<skia::RefPtr<SkImageFilter> >::Read( | 227 bool ParamTraits<skia::RefPtr<SkImageFilter> >::Read( |
| 230 const Message* m, PickleIterator* iter, param_type* r) { | 228 const Message* m, PickleIterator* iter, param_type* r) { |
| 231 const char* data = 0; | 229 const char* data = 0; |
| 232 int length = 0; | 230 int length = 0; |
| 233 if (!m->ReadData(iter, &data, &length)) | 231 if (!m->ReadData(iter, &data, &length)) |
| 234 return false; | 232 return false; |
| 235 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 233 if (length > 0) { |
| 236 if ((length > 0) && | |
| 237 !command_line.HasSwitch(switches::kDisableFiltersOverIPC)) { | |
| 238 SkFlattenable* flattenable = SkValidatingDeserializeFlattenable( | 234 SkFlattenable* flattenable = SkValidatingDeserializeFlattenable( |
| 239 data, length, SkImageFilter::GetFlattenableType()); | 235 data, length, SkImageFilter::GetFlattenableType()); |
| 240 *r = skia::AdoptRef(static_cast<SkImageFilter*>(flattenable)); | 236 *r = skia::AdoptRef(static_cast<SkImageFilter*>(flattenable)); |
| 241 } else { | 237 } else { |
| 242 r->clear(); | 238 r->clear(); |
| 243 } | 239 } |
| 244 return true; | 240 return true; |
| 245 } | 241 } |
| 246 | 242 |
| 247 void ParamTraits<skia::RefPtr<SkImageFilter> >::Log( | 243 void ParamTraits<skia::RefPtr<SkImageFilter> >::Log( |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 l->append(", "); | 789 l->append(", "); |
| 794 LogParam(p.size, l); | 790 LogParam(p.size, l); |
| 795 l->append(", "); | 791 l->append(", "); |
| 796 LogParam(p.damage_rect, l); | 792 LogParam(p.damage_rect, l); |
| 797 l->append(", "); | 793 l->append(", "); |
| 798 LogParam(p.bitmap_id, l); | 794 LogParam(p.bitmap_id, l); |
| 799 l->append(")"); | 795 l->append(")"); |
| 800 } | 796 } |
| 801 | 797 |
| 802 } // namespace IPC | 798 } // namespace IPC |
| OLD | NEW |