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

Unified Diff: ipc/ipc_message_utils.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_message_attachment_set_posix_unittest.cc ('k') | ipc/ipc_platform_file_attachment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.cc
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 9f15177d98481d8be34108a97b7d7e118fec8dea..7368a0db22101222f067a6ef5350c27fe6238caf 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -13,8 +13,13 @@
#include "base/time/time.h"
#include "base/values.h"
#include "ipc/ipc_channel_handle.h"
+#include "ipc/ipc_message_attachment.h"
#include "ipc/ipc_message_attachment_set.h"
+#if defined(OS_POSIX)
+#include "ipc/ipc_platform_file_attachment_posix.h"
+#endif
+
#if defined(OS_WIN)
#include <tchar.h>
#endif
@@ -465,10 +470,11 @@ void ParamTraits<base::FileDescriptor>::Write(Message* m, const param_type& p) {
return;
if (p.auto_close) {
- if (!m->WriteFile(base::ScopedFD(p.fd)))
+ if (!m->WriteAttachment(
+ new internal::PlatformFileAttachment(base::ScopedFD(p.fd))))
NOTREACHED();
} else {
- if (!m->WriteBorrowingFile(p.fd))
+ if (!m->WriteAttachment(new internal::PlatformFileAttachment(p.fd)))
NOTREACHED();
}
}
@@ -486,11 +492,11 @@ bool ParamTraits<base::FileDescriptor>::Read(const Message* m,
if (!valid)
return true;
- base::ScopedFD fd;
- if (!m->ReadFile(iter, &fd))
+ scoped_refptr<MessageAttachment> attachment;
+ if (!m->ReadAttachment(iter, &attachment))
return false;
- *r = base::FileDescriptor(fd.release(), true);
+ *r = base::FileDescriptor(attachment->TakePlatformFile(), true);
return true;
}
@@ -726,7 +732,7 @@ void ParamTraits<Message>::Write(Message* m, const Message& p) {
#if defined(OS_POSIX)
// We don't serialize the file descriptors in the nested message, so there
// better not be any.
- DCHECK(!p.HasFileDescriptors());
+ DCHECK(!p.HasAttachments());
#endif
// Don't just write out the message. This is used to send messages between
« no previous file with comments | « ipc/ipc_message_attachment_set_posix_unittest.cc ('k') | ipc/ipc_platform_file_attachment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698