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

Unified Diff: mojo/public/utility/run_loop.cc

Issue 126883002: Make RunLoop remove handle when a timeout is notified (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/public/utility/run_loop.cc
diff --git a/mojo/public/utility/run_loop.cc b/mojo/public/utility/run_loop.cc
index 5842188add8a20c3afe9e13b9bf6827293aff9f5..988617622d2e6e1185bef022750926fbb960fddf 100644
--- a/mojo/public/utility/run_loop.cc
+++ b/mojo/public/utility/run_loop.cc
@@ -92,6 +92,10 @@ void RunLoop::RemoveHandler(const Handle& handle) {
handler_data_.erase(handle);
}
+bool RunLoop::HasHandler(const Handle& handle) {
+ return handler_data_.find(handle) != handler_data_.end();
+}
+
void RunLoop::Run() {
assert(current() == this);
// We don't currently support nesting.
@@ -154,6 +158,7 @@ void RunLoop::NotifyDeadlineExceeded() {
i->second.deadline < now &&
handler_data_.find(i->first) != handler_data_.end() &&
handler_data_[i->first].id == i->second.id) {
+ handler_data_.erase(i->first);
i->second.handler->OnHandleError(i->first, MOJO_RESULT_DEADLINE_EXCEEDED);
}
}

Powered by Google App Engine
This is Rietveld 408576698