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

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: Add const to HasHandler() 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
« no previous file with comments | « mojo/public/utility/run_loop.h ('k') | mojo/public/utility/run_loop_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bef601ca6d10ed99844f3afaa2228d1cad6fbf2b 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) const {
+ 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);
}
}
« no previous file with comments | « mojo/public/utility/run_loop.h ('k') | mojo/public/utility/run_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698