Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/gfx/ipc/gfx_param_traits.h" | 5 #include "ui/gfx/ipc/gfx_param_traits.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 const SkBitmap_Data* bmp_data = | 293 const SkBitmap_Data* bmp_data = |
| 294 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 294 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
| 295 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 295 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { | 298 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { |
| 299 l->append("<SkBitmap>"); | 299 l->append("<SkBitmap>"); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void ParamTraits<gfx::Range>::Write(base::Pickle* m, const gfx::Range& r) { | 302 void ParamTraits<gfx::Range>::Write(base::Pickle* m, const gfx::Range& r) { |
| 303 m->WriteSizeT(r.start()); | 303 m->WriteInt(r.start()); |
| 304 m->WriteSizeT(r.end()); | 304 m->WriteInt(r.end()); |
| 305 } | 305 } |
| 306 | 306 |
| 307 bool ParamTraits<gfx::Range>::Read(const base::Pickle* m, | 307 bool ParamTraits<gfx::Range>::Read(const base::Pickle* m, |
| 308 base::PickleIterator* iter, | 308 base::PickleIterator* iter, |
| 309 gfx::Range* r) { | 309 gfx::Range* r) { |
| 310 size_t start, end; | 310 int start, end; |
|
Tom Sepez
2016/02/08 17:29:43
can we use a stdint type here?
jam
2016/02/08 17:56:29
Done.
| |
| 311 if (!iter->ReadSizeT(&start) || !iter->ReadSizeT(&end)) | 311 if (!iter->ReadInt(&start) || !iter->ReadInt(&end)) |
| 312 return false; | 312 return false; |
| 313 r->set_start(start); | 313 r->set_start(start); |
| 314 r->set_end(end); | 314 r->set_end(end); |
| 315 return true; | 315 return true; |
| 316 } | 316 } |
| 317 | 317 |
| 318 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { | 318 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) { |
| 319 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); | 319 l->append(base::StringPrintf("(%d, %d)", r.start(), r.end())); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void ParamTraits<gfx::ScrollOffset>::Write(base::Pickle* m, | 322 void ParamTraits<gfx::ScrollOffset>::Write(base::Pickle* m, |
| 323 const param_type& p) { | 323 const param_type& p) { |
| 324 m->WriteDouble(p.x()); | 324 m->WriteDouble(p.x()); |
| 325 m->WriteDouble(p.y()); | 325 m->WriteDouble(p.y()); |
| 326 } | 326 } |
| 327 | 327 |
| 328 bool ParamTraits<gfx::ScrollOffset>::Read(const base::Pickle* m, | 328 bool ParamTraits<gfx::ScrollOffset>::Read(const base::Pickle* m, |
| 329 base::PickleIterator* iter, | 329 base::PickleIterator* iter, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 389 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
| 390 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 390 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
| 391 } // namespace IPC | 391 } // namespace IPC |
| 392 | 392 |
| 393 // Generate param traits log methods. | 393 // Generate param traits log methods. |
| 394 #include "ipc/param_traits_log_macros.h" | 394 #include "ipc/param_traits_log_macros.h" |
| 395 namespace IPC { | 395 namespace IPC { |
| 396 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ | 396 #undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_ |
| 397 #include "ui/gfx/ipc/gfx_param_traits_macros.h" | 397 #include "ui/gfx/ipc/gfx_param_traits_macros.h" |
| 398 } // namespace IPC | 398 } // namespace IPC |
| OLD | NEW |