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

Unified Diff: ipc/ipc_message_attachment_set.h

Issue 856443003: IPC: Introduce MessageAttachment and PlatformFileAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing 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.cc ('k') | ipc/ipc_message_attachment_set.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_attachment_set.h
diff --git a/ipc/ipc_message_attachment_set.h b/ipc/ipc_message_attachment_set.h
index a257dd00a88f26e4e7ded7d87bdfb6b20a630155..a143570c4f92665379b5260334a67f6ccc38a4e2 100644
--- a/ipc/ipc_message_attachment_set.h
+++ b/ipc/ipc_message_attachment_set.h
@@ -18,6 +18,8 @@
namespace IPC {
+class MessageAttachment;
+
// -----------------------------------------------------------------------------
// A MessageAttachmentSet is an ordered set of POSIX file descriptors. These are
// associated with IPC messages so that descriptors can be transmitted over a
@@ -28,11 +30,16 @@ class IPC_EXPORT MessageAttachmentSet
public:
MessageAttachmentSet();
- // Return the number of descriptors
+ // Return the number of attachments
unsigned size() const;
+ // Return the number of file descriptors
+ unsigned num_descriptors() const;
// Return true if no unconsumed descriptors remain
bool empty() const { return 0 == size(); }
+ void AddAttachment(scoped_refptr<MessageAttachment> attachment);
+ scoped_refptr<MessageAttachment> GetAttachmentAt(unsigned index);
+
#if defined(OS_POSIX)
// This is the maximum number of descriptors per message. We need to know this
// because the control message kernel interface has to be given a buffer which
@@ -105,12 +112,15 @@ class IPC_EXPORT MessageAttachmentSet
~MessageAttachmentSet();
+ // A vector of attachments of the message, which might be |PlatformFile| or
+ // |MessagePipe|.
+ std::vector<scoped_refptr<MessageAttachment>> attachments_;
+
#if defined(OS_POSIX)
- // A vector of descriptors and close flags. If this message is sent, then
- // these descriptors are sent as control data. After sending, any descriptors
- // with a true flag are closed. If this message has been received, then these
- // are the descriptors which were received and all close flags are true.
- std::vector<base::PlatformFile> descriptors_;
+ // A vector of owning descriptors. If this message is sent, then file
+ // descriptors are sent as control data. After sending, any owning descriptors
+ // are closed. If this message has been received then all received
+ // descriptors are owned by this message.
ScopedVector<base::ScopedFD> owned_descriptors_;
#endif
« no previous file with comments | « ipc/ipc_message_attachment.cc ('k') | ipc/ipc_message_attachment_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698