| 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_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 if (global_pid_) { | 738 if (global_pid_) { |
| 739 pid = global_pid_; | 739 pid = global_pid_; |
| 740 } | 740 } |
| 741 #endif | 741 #endif |
| 742 return pid; | 742 return pid; |
| 743 } | 743 } |
| 744 | 744 |
| 745 void Channel::ChannelImpl::QueueHelloMessage() { | 745 void Channel::ChannelImpl::QueueHelloMessage() { |
| 746 // Create the Hello message | 746 // Create the Hello message |
| 747 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, | 747 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, |
| 748 HELLO_MESSAGE_TYPE)); | 748 HELLO_MESSAGE_TYPE, |
| 749 IPC::Message::PRIORITY_NORMAL)); |
| 749 if (!msg->WriteInt(GetHelloMessageProcId())) { | 750 if (!msg->WriteInt(GetHelloMessageProcId())) { |
| 750 NOTREACHED() << "Unable to pickle hello message proc id"; | 751 NOTREACHED() << "Unable to pickle hello message proc id"; |
| 751 } | 752 } |
| 752 #if defined(IPC_USES_READWRITE) | 753 #if defined(IPC_USES_READWRITE) |
| 753 scoped_ptr<Message> hello; | 754 scoped_ptr<Message> hello; |
| 754 if (remote_fd_pipe_ != -1) { | 755 if (remote_fd_pipe_ != -1) { |
| 755 if (!msg->WriteFileDescriptor(base::FileDescriptor(remote_fd_pipe_, | 756 if (!msg->WriteFileDescriptor(base::FileDescriptor(remote_fd_pipe_, |
| 756 false))) { | 757 false))) { |
| 757 NOTREACHED() << "Unable to pickle hello message file descriptors"; | 758 NOTREACHED() << "Unable to pickle hello message file descriptors"; |
| 758 } | 759 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 } | 932 } |
| 932 input_fds_.clear(); | 933 input_fds_.clear(); |
| 933 } | 934 } |
| 934 | 935 |
| 935 void Channel::ChannelImpl::QueueCloseFDMessage(int fd, int hops) { | 936 void Channel::ChannelImpl::QueueCloseFDMessage(int fd, int hops) { |
| 936 switch (hops) { | 937 switch (hops) { |
| 937 case 1: | 938 case 1: |
| 938 case 2: { | 939 case 2: { |
| 939 // Create the message | 940 // Create the message |
| 940 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, | 941 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, |
| 941 CLOSE_FD_MESSAGE_TYPE)); | 942 CLOSE_FD_MESSAGE_TYPE, |
| 943 IPC::Message::PRIORITY_NORMAL)); |
| 942 if (!msg->WriteInt(hops - 1) || !msg->WriteInt(fd)) { | 944 if (!msg->WriteInt(hops - 1) || !msg->WriteInt(fd)) { |
| 943 NOTREACHED() << "Unable to pickle close fd."; | 945 NOTREACHED() << "Unable to pickle close fd."; |
| 944 } | 946 } |
| 945 // Send(msg.release()); | 947 // Send(msg.release()); |
| 946 output_queue_.push(msg.release()); | 948 output_queue_.push(msg.release()); |
| 947 break; | 949 break; |
| 948 } | 950 } |
| 949 | 951 |
| 950 default: | 952 default: |
| 951 NOTREACHED(); | 953 NOTREACHED(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 | 1101 |
| 1100 | 1102 |
| 1101 #if defined(OS_LINUX) | 1103 #if defined(OS_LINUX) |
| 1102 // static | 1104 // static |
| 1103 void Channel::SetGlobalPid(int pid) { | 1105 void Channel::SetGlobalPid(int pid) { |
| 1104 ChannelImpl::SetGlobalPid(pid); | 1106 ChannelImpl::SetGlobalPid(pid); |
| 1105 } | 1107 } |
| 1106 #endif // OS_LINUX | 1108 #endif // OS_LINUX |
| 1107 | 1109 |
| 1108 } // namespace IPC | 1110 } // namespace IPC |
| OLD | NEW |