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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 r->SetHeaderValues(static_cast<int32>(routing_id), type, flags); | 746 r->SetHeaderValues(static_cast<int32>(routing_id), type, flags); |
747 return r->WriteBytes(payload, payload_size); | 747 return r->WriteBytes(payload, payload_size); |
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. That's why we use the Windows macros to convert to 32 bits. |
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->WriteInt(HandleToLong(p)); |
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 int32 temp; |
764 if (!m->ReadUInt32(iter, &temp)) | 764 if (!m->ReadInt(iter, &temp)) |
765 return false; | 765 return false; |
766 *r = reinterpret_cast<HANDLE>(temp); | 766 *r = LongToHandle(temp); |
767 return true; | 767 return true; |
768 } | 768 } |
769 | 769 |
770 void ParamTraits<HANDLE>::Log(const param_type& p, std::string* l) { | 770 void ParamTraits<HANDLE>::Log(const param_type& p, std::string* l) { |
771 l->append(StringPrintf("0x%X", p)); | 771 l->append(StringPrintf("0x%X", p)); |
772 } | 772 } |
773 | 773 |
774 void ParamTraits<LOGFONT>::Write(Message* m, const param_type& p) { | 774 void ParamTraits<LOGFONT>::Write(Message* m, const param_type& p) { |
775 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(LOGFONT)); | 775 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(LOGFONT)); |
776 } | 776 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 return result; | 814 return result; |
815 } | 815 } |
816 | 816 |
817 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 817 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
818 l->append("<MSG>"); | 818 l->append("<MSG>"); |
819 } | 819 } |
820 | 820 |
821 #endif // OS_WIN | 821 #endif // OS_WIN |
822 | 822 |
823 } // namespace IPC | 823 } // namespace IPC |
OLD | NEW |