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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 int type; | 444 int type; |
445 if (!ReadParam(m, iter, &type) || type != base::Value::TYPE_DICTIONARY) | 445 if (!ReadParam(m, iter, &type) || type != base::Value::TYPE_DICTIONARY) |
446 return false; | 446 return false; |
447 | 447 |
448 return ReadDictionaryValue(m, iter, r, 0); | 448 return ReadDictionaryValue(m, iter, r, 0); |
449 } | 449 } |
450 | 450 |
451 void ParamTraits<base::DictionaryValue>::Log(const param_type& p, | 451 void ParamTraits<base::DictionaryValue>::Log(const param_type& p, |
452 std::string* l) { | 452 std::string* l) { |
453 std::string json; | 453 std::string json; |
454 base::JSONWriter::Write(&p, &json); | 454 base::JSONWriter::Write(p, &json); |
455 l->append(json); | 455 l->append(json); |
456 } | 456 } |
457 | 457 |
458 #if defined(OS_POSIX) | 458 #if defined(OS_POSIX) |
459 void ParamTraits<base::FileDescriptor>::Write(Message* m, const param_type& p) { | 459 void ParamTraits<base::FileDescriptor>::Write(Message* m, const param_type& p) { |
460 const bool valid = p.fd >= 0; | 460 const bool valid = p.fd >= 0; |
461 WriteParam(m, valid); | 461 WriteParam(m, valid); |
462 | 462 |
463 if (!valid) | 463 if (!valid) |
464 return; | 464 return; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 const Message* m, PickleIterator* iter, param_type* r) { | 526 const Message* m, PickleIterator* iter, param_type* r) { |
527 int type; | 527 int type; |
528 if (!ReadParam(m, iter, &type) || type != base::Value::TYPE_LIST) | 528 if (!ReadParam(m, iter, &type) || type != base::Value::TYPE_LIST) |
529 return false; | 529 return false; |
530 | 530 |
531 return ReadListValue(m, iter, r, 0); | 531 return ReadListValue(m, iter, r, 0); |
532 } | 532 } |
533 | 533 |
534 void ParamTraits<base::ListValue>::Log(const param_type& p, std::string* l) { | 534 void ParamTraits<base::ListValue>::Log(const param_type& p, std::string* l) { |
535 std::string json; | 535 std::string json; |
536 base::JSONWriter::Write(&p, &json); | 536 base::JSONWriter::Write(p, &json); |
537 l->append(json); | 537 l->append(json); |
538 } | 538 } |
539 | 539 |
540 void ParamTraits<base::NullableString16>::Write(Message* m, | 540 void ParamTraits<base::NullableString16>::Write(Message* m, |
541 const param_type& p) { | 541 const param_type& p) { |
542 WriteParam(m, p.string()); | 542 WriteParam(m, p.string()); |
543 WriteParam(m, p.is_null()); | 543 WriteParam(m, p.is_null()); |
544 } | 544 } |
545 | 545 |
546 bool ParamTraits<base::NullableString16>::Read(const Message* m, | 546 bool ParamTraits<base::NullableString16>::Read(const Message* m, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 return result; | 829 return result; |
830 } | 830 } |
831 | 831 |
832 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 832 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
833 l->append("<MSG>"); | 833 l->append("<MSG>"); |
834 } | 834 } |
835 | 835 |
836 #endif // OS_WIN | 836 #endif // OS_WIN |
837 | 837 |
838 } // namespace IPC | 838 } // namespace IPC |
OLD | NEW |