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 "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 424 } |
425 | 425 |
426 void ParamTraits<std::vector<unsigned char> >::Log(const param_type& p, | 426 void ParamTraits<std::vector<unsigned char> >::Log(const param_type& p, |
427 std::string* l) { | 427 std::string* l) { |
428 LogBytes(p, l); | 428 LogBytes(p, l); |
429 } | 429 } |
430 | 430 |
431 void ParamTraits<std::vector<bool> >::Write(Message* m, const param_type& p) { | 431 void ParamTraits<std::vector<bool> >::Write(Message* m, const param_type& p) { |
432 WriteParam(m, static_cast<int>(p.size())); | 432 WriteParam(m, static_cast<int>(p.size())); |
433 for (size_t i = 0; i < p.size(); i++) | 433 for (size_t i = 0; i < p.size(); i++) |
434 WriteParam(m, p[i]); | 434 WriteParam(m, (bool)p[i]); |
435 } | 435 } |
436 | 436 |
437 bool ParamTraits<std::vector<bool> >::Read(const Message* m, | 437 bool ParamTraits<std::vector<bool> >::Read(const Message* m, |
438 PickleIterator* iter, | 438 PickleIterator* iter, |
439 param_type* r) { | 439 param_type* r) { |
440 int size; | 440 int size; |
441 // ReadLength() checks for < 0 itself. | 441 // ReadLength() checks for < 0 itself. |
442 if (!m->ReadLength(iter, &size)) | 442 if (!m->ReadLength(iter, &size)) |
443 return false; | 443 return false; |
444 r->resize(size); | 444 r->resize(size); |
445 for (int i = 0; i < size; i++) { | 445 for (int i = 0; i < size; i++) { |
446 bool value; | 446 bool value; |
447 if (!ReadParam(m, iter, &value)) | 447 if (!ReadParam(m, iter, &value)) |
448 return false; | 448 return false; |
449 (*r)[i] = value; | 449 (*r)[i] = value; |
450 } | 450 } |
451 return true; | 451 return true; |
452 } | 452 } |
453 | 453 |
454 void ParamTraits<std::vector<bool> >::Log(const param_type& p, std::string* l) { | 454 void ParamTraits<std::vector<bool> >::Log(const param_type& p, std::string* l) { |
455 for (size_t i = 0; i < p.size(); ++i) { | 455 for (size_t i = 0; i < p.size(); ++i) { |
456 if (i != 0) | 456 if (i != 0) |
457 l->push_back(' '); | 457 l->push_back(' '); |
458 LogParam((p[i]), l); | 458 LogParam(((bool)p[i]), l); |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { | 462 void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { |
463 WriteValue(m, &p, 0); | 463 WriteValue(m, &p, 0); |
464 } | 464 } |
465 | 465 |
466 bool ParamTraits<DictionaryValue>::Read( | 466 bool ParamTraits<DictionaryValue>::Read( |
467 const Message* m, PickleIterator* iter, param_type* r) { | 467 const Message* m, PickleIterator* iter, param_type* r) { |
468 int type; | 468 int type; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 return result; | 845 return result; |
846 } | 846 } |
847 | 847 |
848 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 848 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
849 l->append("<MSG>"); | 849 l->append("<MSG>"); |
850 } | 850 } |
851 | 851 |
852 #endif // OS_WIN | 852 #endif // OS_WIN |
853 | 853 |
854 } // namespace IPC | 854 } // namespace IPC |
OLD | NEW |