Chromium Code Reviews| 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; |
| } |
| } |