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/files/file_path.h" | 7 #include "base/files/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/strings/nullable_string16.h" | 10 #include "base/strings/nullable_string16.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 | 443 |
444 void ParamTraits<std::vector<bool> >::Log(const param_type& p, std::string* l) { | 444 void ParamTraits<std::vector<bool> >::Log(const param_type& p, std::string* l) { |
445 for (size_t i = 0; i < p.size(); ++i) { | 445 for (size_t i = 0; i < p.size(); ++i) { |
446 if (i != 0) | 446 if (i != 0) |
447 l->push_back(' '); | 447 l->push_back(' '); |
448 LogParam(static_cast<bool>(p[i]), l); | 448 LogParam(static_cast<bool>(p[i]), l); |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
| 452 void ParamTraits<BrokerableAttachment::AttachmentId>::Write( |
| 453 Message* m, |
| 454 const param_type& p) { |
| 455 m->WriteBytes(p.nonce, BrokerableAttachment::kNonceSize); |
| 456 } |
| 457 |
| 458 bool ParamTraits<BrokerableAttachment::AttachmentId>::Read( |
| 459 const Message* m, |
| 460 base::PickleIterator* iter, |
| 461 param_type* r) { |
| 462 const char* data; |
| 463 if (!iter->ReadBytes(&data, BrokerableAttachment::kNonceSize)) |
| 464 return false; |
| 465 memcpy(r->nonce, data, BrokerableAttachment::kNonceSize); |
| 466 return true; |
| 467 } |
| 468 |
| 469 void ParamTraits<BrokerableAttachment::AttachmentId>::Log(const param_type& p, |
| 470 std::string* l) { |
| 471 l->append(base::HexEncode(p.nonce, BrokerableAttachment::kNonceSize)); |
| 472 } |
| 473 |
452 void ParamTraits<base::DictionaryValue>::Write(Message* m, | 474 void ParamTraits<base::DictionaryValue>::Write(Message* m, |
453 const param_type& p) { | 475 const param_type& p) { |
454 WriteValue(m, &p, 0); | 476 WriteValue(m, &p, 0); |
455 } | 477 } |
456 | 478 |
457 bool ParamTraits<base::DictionaryValue>::Read(const Message* m, | 479 bool ParamTraits<base::DictionaryValue>::Read(const Message* m, |
458 base::PickleIterator* iter, | 480 base::PickleIterator* iter, |
459 param_type* r) { | 481 param_type* r) { |
460 int type; | 482 int type; |
461 if (!ReadParam(m, iter, &type) || type != base::Value::TYPE_DICTIONARY) | 483 if (!ReadParam(m, iter, &type) || type != base::Value::TYPE_DICTIONARY) |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 return result; | 944 return result; |
923 } | 945 } |
924 | 946 |
925 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 947 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
926 l->append("<MSG>"); | 948 l->append("<MSG>"); |
927 } | 949 } |
928 | 950 |
929 #endif // OS_WIN | 951 #endif // OS_WIN |
930 | 952 |
931 } // namespace IPC | 953 } // namespace IPC |
OLD | NEW |