OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/types.h> | 10 #include <sys/types.h> |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 PLOG(ERROR) << "close" << i; | 677 PLOG(ERROR) << "close" << i; |
678 input_overflow_fds_.clear(); | 678 input_overflow_fds_.clear(); |
679 // abort the connection | 679 // abort the connection |
680 return false; | 680 return false; |
681 } | 681 } |
682 | 682 |
683 m.file_descriptor_set()->SetDescriptors( | 683 m.file_descriptor_set()->SetDescriptors( |
684 &fds[fds_i], m.header()->num_fds); | 684 &fds[fds_i], m.header()->num_fds); |
685 fds_i += m.header()->num_fds; | 685 fds_i += m.header()->num_fds; |
686 } | 686 } |
687 #ifdef IPC_MESSAGE_DEBUG_EXTRA | 687 DVLOG(2) << "received message on channel @" << this |
688 DLOG(INFO) << "received message on channel @" << this << | 688 << " with type " << m.type(); |
689 " with type " << m.type(); | |
690 #endif | |
691 if (m.routing_id() == MSG_ROUTING_NONE && | 689 if (m.routing_id() == MSG_ROUTING_NONE && |
692 m.type() == HELLO_MESSAGE_TYPE) { | 690 m.type() == HELLO_MESSAGE_TYPE) { |
693 // The Hello message contains only the process id. | 691 // The Hello message contains only the process id. |
694 void *iter = NULL; | 692 void *iter = NULL; |
695 int pid; | 693 int pid; |
696 if (!m.ReadInt(&iter, &pid)) { | 694 if (!m.ReadInt(&iter, &pid)) { |
697 NOTREACHED(); | 695 NOTREACHED(); |
698 } | 696 } |
699 #if !defined(OS_MACOSX) | 697 #if !defined(OS_MACOSX) |
700 if (mode_ == MODE_SERVER && !uses_fifo_) { | 698 if (mode_ == MODE_SERVER && !uses_fifo_) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 pipe_, | 897 pipe_, |
900 false, // One shot | 898 false, // One shot |
901 MessageLoopForIO::WATCH_WRITE, | 899 MessageLoopForIO::WATCH_WRITE, |
902 &write_watcher_, | 900 &write_watcher_, |
903 this); | 901 this); |
904 return true; | 902 return true; |
905 } else { | 903 } else { |
906 message_send_bytes_written_ = 0; | 904 message_send_bytes_written_ = 0; |
907 | 905 |
908 // Message sent OK! | 906 // Message sent OK! |
909 #ifdef IPC_MESSAGE_DEBUG_EXTRA | 907 DVLOG(2) << "sent message @" << msg << " on channel @" << this |
910 DLOG(INFO) << "sent message @" << msg << " on channel @" << this << | 908 << " with type " << msg->type(); |
911 " with type " << msg->type(); | |
912 #endif | |
913 delete output_queue_.front(); | 909 delete output_queue_.front(); |
914 output_queue_.pop(); | 910 output_queue_.pop(); |
915 } | 911 } |
916 } | 912 } |
917 return true; | 913 return true; |
918 } | 914 } |
919 | 915 |
920 bool Channel::ChannelImpl::Send(Message* message) { | 916 bool Channel::ChannelImpl::Send(Message* message) { |
921 #ifdef IPC_MESSAGE_DEBUG_EXTRA | 917 DVLOG(2) << "sending message @" << message << " on channel @" << this |
922 DLOG(INFO) << "sending message @" << message << " on channel @" << this | 918 << " with type " << message->type() |
923 << " with type " << message->type() | 919 << " (" << output_queue_.size() << " in queue)"; |
924 << " (" << output_queue_.size() << " in queue)"; | |
925 #endif | |
926 | 920 |
927 #ifdef IPC_MESSAGE_LOG_ENABLED | 921 #ifdef IPC_MESSAGE_LOG_ENABLED |
928 Logging::current()->OnSendMessage(message, ""); | 922 Logging::current()->OnSendMessage(message, ""); |
929 #endif | 923 #endif |
930 | 924 |
931 output_queue_.push(message); | 925 output_queue_.push(message); |
932 if (!waiting_connect_) { | 926 if (!waiting_connect_) { |
933 if (!is_blocked_on_write_) { | 927 if (!is_blocked_on_write_) { |
934 if (!ProcessOutgoingMessages()) | 928 if (!ProcessOutgoingMessages()) |
935 return false; | 929 return false; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 | 1076 |
1083 bool Channel::Send(Message* message) { | 1077 bool Channel::Send(Message* message) { |
1084 return channel_impl_->Send(message); | 1078 return channel_impl_->Send(message); |
1085 } | 1079 } |
1086 | 1080 |
1087 int Channel::GetClientFileDescriptor() const { | 1081 int Channel::GetClientFileDescriptor() const { |
1088 return channel_impl_->GetClientFileDescriptor(); | 1082 return channel_impl_->GetClientFileDescriptor(); |
1089 } | 1083 } |
1090 | 1084 |
1091 } // namespace IPC | 1085 } // namespace IPC |
OLD | NEW |