Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: ipc/ipc_channel_posix.cc

Issue 583473002: IPC: Get rid of FileDescriptor usage from FileDescriptorSet and Message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_channel_nacl.cc ('k') | ipc/ipc_message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_posix.cc
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 7f0a1fe83896ba9a7ad0a054a5d0803d0b1175bd..d430bd644d8c6694eb0867ba906448ffd6e43a46 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -432,7 +432,7 @@ bool ChannelPosix::ProcessOutgoingMessages() {
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int) * num_fds);
- msg->file_descriptor_set()->GetDescriptors(
+ msg->file_descriptor_set()->PeekDescriptors(
reinterpret_cast<int*>(CMSG_DATA(cmsg)));
msgh.msg_controllen = cmsg->cmsg_len;
@@ -769,8 +769,7 @@ void ChannelPosix::QueueHelloMessage() {
#if defined(IPC_USES_READWRITE)
scoped_ptr<Message> hello;
if (remote_fd_pipe_ != -1) {
- if (!msg->WriteFileDescriptor(base::FileDescriptor(remote_fd_pipe_,
- false))) {
+ if (!msg->WriteBorrowingFile(remote_fd_pipe_)) {
NOTREACHED() << "Unable to pickle hello message file descriptors";
}
DCHECK_EQ(msg->file_descriptor_set()->size(), 1U);
@@ -896,8 +895,8 @@ bool ChannelPosix::WillDispatchInputMessage(Message* msg) {
// The shenaniganery below with &foo.front() requires input_fds_ to have
// contiguous underlying storage (such as a simple array or a std::vector).
// This is why the header warns not to make input_fds_ a deque<>.
- msg->file_descriptor_set()->SetDescriptors(&input_fds_.front(),
- header_fds);
+ msg->file_descriptor_set()->AddDescriptorsToOwn(&input_fds_.front(),
+ header_fds);
input_fds_.erase(input_fds_.begin(), input_fds_.begin() + header_fds);
return true;
}
@@ -991,12 +990,11 @@ void ChannelPosix::HandleInternalMessage(const Message& msg) {
// server also contains the fd_pipe_, which will be used for all
// subsequent file descriptor passing.
DCHECK_EQ(msg.file_descriptor_set()->size(), 1U);
- base::FileDescriptor descriptor;
- if (!msg.ReadFileDescriptor(&iter, &descriptor)) {
+ base::ScopedFD descriptor;
+ if (!msg.ReadFile(&iter, &descriptor)) {
NOTREACHED();
}
- fd_pipe_ = descriptor.fd;
- CHECK(descriptor.auto_close);
+ fd_pipe_ = descriptor.release();
}
#endif // IPC_USES_READWRITE
peer_pid_ = pid;
« no previous file with comments | « ipc/ipc_channel_nacl.cc ('k') | ipc/ipc_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698