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

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: 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
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..9d1604c6bd948c8a511ef33ee276f6eb9ab69528 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 attachmentes
agl 2015/01/15 03:00:53 attachments
Hajime Morrita 2015/01/23 00:29:05 Done.
unsigned size() const;
+ // Return the number of file descriptors
+ unsigned file_size() const;
agl 2015/01/15 03:00:53 file_size seems like a poor name for this. num_fd
Hajime Morrita 2015/01/23 00:29:05 Makes sense. Renamed to num_descriptors().
// Return true if no unconsumed descriptors remain
bool empty() const { return 0 == size(); }
+ void AddAttachment(scoped_refptr<MessageAttachment> attachment);
+ scoped_refptr<MessageAttachment> TakeAttachmentAt(unsigned index);
agl 2015/01/15 03:00:53 It's called TakeAttachmentAt, but it returns a ref
Hajime Morrita 2015/01/23 00:29:05 Uh, the name was leftover of my failed experiment.
+
#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
agl 2015/01/15 03:00:53 . after "descriptors"
Hajime Morrita 2015/01/23 00:29:05 Done.
+ // descriptors are sent as control data. After sending, any owning descriptors
+ // are closed. If this message has been received, then all received
agl 2015/01/15 03:00:53 no comma before "then" (existing issue).
Hajime Morrita 2015/01/23 00:29:05 Done.
+ // descriptors are owned by this message.
ScopedVector<base::ScopedFD> owned_descriptors_;
#endif

Powered by Google App Engine
This is Rietveld 408576698