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

Unified Diff: mojo/message_pump/message_pump_mojo.h

Issue 1448233002: Avoid iterating over all handles in MessagePumpMojo on every iteration to calculate deadlines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 1 month 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 | mojo/message_pump/message_pump_mojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/message_pump/message_pump_mojo.h
diff --git a/mojo/message_pump/message_pump_mojo.h b/mojo/message_pump/message_pump_mojo.h
index 06869730eec7a0e1fa83622b3639432e905a744e..50c7812a0d6385c79019dbf07486e000228cb3a2 100644
--- a/mojo/message_pump/message_pump_mojo.h
+++ b/mojo/message_pump/message_pump_mojo.h
@@ -6,6 +6,7 @@
#define MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_H_
#include <map>
+#include <set>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
@@ -117,6 +118,10 @@ class MOJO_MESSAGE_PUMP_EXPORT MessagePumpMojo : public base::MessagePump {
base::Lock run_state_lock_;
HandleToHandler handlers_;
+ // Set of handles that have a deadline set. Avoids iterating over all elements
+ // in |handles_| in the common case (no deadline set).
+ // TODO(amistry): Make this better and avoid special-casing deadlines.
+ std::set<Handle> deadline_handles_;
// An ever increasing value assigned to each Handler::id. Used to detect
// uniqueness while notifying. That is, while notifying expired timers we copy
« no previous file with comments | « no previous file | mojo/message_pump/message_pump_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698