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

Unified Diff: ui/events/platform/x11/x11_event_source_libevent.cc

Issue 2414863002: Remove usage of base::ObserverList<T>::Iter::GetNext() in //ui. (Closed)
Patch Set: Created 4 years, 2 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: ui/events/platform/x11/x11_event_source_libevent.cc
diff --git a/ui/events/platform/x11/x11_event_source_libevent.cc b/ui/events/platform/x11/x11_event_source_libevent.cc
index 708ab4104a4d9dc4821b50414e1d6f094950805d..3d5863b4e83c725cb0f9261c514f2563840545f3 100644
--- a/ui/events/platform/x11/x11_event_source_libevent.cc
+++ b/ui/events/platform/x11/x11_event_source_libevent.cc
@@ -179,12 +179,9 @@ void X11EventSourceLibevent::AddEventWatcher() {
}
void X11EventSourceLibevent::DispatchXEventToXEventDispatchers(XEvent* xevent) {
- if (dispatchers_xevent_.might_have_observers()) {
sky 2016/10/13 02:20:57 This code is called on every mouse event, so it se
dcheng 2016/10/13 02:39:22 Creation of the iterator is cheap if might_have_ob
loyso (OOO) 2016/10/13 02:40:26 We have that optimization as a built-in. If underl
- base::ObserverList<XEventDispatcher>::Iterator iter(&dispatchers_xevent_);
- while (XEventDispatcher* dispatcher = iter.GetNext()) {
- if (dispatcher->DispatchXEvent(xevent))
- break;
- }
+ for (auto& dispatcher : dispatchers_xevent_) {
+ if (dispatcher.DispatchXEvent(xevent))
+ break;
}
}

Powered by Google App Engine
This is Rietveld 408576698