Index: mojo/public/tests/simple_bindings_support.cc |
diff --git a/mojo/public/tests/simple_bindings_support.cc b/mojo/public/tests/simple_bindings_support.cc |
index 979474dfe5acf289d3e42fc8742b5f13d54eecd8..865099b65ed4336733c8c1a3f82ca0a1756dff79 100644 |
--- a/mojo/public/tests/simple_bindings_support.cc |
+++ b/mojo/public/tests/simple_bindings_support.cc |
@@ -43,28 +43,32 @@ void SimpleBindingsSupport::CancelWait(AsyncWaitCallback* callback) { |
} |
void SimpleBindingsSupport::Process() { |
- typedef std::pair<AsyncWaitCallback*, MojoResult> Result; |
- std::list<Result> results; |
+ for (;;) { |
+ typedef std::pair<AsyncWaitCallback*, MojoResult> Result; |
+ std::list<Result> results; |
- // TODO(darin): Honor given deadline. |
+ // TODO(darin): Honor given deadline. |
- std::list<Waiter>::iterator it = waiters_.begin(); |
- while (it != waiters_.end()) { |
- const Waiter& waiter = *it; |
- MojoResult result; |
- if (IsReady(waiter.handle, waiter.flags, &result)) { |
- results.push_back(std::make_pair(waiter.callback, result)); |
- std::list<Waiter>::iterator doomed = it++; |
- waiters_.erase(doomed); |
- } else { |
- ++it; |
+ std::list<Waiter>::iterator it = waiters_.begin(); |
+ while (it != waiters_.end()) { |
+ const Waiter& waiter = *it; |
+ MojoResult result; |
+ if (IsReady(waiter.handle, waiter.flags, &result)) { |
+ results.push_back(std::make_pair(waiter.callback, result)); |
+ std::list<Waiter>::iterator doomed = it++; |
+ waiters_.erase(doomed); |
+ } else { |
+ ++it; |
+ } |
} |
- } |
- for (std::list<Result>::const_iterator it = results.begin(); |
- it != results.end(); |
- ++it) { |
- it->first->OnHandleReady(it->second); |
+ for (std::list<Result>::const_iterator it = results.begin(); |
+ it != results.end(); |
+ ++it) { |
+ it->first->OnHandleReady(it->second); |
+ } |
+ if (results.empty()) |
+ break; |
} |
} |