diff options
author | morrita <morrita@chromium.org> | 2015-01-30 21:45:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-31 05:47:43 +0000 |
commit | 1aa788c1f3c5f356b4e06110b5780a1de99c4cd7 (patch) | |
tree | acbbb590d3c776180f6a0d1204f44ceda33058c0 /ipc/mojo/ipc_channel_mojo_unittest.cc | |
parent | f61604541419bac129d2cd88b3d42039f6014161 (diff) | |
download | chromium_src-1aa788c1f3c5f356b4e06110b5780a1de99c4cd7.zip chromium_src-1aa788c1f3c5f356b4e06110b5780a1de99c4cd7.tar.gz chromium_src-1aa788c1f3c5f356b4e06110b5780a1de99c4cd7.tar.bz2 |
IPC::Message Refactoring: Move POSIX specific bits to PlatformFileAttachment
This change:
* Gets rid of MessageAttachmentSet::owning_descriptors_ by moving
the responsibility to PlatformFileAttachment, where owning_
member variable is used to track the lifetime
* Replaces MessageAttachmetnSet::Add*File() and TakePlatformFile()
with platform agnostic AddAttachment() and GetAttachmentAt()
* Repalces Message::ReadFile(), Write*File() with ReadAttachment()
and WriteAttachmente(), which are also platform agnostic.
This also adds MessageAttachment::TakePlatformFile() virtual function,
which will be implemented by upcoming MojoHandleAttachment as well.
This is another preparation for introducing MojoHandleAttachment,
but it also simplifies Message and MessageAttachmentSet.
R=agl@chromium.org
TBR=mtomasz@chromium.org
BUG=448190
Review URL: https://codereview.chromium.org/883093003
Cr-Commit-Position: refs/heads/master@{#314047}
Diffstat (limited to 'ipc/mojo/ipc_channel_mojo_unittest.cc')
-rw-r--r-- | ipc/mojo/ipc_channel_mojo_unittest.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc index 47e72fc..6ebaa73 100644 --- a/ipc/mojo/ipc_channel_mojo_unittest.cc +++ b/ipc/mojo/ipc_channel_mojo_unittest.cc @@ -17,6 +17,7 @@ #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" +#include "ipc/ipc_platform_file_attachment_posix.h" #endif namespace { @@ -328,8 +329,9 @@ class ListenerThatExpectsFile : public IPC::Listener { PickleIterator iter(message); base::ScopedFD fd; - EXPECT_TRUE(message.ReadFile(&iter, &fd)); - base::File file(fd.release()); + scoped_refptr<IPC::MessageAttachment> attachment; + EXPECT_TRUE(message.ReadAttachment(&iter, &attachment)); + base::File file(attachment->TakePlatformFile()); std::string content(GetSendingFileContent().size(), ' '); file.Read(0, &content[0], content.size()); EXPECT_EQ(content, GetSendingFileContent()); @@ -359,7 +361,8 @@ class ListenerThatExpectsFile : public IPC::Listener { file.Flush(); IPC::Message* message = new IPC::Message( 0, 2, IPC::Message::PRIORITY_NORMAL); - message->WriteFile(base::ScopedFD(file.TakePlatformFile())); + message->WriteAttachment(new IPC::internal::PlatformFileAttachment( + base::ScopedFD(file.TakePlatformFile()))); ASSERT_TRUE(sender->Send(message)); } |