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