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