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

Unified Diff: ipc/ipc_channel_posix.cc

Issue 883093003: IPC::Message Refactoring: Move POSIX specific bits to PlatformFileAttachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing Windows build error Created 5 years, 11 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.gypi ('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 1989669d1363e6c770c281b093ba9107852be793..6ba1f607b3d000b0619b8d77b994ce646c205007 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -42,6 +42,7 @@
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message_attachment_set.h"
#include "ipc/ipc_message_utils.h"
+#include "ipc/ipc_platform_file_attachment_posix.h"
#include "ipc/ipc_switches.h"
#include "ipc/unix_domain_socket_util.h"
@@ -793,7 +794,8 @@ void ChannelPosix::QueueHelloMessage() {
#if defined(IPC_USES_READWRITE)
scoped_ptr<Message> hello;
if (remote_fd_pipe_.is_valid()) {
- if (!msg->WriteBorrowingFile(remote_fd_pipe_.get())) {
+ if (!msg->WriteAttachment(
+ new internal::PlatformFileAttachment(remote_fd_pipe_.get()))) {
NOTREACHED() << "Unable to pickle hello message file descriptors";
}
DCHECK_EQ(msg->attachment_set()->size(), 1U);
@@ -1014,11 +1016,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.attachment_set()->size(), 1U);
- base::ScopedFD descriptor;
- if (!msg.ReadFile(&iter, &descriptor)) {
+ scoped_refptr<MessageAttachment> attachment;
+ if (!msg.ReadAttachment(&iter, &attachment)) {
NOTREACHED();
}
- fd_pipe_.reset(descriptor.release());
+ fd_pipe_.reset(attachment->TakePlatformFile());
}
#endif // IPC_USES_READWRITE
peer_pid_ = pid;
« no previous file with comments | « ipc/ipc.gypi ('k') | ipc/ipc_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698