Index: ipc/ipc_message_attachment_set.cc |
diff --git a/ipc/ipc_message_attachment_set.cc b/ipc/ipc_message_attachment_set.cc |
index b290e0ad6a4cf715a786e22431895ee374b94e89..fe18feb09477243685a20bebdb72d28075d476d7 100644 |
--- a/ipc/ipc_message_attachment_set.cc |
+++ b/ipc/ipc_message_attachment_set.cc |
@@ -175,26 +175,17 @@ void MessageAttachmentSet::CommitAllDescriptors() { |
consumed_descriptor_highwater_ = 0; |
} |
-std::vector<BrokerableAttachment*> |
+std::vector<scoped_refptr<IPC::BrokerableAttachment>> |
MessageAttachmentSet::GetBrokerableAttachments() const { |
- std::vector<BrokerableAttachment*> output; |
- for (const scoped_refptr<MessageAttachment>& attachment : |
- brokerable_attachments_) { |
- output.push_back(static_cast<BrokerableAttachment*>(attachment.get())); |
- } |
- return output; |
+ return brokerable_attachments_; |
} |
void MessageAttachmentSet::ReplacePlaceholderWithAttachment( |
- const scoped_refptr<BrokerableAttachment>& attachment) { |
+ scoped_refptr<BrokerableAttachment> attachment) { |
Tom Sepez
2015/10/29 19:12:51
I think this can still be const&
erikchen
2015/10/29 19:53:54
Passing by const& will produce the wrong behavior
|
for (auto it = brokerable_attachments_.begin(); |
it != brokerable_attachments_.end(); ++it) { |
- BrokerableAttachment* brokerable_attachment = |
- static_cast<BrokerableAttachment*>(it->get()); |
- |
- if (brokerable_attachment->GetBrokerableType() == |
- BrokerableAttachment::PLACEHOLDER && |
- brokerable_attachment->GetIdentifier() == attachment->GetIdentifier()) { |
+ if ((*it)->GetBrokerableType() == BrokerableAttachment::PLACEHOLDER && |
+ (*it)->GetIdentifier() == attachment->GetIdentifier()) { |
*it = attachment; |
return; |
} |