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

Unified Diff: mojo/common/message_pump_mojo.cc

Issue 409943003: Makes HandleWatcher block until no longer waiting on pipe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more java fixes Created 6 years, 5 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: mojo/common/message_pump_mojo.cc
diff --git a/mojo/common/message_pump_mojo.cc b/mojo/common/message_pump_mojo.cc
index 37d636bc8f462af2e10856e483e2ad3b66b98366..c7903f2831be0bf5666ee3e7c1488b23ab2716b9 100644
--- a/mojo/common/message_pump_mojo.cc
+++ b/mojo/common/message_pump_mojo.cc
@@ -157,7 +157,6 @@ void MessagePumpMojo::DoInternalWork(const RunState& run_state, bool block) {
switch (result) {
case MOJO_RESULT_CANCELLED:
case MOJO_RESULT_FAILED_PRECONDITION:
- case MOJO_RESULT_INVALID_ARGUMENT:
RemoveFirstInvalidHandle(wait_state);
break;
case MOJO_RESULT_DEADLINE_EXCEEDED:
@@ -190,9 +189,13 @@ void MessagePumpMojo::RemoveFirstInvalidHandle(const WaitState& wait_state) {
for (size_t i = 1; i < wait_state.handles.size(); ++i) {
const MojoResult result =
Wait(wait_state.handles[i], wait_state.wait_signals[i], 0);
- if (result == MOJO_RESULT_INVALID_ARGUMENT ||
- result == MOJO_RESULT_FAILED_PRECONDITION ||
- result == MOJO_RESULT_CANCELLED) {
+ if (result == MOJO_RESULT_INVALID_ARGUMENT) {
+ // We should never have an invalid argument. If we do it indicates
+ // RemoveHandler() was not invoked and is likely to cause problems else
+ // where in the stack if we ignore it.
+ CHECK(false);
+ } else if (result == MOJO_RESULT_FAILED_PRECONDITION ||
+ result == MOJO_RESULT_CANCELLED) {
// Remove the handle first, this way if OnHandleError() tries to remove
// the handle our iterator isn't invalidated.
DCHECK(handlers_.find(wait_state.handles[i]) != handlers_.end());

Powered by Google App Engine
This is Rietveld 408576698