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

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

Issue 39463002: Introduce Pickle::{Read,Write}PODArray to serialize arrays of POD (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | « base/pickle.cc ('k') | content/public/common/common_param_traits.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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 void ParamTraits<gfx::Transform>::Write( 243 void ParamTraits<gfx::Transform>::Write(
244 Message* m, const param_type& p) { 244 Message* m, const param_type& p) {
245 #ifdef SK_MSCALAR_IS_FLOAT 245 #ifdef SK_MSCALAR_IS_FLOAT
246 float column_major_data[16]; 246 float column_major_data[16];
247 p.matrix().asColMajorf(column_major_data); 247 p.matrix().asColMajorf(column_major_data);
248 #else 248 #else
249 double column_major_data[16]; 249 double column_major_data[16];
250 p.matrix().asColMajord(column_major_data); 250 p.matrix().asColMajord(column_major_data);
251 #endif 251 #endif
252 m->WriteBytes(&column_major_data, sizeof(SkMScalar) * 16); 252 m->WritePODArray<16>(column_major_data);
253 } 253 }
254 254
255 bool ParamTraits<gfx::Transform>::Read( 255 bool ParamTraits<gfx::Transform>::Read(
256 const Message* m, PickleIterator* iter, param_type* r) { 256 const Message* m, PickleIterator* iter, param_type* r) {
257 const char* column_major_data; 257 const SkMScalar* column_major_data;
258 if (!m->ReadBytes(iter, &column_major_data, sizeof(SkMScalar) * 16)) 258 if (!m->ReadPODArray<16>(iter, &column_major_data))
259 return false; 259 return false;
260 r->matrix().setColMajor( 260 r->matrix().setColMajor(
261 reinterpret_cast<const SkMScalar*>(column_major_data)); 261 reinterpret_cast<const SkMScalar*>(column_major_data));
262 return true; 262 return true;
263 } 263 }
264 264
265 void ParamTraits<gfx::Transform>::Log( 265 void ParamTraits<gfx::Transform>::Log(
266 const param_type& p, std::string* l) { 266 const param_type& p, std::string* l) {
267 #ifdef SK_MSCALAR_IS_FLOAT 267 #ifdef SK_MSCALAR_IS_FLOAT
268 float row_major_data[16]; 268 float row_major_data[16];
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 l->append(", ["); 733 l->append(", [");
734 for (size_t i = 0; i < p.render_pass_list.size(); ++i) { 734 for (size_t i = 0; i < p.render_pass_list.size(); ++i) {
735 if (i) 735 if (i)
736 l->append(", "); 736 l->append(", ");
737 LogParam(*p.render_pass_list[i], l); 737 LogParam(*p.render_pass_list[i], l);
738 } 738 }
739 l->append("])"); 739 l->append("])");
740 } 740 }
741 741
742 } // namespace IPC 742 } // namespace IPC
OLDNEW
« no previous file with comments | « base/pickle.cc ('k') | content/public/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698