| Index: ipc/ipc_message.cc
|
| diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
|
| index f5e9ac7a8b807cd04842aa8139a5b9b8cfb0b9ee..008401f14f358c620a7e6a206bb9fb969fa63220 100644
|
| --- a/ipc/ipc_message.cc
|
| +++ b/ipc/ipc_message.cc
|
| @@ -166,14 +166,18 @@
|
|
|
| bool Message::WriteAttachment(
|
| scoped_refptr<base::Pickle::Attachment> attachment) {
|
| + bool brokerable;
|
| size_t index;
|
| bool success = attachment_set()->AddAttachment(
|
| make_scoped_refptr(static_cast<MessageAttachment*>(attachment.get())),
|
| - &index);
|
| + &index, &brokerable);
|
| DCHECK(success);
|
|
|
| // NOTE: If you add more data to the pickle, make sure to update
|
| // PickleSizer::AddAttachment.
|
| +
|
| + // Write the type of descriptor.
|
| + WriteBool(brokerable);
|
|
|
| // Write the index of the descriptor so that we don't have to
|
| // keep the current descriptor as extra decoding state when deserialising.
|
| @@ -185,6 +189,10 @@
|
| bool Message::ReadAttachment(
|
| base::PickleIterator* iter,
|
| scoped_refptr<base::Pickle::Attachment>* attachment) const {
|
| + bool brokerable;
|
| + if (!iter->ReadBool(&brokerable))
|
| + return false;
|
| +
|
| int index;
|
| if (!iter->ReadInt(&index))
|
| return false;
|
| @@ -193,7 +201,9 @@
|
| if (!attachment_set)
|
| return false;
|
|
|
| - *attachment = attachment_set->GetAttachmentAt(index);
|
| + *attachment = brokerable
|
| + ? attachment_set->GetBrokerableAttachmentAt(index)
|
| + : attachment_set->GetNonBrokerableAttachmentAt(index);
|
|
|
| return nullptr != attachment->get();
|
| }
|
| @@ -202,4 +212,13 @@
|
| return attachment_set_.get() && !attachment_set_->empty();
|
| }
|
|
|
| +bool Message::HasMojoHandles() const {
|
| + return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0;
|
| +}
|
| +
|
| +bool Message::HasBrokerableAttachments() const {
|
| + return attachment_set_.get() &&
|
| + attachment_set_->num_brokerable_attachments() > 0;
|
| +}
|
| +
|
| } // namespace IPC
|
|
|