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

Unified Diff: mojo/system/channel.cc

Issue 488003006: Mojo: Don't call Channel::HandleRemoteError() under lock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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: mojo/system/channel.cc
diff --git a/mojo/system/channel.cc b/mojo/system/channel.cc
index 78bd42805f95fe9a910e1dfe730cbfeec9e1cfe1..8d5470d6cc41437db4df5dc46b9d70f6e42d7552 100644
--- a/mojo/system/channel.cc
+++ b/mojo/system/channel.cc
@@ -348,6 +348,7 @@ void Channel::OnReadMessageForDownstream(
}
EndpointInfo endpoint_info;
+ bool nonexistent_local_id_error = false;
{
base::AutoLock locker(lock_);
@@ -358,18 +359,21 @@ void Channel::OnReadMessageForDownstream(
IdToEndpointInfoMap::const_iterator it =
local_id_to_endpoint_info_map_.find(local_id);
- if (it == local_id_to_endpoint_info_map_.end()) {
- HandleRemoteError(base::StringPrintf(
- "Received a message for nonexistent local destination ID %u",
- static_cast<unsigned>(local_id)));
- // This is strongly indicative of some problem. However, it's not a fatal
- // error, since it may indicate a bug (or hostile) remote process. Don't
- // die even for Debug builds, since handling this properly needs to be
- // tested (TODO(vtl)).
- DLOG(ERROR) << "This should not happen under normal operation.";
- return;
- }
- endpoint_info = it->second;
+ if (it == local_id_to_endpoint_info_map_.end())
+ nonexistent_local_id_error = true;
+ else
+ endpoint_info = it->second;
+ }
+ if (nonexistent_local_id_error) {
+ HandleRemoteError(base::StringPrintf(
+ "Received a message for nonexistent local destination ID %u",
+ static_cast<unsigned>(local_id)));
+ // This is strongly indicative of some problem. However, it's not a fatal
+ // error, since it may indicate a buggy (or hostile) remote process. Don't
+ // die even for Debug builds, since handling this properly needs to be
+ // tested (TODO(vtl)).
+ DLOG(ERROR) << "This should not happen under normal operation.";
+ return;
}
// Ignore messages for zombie endpoints (not an error).
« 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