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

Unified Diff: ipc/attachment_broker.cc

Issue 1810503002: Handle brokered attachment race condition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker.cc
diff --git a/ipc/attachment_broker.cc b/ipc/attachment_broker.cc
index 45fe1204681395aefc7218e8475dcdfbd784b2e4..df3e724632852d6299efb5ace06c096d1303327d 100644
--- a/ipc/attachment_broker.cc
+++ b/ipc/attachment_broker.cc
@@ -58,6 +58,16 @@ void AttachmentBroker::AddObserver(
info.runner = runner;
info.unique_id = ++last_unique_id_;
observers_.push_back(info);
+
+ // Give the observer a chance to handle attachments that arrived while the
+ // observer was handling the message that caused it to register, but our
+ // mutex was not yet locked.
+ for (const auto& attachment : attachments_) {
+ info.runner->PostTask(
+ FROM_HERE,
+ base::Bind(&AttachmentBroker::NotifyObserver, base::Unretained(this),
+ info.unique_id, attachment->GetIdentifier()));
+ }
}
}
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698