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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 return false; | 650 return false; |
651 | 651 |
652 // TODO(morrita): Seems like this should return false. | 652 // TODO(morrita): Seems like this should return false. |
653 if (!valid) | 653 if (!valid) |
654 return true; | 654 return true; |
655 | 655 |
656 scoped_refptr<base::Pickle::Attachment> attachment; | 656 scoped_refptr<base::Pickle::Attachment> attachment; |
657 if (!m->ReadAttachment(iter, &attachment)) | 657 if (!m->ReadAttachment(iter, &attachment)) |
658 return false; | 658 return false; |
659 | 659 |
660 if (static_cast<MessageAttachment*>(attachment.get())->GetType() != | |
661 MessageAttachment::Type::PLATFORM_FILE) { | |
662 return false; | |
663 } | |
664 | |
665 *r = base::FileDescriptor( | 660 *r = base::FileDescriptor( |
666 static_cast<internal::PlatformFileAttachment*>(attachment.get()) | 661 static_cast<MessageAttachment*>(attachment.get())->TakePlatformFile(), |
667 ->TakePlatformFile(), | |
668 true); | 662 true); |
669 return true; | 663 return true; |
670 } | 664 } |
671 | 665 |
672 void ParamTraits<base::FileDescriptor>::Log(const param_type& p, | 666 void ParamTraits<base::FileDescriptor>::Log(const param_type& p, |
673 std::string* l) { | 667 std::string* l) { |
674 if (p.auto_close) { | 668 if (p.auto_close) { |
675 l->append(base::StringPrintf("FD(%d auto-close)", p.fd)); | 669 l->append(base::StringPrintf("FD(%d auto-close)", p.fd)); |
676 } else { | 670 } else { |
677 l->append(base::StringPrintf("FD(%d)", p.fd)); | 671 l->append(base::StringPrintf("FD(%d)", p.fd)); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 return result; | 1229 return result; |
1236 } | 1230 } |
1237 | 1231 |
1238 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1232 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1239 l->append("<MSG>"); | 1233 l->append("<MSG>"); |
1240 } | 1234 } |
1241 | 1235 |
1242 #endif // OS_WIN | 1236 #endif // OS_WIN |
1243 | 1237 |
1244 } // namespace IPC | 1238 } // namespace IPC |
OLD | NEW |