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

Unified Diff: ipc/attachment_broker_win.cc

Issue 1206093002: Update ChannelReader to use AttachmentBroker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachment_broker3_listener
Patch Set: Created 5 years, 6 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/attachment_broker_win.cc
diff --git a/ipc/attachment_broker_win.cc b/ipc/attachment_broker_win.cc
index 89d193c7326bc13e73c774ae9e4346daa9192518..5d4b74dff250c3a40ea434153d8f616073d8a2fc 100644
--- a/ipc/attachment_broker_win.cc
+++ b/ipc/attachment_broker_win.cc
@@ -41,8 +41,15 @@ bool AttachmentBrokerWin::SendAttachmentToProcess(
bool AttachmentBrokerWin::GetAttachmentWithId(
BrokerableAttachment::AttachmentId id,
- BrokerableAttachment* attachment) {
- // TODO(erikchen): Implement me. http://crbug.com/493414
+ scoped_refptr<BrokerableAttachment>* out_attachment) {
+ for (AttachmentVector::iterator it = attachments_.begin();
+ it != attachments_.end(); ++it) {
+ if ((*it)->GetIdentifier() == id) {
+ *out_attachment = *it;
+ attachments_.erase(it);
+ return true;
+ }
+ }
return false;
}
@@ -65,6 +72,7 @@ void AttachmentBrokerWin::OnWinHandleHasBeenDuplicated(
scoped_refptr<BrokerableAttachment> attachment(
new IPC::internal::HandleAttachmentWin(wire_format));
attachments_.push_back(attachment);
+ NotifyObservers(attachment->GetIdentifier());
}
} // namespace IPC

Powered by Google App Engine
This is Rietveld 408576698