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

Unified Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 2013673002: ChannelMojo: Don't signal Channel errors with lock held (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo.cc
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index a46ccde21d9a88149a82a9d297ad3fe914073bf3..74fec87c6ee708ae7827c36d61970c5c91e58e87 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -329,15 +329,20 @@ void ChannelMojo::OnPipeError() {
}
bool ChannelMojo::Send(Message* message) {
- base::AutoLock lock(lock_);
- if (!message_reader_) {
- pending_messages_.push_back(base::WrapUnique(message));
- // Counts as OK before the connection is established, but it's an
- // error otherwise.
- return waiting_connect_;
+ bool sent = false;
+ {
+ base::AutoLock lock(lock_);
+ if (!message_reader_) {
+ pending_messages_.push_back(base::WrapUnique(message));
+ // Counts as OK before the connection is established, but it's an
+ // error otherwise.
+ return waiting_connect_;
+ }
+
+ sent = message_reader_->Send(base::WrapUnique(message));
}
- if (!message_reader_->Send(base::WrapUnique(message))) {
+ if (!sent) {
OnPipeError();
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698