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

Unified Diff: ipc/ipc_message_attachment_set.cc

Issue 1414503009: IPC: Remove unnecessary conversions of BrokerableAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from tsepez. Created 5 years, 2 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_set.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..16446c56ff411e6c163815bdb40531a2eca0be0a 100644
--- a/ipc/ipc_message_attachment_set.cc
+++ b/ipc/ipc_message_attachment_set.cc
@@ -175,26 +175,18 @@ 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) {
+ DCHECK_NE(BrokerableAttachment::PLACEHOLDER, attachment->GetBrokerableType());
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;
}
« no previous file with comments | « ipc/ipc_message_attachment_set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698