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

Unified Diff: ui/wm/core/compound_event_filter.cc

Issue 2414863002: Remove usage of base::ObserverList<T>::Iter::GetNext() in //ui. (Closed)
Patch Set: debrace 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
« no previous file with comments | « ui/views/mus/pointer_watcher_event_router.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/compound_event_filter.cc
diff --git a/ui/wm/core/compound_event_filter.cc b/ui/wm/core/compound_event_filter.cc
index 0e655257a32558c86f56f84a353eda1b35b61389..d487b1a7d1b6361e40aab901f4cd995400c35ef2 100644
--- a/ui/wm/core/compound_event_filter.cc
+++ b/ui/wm/core/compound_event_filter.cc
@@ -129,29 +129,26 @@ void CompoundEventFilter::UpdateCursor(aura::Window* target,
}
void CompoundEventFilter::FilterKeyEvent(ui::KeyEvent* event) {
- if (handlers_.might_have_observers()) {
- base::ObserverListBase<ui::EventHandler>::Iterator it(&handlers_);
- ui::EventHandler* handler;
- while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL)
- handler->OnKeyEvent(event);
+ for (ui::EventHandler& handler : handlers_) {
+ if (event->stopped_propagation())
+ break;
+ handler.OnKeyEvent(event);
}
}
void CompoundEventFilter::FilterMouseEvent(ui::MouseEvent* event) {
- if (handlers_.might_have_observers()) {
- base::ObserverListBase<ui::EventHandler>::Iterator it(&handlers_);
- ui::EventHandler* handler;
- while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL)
- handler->OnMouseEvent(event);
+ for (ui::EventHandler& handler : handlers_) {
+ if (event->stopped_propagation())
+ break;
+ handler.OnMouseEvent(event);
}
}
void CompoundEventFilter::FilterTouchEvent(ui::TouchEvent* event) {
- if (handlers_.might_have_observers()) {
- base::ObserverListBase<ui::EventHandler>::Iterator it(&handlers_);
- ui::EventHandler* handler;
- while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL)
- handler->OnTouchEvent(event);
+ for (ui::EventHandler& handler : handlers_) {
+ if (event->stopped_propagation())
+ break;
+ handler.OnTouchEvent(event);
}
}
@@ -240,11 +237,10 @@ void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
}
void CompoundEventFilter::OnGestureEvent(ui::GestureEvent* event) {
- if (handlers_.might_have_observers()) {
- base::ObserverListBase<ui::EventHandler>::Iterator it(&handlers_);
- ui::EventHandler* handler;
- while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL)
- handler->OnGestureEvent(event);
+ for (ui::EventHandler& handler : handlers_) {
+ if (event->stopped_propagation())
+ break;
+ handler.OnGestureEvent(event);
}
}
« no previous file with comments | « ui/views/mus/pointer_watcher_event_router.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698