Index: ipc/ipc_message_attachment_set.cc |
diff --git a/ipc/ipc_message_attachment_set.cc b/ipc/ipc_message_attachment_set.cc |
index cb74a5aaf07193c8d57367923a52557d40999ab4..67e24678c3db3858589a7caaf5d5ae65abe2b358 100644 |
--- a/ipc/ipc_message_attachment_set.cc |
+++ b/ipc/ipc_message_attachment_set.cc |
@@ -7,6 +7,7 @@ |
#include <algorithm> |
#include "base/logging.h" |
#include "base/posix/eintr_wrapper.h" |
+#include "ipc/brokerable_attachment.h" |
#include "ipc/ipc_message_attachment.h" |
#if defined(OS_POSIX) |
@@ -52,6 +53,14 @@ unsigned MessageAttachmentSet::num_mojo_handles() const { |
}); |
} |
+unsigned MessageAttachmentSet::num_brokerable_attachments() const { |
+ return std::count_if(attachments_.begin(), attachments_.end(), |
Tom Sepez
2015/06/19 18:04:11
C++11 std library not yet allowed AFAIK (as much a
erikchen
2015/06/23 22:37:00
The latter problem could be fixed, but the former
|
+ [](scoped_refptr<MessageAttachment> i) { |
+ return i->GetType() == |
+ MessageAttachment::TYPE_BROKERABLE_ATTACHMENT; |
+ }); |
+} |
+ |
unsigned MessageAttachmentSet::size() const { |
return static_cast<unsigned>(attachments_.size()); |
} |
@@ -114,6 +123,20 @@ void MessageAttachmentSet::CommitAll() { |
consumed_descriptor_highwater_ = 0; |
} |
+std::vector<scoped_refptr<BrokerableAttachment>> |
+MessageAttachmentSet::PeekBrokerableAttachments() const { |
+ std::vector<scoped_refptr<BrokerableAttachment>> output; |
+ for (const scoped_refptr<MessageAttachment>& attachment : attachments_) { |
+ if (attachment->GetType() == |
+ MessageAttachment::TYPE_BROKERABLE_ATTACHMENT) { |
+ scoped_refptr<BrokerableAttachment> brokerable_attachment( |
+ static_cast<BrokerableAttachment*>(attachment.get())); |
+ output.push_back(brokerable_attachment); |
+ } |
+ } |
+ return output; |
+} |
+ |
#if defined(OS_POSIX) |
void MessageAttachmentSet::PeekDescriptors(base::PlatformFile* buffer) const { |