| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| 12 #include <sys/stat.h> | 12 #include <sys/stat.h> |
| 13 #include <sys/un.h> | 13 #include <sys/un.h> |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 #include <map> | 16 #include <map> |
| 17 | 17 |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/eintr_wrapper.h" | 19 #include "base/eintr_wrapper.h" |
| 20 #include "base/file_path.h" | 20 #include "base/file_path.h" |
| 21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| 22 #include "base/global_descriptors_posix.h" | 22 #include "base/global_descriptors_posix.h" |
| 23 #include "base/logging.h" | 23 #include "base/logging.h" |
| 24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 25 #include "base/memory/singleton.h" | 25 #include "base/memory/singleton.h" |
| 26 #include "base/process_util.h" | 26 #include "base/process_util.h" |
| 27 #include "base/stl_util-inl.h" |
| 27 #include "base/string_util.h" | 28 #include "base/string_util.h" |
| 28 #include "base/synchronization/lock.h" | 29 #include "base/synchronization/lock.h" |
| 29 #include "ipc/ipc_descriptors.h" | 30 #include "ipc/ipc_descriptors.h" |
| 30 #include "ipc/ipc_switches.h" | 31 #include "ipc/ipc_switches.h" |
| 31 #include "ipc/file_descriptor_set_posix.h" | 32 #include "ipc/file_descriptor_set_posix.h" |
| 32 #include "ipc/ipc_logging.h" | 33 #include "ipc/ipc_logging.h" |
| 33 #include "ipc/ipc_message_utils.h" | 34 #include "ipc/ipc_message_utils.h" |
| 34 | 35 |
| 35 namespace IPC { | 36 namespace IPC { |
| 36 | 37 |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 } else { | 729 } else { |
| 729 listener_->OnMessageReceived(m); | 730 listener_->OnMessageReceived(m); |
| 730 } | 731 } |
| 731 p = message_tail; | 732 p = message_tail; |
| 732 } else { | 733 } else { |
| 733 // Last message is partial. | 734 // Last message is partial. |
| 734 break; | 735 break; |
| 735 } | 736 } |
| 736 input_overflow_fds_ = std::vector<int>(&fds[fds_i], &fds[num_fds]); | 737 input_overflow_fds_ = std::vector<int>(&fds[fds_i], &fds[num_fds]); |
| 737 fds_i = 0; | 738 fds_i = 0; |
| 738 fds = &input_overflow_fds_[0]; | 739 fds = vector_as_array(&input_overflow_fds_); |
| 739 num_fds = input_overflow_fds_.size(); | 740 num_fds = input_overflow_fds_.size(); |
| 740 } | 741 } |
| 741 input_overflow_buf_.assign(p, end - p); | 742 input_overflow_buf_.assign(p, end - p); |
| 742 input_overflow_fds_ = std::vector<int>(&fds[fds_i], &fds[num_fds]); | 743 input_overflow_fds_ = std::vector<int>(&fds[fds_i], &fds[num_fds]); |
| 743 | 744 |
| 744 // When the input data buffer is empty, the overflow fds should be too. If | 745 // When the input data buffer is empty, the overflow fds should be too. If |
| 745 // this is not the case, we probably have a rogue renderer which is trying | 746 // this is not the case, we probably have a rogue renderer which is trying |
| 746 // to fill our descriptor table. | 747 // to fill our descriptor table. |
| 747 if (input_overflow_buf_.empty() && !input_overflow_fds_.empty()) { | 748 if (input_overflow_buf_.empty() && !input_overflow_fds_.empty()) { |
| 748 // We close these descriptors in Close() | 749 // We close these descriptors in Close() |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 | 1192 |
| 1192 bool Channel::GetClientEuid(uid_t* client_euid) const { | 1193 bool Channel::GetClientEuid(uid_t* client_euid) const { |
| 1193 return channel_impl_->GetClientEuid(client_euid); | 1194 return channel_impl_->GetClientEuid(client_euid); |
| 1194 } | 1195 } |
| 1195 | 1196 |
| 1196 void Channel::ResetToAcceptingConnectionState() { | 1197 void Channel::ResetToAcceptingConnectionState() { |
| 1197 channel_impl_->ResetToAcceptingConnectionState(); | 1198 channel_impl_->ResetToAcceptingConnectionState(); |
| 1198 } | 1199 } |
| 1199 | 1200 |
| 1200 } // namespace IPC | 1201 } // namespace IPC |
| OLD | NEW |