Chromium Code Reviews| 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/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 748 } | 748 } |
| 749 | 749 |
| 750 void ParamTraits<Message>::Log(const Message& p, std::string* l) { | 750 void ParamTraits<Message>::Log(const Message& p, std::string* l) { |
| 751 l->append("<IPC::Message>"); | 751 l->append("<IPC::Message>"); |
| 752 } | 752 } |
| 753 | 753 |
| 754 #if defined(OS_WIN) | 754 #if defined(OS_WIN) |
| 755 // Note that HWNDs/HANDLE/HCURSOR/HACCEL etc are always 32 bits, even on 64 | 755 // Note that HWNDs/HANDLE/HCURSOR/HACCEL etc are always 32 bits, even on 64 |
| 756 // bit systems. | 756 // bit systems. |
| 757 void ParamTraits<HANDLE>::Write(Message* m, const param_type& p) { | 757 void ParamTraits<HANDLE>::Write(Message* m, const param_type& p) { |
| 758 m->WriteUInt32(reinterpret_cast<uint32>(p)); | 758 m->WriteUInt32(reinterpret_cast<uint32>(p)); |
|
cpu_(ooo_6.6-7.5)
2013/03/03 19:36:24
why not do it here instead?
| |
| 759 } | 759 } |
| 760 | 760 |
| 761 bool ParamTraits<HANDLE>::Read(const Message* m, PickleIterator* iter, | 761 bool ParamTraits<HANDLE>::Read(const Message* m, PickleIterator* iter, |
| 762 param_type* r) { | 762 param_type* r) { |
| 763 uint32 temp; | 763 uint32 temp; |
| 764 if (!m->ReadUInt32(iter, &temp)) | 764 if (!m->ReadUInt32(iter, &temp)) |
| 765 return false; | 765 return false; |
| 766 *r = reinterpret_cast<HANDLE>(temp); | 766 // On Win64 all HANDLE values are 32-bits except for INVALID_HANDLE_VALUE. |
| 767 if (reinterpret_cast<uint32>(INVALID_HANDLE_VALUE) == temp) | |
|
piman
2013/03/03 16:50:18
why not simply reading and writing the data of the
jschuh
2013/03/03 17:15:05
32-bits is the correct size because valid handles
piman
2013/03/03 17:31:38
Do we use IPC between 32 and 64 bit processes? Do
jschuh
2013/03/03 17:41:24
Absolutely. We have it today with NaCl, and off th
| |
| 768 *r = INVALID_HANDLE_VALUE; | |
| 769 else | |
| 770 *r = reinterpret_cast<HANDLE>(temp); | |
| 767 return true; | 771 return true; |
| 768 } | 772 } |
| 769 | 773 |
| 770 void ParamTraits<HANDLE>::Log(const param_type& p, std::string* l) { | 774 void ParamTraits<HANDLE>::Log(const param_type& p, std::string* l) { |
| 771 l->append(StringPrintf("0x%X", p)); | 775 l->append(StringPrintf("0x%X", p)); |
| 772 } | 776 } |
| 773 | 777 |
| 774 void ParamTraits<LOGFONT>::Write(Message* m, const param_type& p) { | 778 void ParamTraits<LOGFONT>::Write(Message* m, const param_type& p) { |
| 775 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(LOGFONT)); | 779 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(LOGFONT)); |
| 776 } | 780 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 return result; | 818 return result; |
| 815 } | 819 } |
| 816 | 820 |
| 817 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 821 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
| 818 l->append("<MSG>"); | 822 l->append("<MSG>"); |
| 819 } | 823 } |
| 820 | 824 |
| 821 #endif // OS_WIN | 825 #endif // OS_WIN |
| 822 | 826 |
| 823 } // namespace IPC | 827 } // namespace IPC |
| OLD | NEW |