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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 337 |
338 void ParamTraits<std::string>::Log(const param_type& p, std::string* l) { | 338 void ParamTraits<std::string>::Log(const param_type& p, std::string* l) { |
339 l->append(p); | 339 l->append(p); |
340 } | 340 } |
341 | 341 |
342 void ParamTraits<std::wstring>::Log(const param_type& p, std::string* l) { | 342 void ParamTraits<std::wstring>::Log(const param_type& p, std::string* l) { |
343 l->append(WideToUTF8(p)); | 343 l->append(WideToUTF8(p)); |
344 } | 344 } |
345 | 345 |
346 #if !defined(WCHAR_T_IS_UTF16) | 346 #if !defined(WCHAR_T_IS_UTF16) |
347 void ParamTraits<string16>::Log(const param_type& p, std::string* l) { | 347 void ParamTraits<base::string16>::Log(const param_type& p, std::string* l) { |
348 l->append(UTF16ToUTF8(p)); | 348 l->append(UTF16ToUTF8(p)); |
349 } | 349 } |
350 #endif | 350 #endif |
351 | 351 |
352 void ParamTraits<std::vector<char> >::Write(Message* m, const param_type& p) { | 352 void ParamTraits<std::vector<char> >::Write(Message* m, const param_type& p) { |
353 if (p.empty()) { | 353 if (p.empty()) { |
354 m->WriteData(NULL, 0); | 354 m->WriteData(NULL, 0); |
355 } else { | 355 } else { |
356 m->WriteData(&p.front(), static_cast<int>(p.size())); | 356 m->WriteData(&p.front(), static_cast<int>(p.size())); |
357 } | 357 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 529 |
530 void ParamTraits<base::NullableString16>::Write(Message* m, | 530 void ParamTraits<base::NullableString16>::Write(Message* m, |
531 const param_type& p) { | 531 const param_type& p) { |
532 WriteParam(m, p.string()); | 532 WriteParam(m, p.string()); |
533 WriteParam(m, p.is_null()); | 533 WriteParam(m, p.is_null()); |
534 } | 534 } |
535 | 535 |
536 bool ParamTraits<base::NullableString16>::Read(const Message* m, | 536 bool ParamTraits<base::NullableString16>::Read(const Message* m, |
537 PickleIterator* iter, | 537 PickleIterator* iter, |
538 param_type* r) { | 538 param_type* r) { |
539 string16 string; | 539 base::string16 string; |
540 if (!ReadParam(m, iter, &string)) | 540 if (!ReadParam(m, iter, &string)) |
541 return false; | 541 return false; |
542 bool is_null; | 542 bool is_null; |
543 if (!ReadParam(m, iter, &is_null)) | 543 if (!ReadParam(m, iter, &is_null)) |
544 return false; | 544 return false; |
545 *r = base::NullableString16(string, is_null); | 545 *r = base::NullableString16(string, is_null); |
546 return true; | 546 return true; |
547 } | 547 } |
548 | 548 |
549 void ParamTraits<base::NullableString16>::Log(const param_type& p, | 549 void ParamTraits<base::NullableString16>::Log(const param_type& p, |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 return result; | 823 return result; |
824 } | 824 } |
825 | 825 |
826 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 826 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
827 l->append("<MSG>"); | 827 l->append("<MSG>"); |
828 } | 828 } |
829 | 829 |
830 #endif // OS_WIN | 830 #endif // OS_WIN |
831 | 831 |
832 } // namespace IPC | 832 } // namespace IPC |
OLD | NEW |