Index: ui/events/ozone/evdev/event_factory_evdev.cc |
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc |
index e87acbf961ed88eb91ef6aeb37c74d2b815dafa1..865b77c13cee5fa7caa5453a0221410cb94bfa7c 100644 |
--- a/ui/events/ozone/evdev/event_factory_evdev.cc |
+++ b/ui/events/ozone/evdev/event_factory_evdev.cc |
@@ -150,8 +150,7 @@ EventFactoryEvdev::EventFactoryEvdev(CursorDelegateEvdev* cursor, |
: last_device_id_(0), |
device_manager_(device_manager), |
dispatch_callback_( |
- base::Bind(base::IgnoreResult(&EventFactoryEvdev::DispatchUiEvent), |
- base::Unretained(this))), |
+ base::Bind(&EventFactoryEvdev::PostUiEvent, base::Unretained(this))), |
keyboard_(&modifiers_, dispatch_callback_), |
cursor_(cursor), |
weak_ptr_factory_(this) { |
@@ -160,8 +159,16 @@ EventFactoryEvdev::EventFactoryEvdev(CursorDelegateEvdev* cursor, |
EventFactoryEvdev::~EventFactoryEvdev() { STLDeleteValues(&converters_); } |
-void EventFactoryEvdev::DispatchUiEvent(Event* event) { |
- DispatchEvent(event); |
+void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { |
+ base::ThreadTaskRunnerHandle::Get()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&EventFactoryEvdev::DispatchUiEventTask, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ base::Passed(&event))); |
+} |
+ |
+void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) { |
+ DispatchEvent(event.get()); |
} |
void EventFactoryEvdev::AttachInputDevice( |
@@ -257,12 +264,11 @@ void EventFactoryEvdev::WarpCursorTo(gfx::AcceleratedWidget widget, |
const gfx::PointF& location) { |
if (cursor_) { |
cursor_->MoveCursorTo(widget, location); |
- MouseEvent mouse_event(ET_MOUSE_MOVED, |
- cursor_->location(), |
- cursor_->location(), |
- modifiers_.GetModifierFlags(), |
- /* changed_button_flags */ 0); |
- DispatchEvent(&mouse_event); |
+ PostUiEvent(make_scoped_ptr(new MouseEvent(ET_MOUSE_MOVED, |
+ cursor_->location(), |
+ cursor_->location(), |
+ modifiers_.GetModifierFlags(), |
+ /* changed_button_flags */ 0))); |
} |
} |