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

Unified Diff: ui/events/ozone/evdev/event_factory_evdev.cc

Issue 661353006: ozone: evdev: Dispatch events in task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 6 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/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)));
}
}
« no previous file with comments | « ui/events/ozone/evdev/event_factory_evdev.h ('k') | ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698