diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-16 16:56:20 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-16 16:56:20 +0000 |
commit | 885fe5dc0508fa7973397d2414049ba2f4b9bf9d (patch) | |
tree | 85e47f6c95822e2592f753c9c4dfb71762913278 | |
parent | 60c86b06ecb35404f9bdde6255dd66505d4bb160 (diff) | |
download | chromium_src-885fe5dc0508fa7973397d2414049ba2f4b9bf9d.zip chromium_src-885fe5dc0508fa7973397d2414049ba2f4b9bf9d.tar.gz chromium_src-885fe5dc0508fa7973397d2414049ba2f4b9bf9d.tar.bz2 |
ozone: Remove the explicit call to start listening for events.
It is not necessary for WindowTreeHostOzone to call into the event-factory
to explicitly request it to start receiving events. The evdev implementation
can start listening to the events immediately, and the canca implementation
can start listening for events when the dispatcher list changes (this is the
same we do for the libevent based x11 event-source).
BUG=361137
R=spang@chromium.org
Review URL: https://codereview.chromium.org/285303004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271036 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/aura/window_tree_host_ozone.cc | 5 | ||||
-rw-r--r-- | ui/events/ozone/evdev/event_factory_evdev.cc | 29 | ||||
-rw-r--r-- | ui/events/ozone/evdev/event_factory_evdev.h | 9 | ||||
-rw-r--r-- | ui/events/ozone/event_factory_ozone.cc | 2 | ||||
-rw-r--r-- | ui/events/ozone/event_factory_ozone.h | 8 | ||||
-rw-r--r-- | ui/ozone/platform/caca/caca_event_factory.cc | 8 | ||||
-rw-r--r-- | ui/ozone/platform/caca/caca_event_factory.h | 9 |
7 files changed, 19 insertions, 51 deletions
diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc index 2251eb3..5b8be53 100644 --- a/ui/aura/window_tree_host_ozone.cc +++ b/ui/aura/window_tree_host_ozone.cc @@ -15,11 +15,6 @@ namespace aura { WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) : widget_(0), bounds_(bounds) { - // EventFactoryOzone creates converters that obtain input events from the - // underlying input system and dispatch them as |ui::Event| instances into - // Aura. - ui::EventFactoryOzone::GetInstance()->StartProcessingEvents(); - gfx::SurfaceFactoryOzone* surface_factory = gfx::SurfaceFactoryOzone::GetInstance(); widget_ = surface_factory->GetAcceleratedWidget(); diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc index cd67af6..216488e 100644 --- a/ui/events/ozone/evdev/event_factory_evdev.cc +++ b/ui/events/ozone/evdev/event_factory_evdev.cc @@ -134,13 +134,13 @@ EventFactoryEvdev::EventFactoryEvdev( CursorDelegateEvdev* cursor, DeviceManager* device_manager) : device_manager_(device_manager), - has_started_processing_events_(false), - ui_task_runner_(base::MessageLoopProxy::current()), cursor_(cursor), dispatch_callback_( base::Bind(base::IgnoreResult(&EventFactoryEvdev::DispatchUiEvent), base::Unretained(this))), - weak_ptr_factory_(this) {} + weak_ptr_factory_(this) { + CHECK(device_manager_); +} EventFactoryEvdev::~EventFactoryEvdev() { STLDeleteValues(&converters_); } @@ -197,10 +197,12 @@ void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) { } void EventFactoryEvdev::OnDispatcherListChanged() { - if (ui_task_runner_) - return; - ui_task_runner_ = base::MessageLoopProxy::current(); - StartProcessingEvents(); + if (!ui_task_runner_) { + ui_task_runner_ = base::MessageLoopProxy::current(); + // Scan & monitor devices. + device_manager_->AddObserver(this); + device_manager_->ScanDevices(this); + } } void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) { @@ -224,19 +226,6 @@ void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) { } } -void EventFactoryEvdev::StartProcessingEvents() { - if (!ui_task_runner_) - return; - CHECK(ui_task_runner_->RunsTasksOnCurrentThread()); - - if (device_manager_ && !has_started_processing_events_) { - has_started_processing_events_ = true; - // Scan & monitor devices. - device_manager_->AddObserver(this); - device_manager_->ScanDevices(this); - } -} - void EventFactoryEvdev::WarpCursorTo(gfx::AcceleratedWidget widget, const gfx::PointF& location) { if (cursor_) { diff --git a/ui/events/ozone/evdev/event_factory_evdev.h b/ui/events/ozone/evdev/event_factory_evdev.h index f4ded50..da56524 100644 --- a/ui/events/ozone/evdev/event_factory_evdev.h +++ b/ui/events/ozone/evdev/event_factory_evdev.h @@ -34,7 +34,6 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public EventFactoryOzone, void DispatchUiEvent(Event* event); // EventFactoryOzone: - virtual void StartProcessingEvents() OVERRIDE; virtual void WarpCursorTo(gfx::AcceleratedWidget widget, const gfx::PointF& location) OVERRIDE; @@ -60,14 +59,6 @@ class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public EventFactoryOzone, // Interface for scanning & monitoring input devices. DeviceManager* device_manager_; // Not owned. - // True if this was registered with |device_manager_|. This is needed since - // StartProcessingEvents() is called multiple times (when a - // WindowTreeHostOzone is created) but we shouldn't register this multiple - // times. - // TODO(dnicoara) Remove once event processing is refactored and we no longer - // rely on WTH for starting event processing. - bool has_started_processing_events_; - // Task runner for event dispatch. scoped_refptr<base::TaskRunner> ui_task_runner_; diff --git a/ui/events/ozone/event_factory_ozone.cc b/ui/events/ozone/event_factory_ozone.cc index 3a56ddc..79d6ece 100644 --- a/ui/events/ozone/event_factory_ozone.cc +++ b/ui/events/ozone/event_factory_ozone.cc @@ -26,8 +26,6 @@ EventFactoryOzone* EventFactoryOzone::GetInstance() { return impl_; } -void EventFactoryOzone::StartProcessingEvents() {} - void EventFactoryOzone::WarpCursorTo(gfx::AcceleratedWidget widget, const gfx::PointF& location) { NOTIMPLEMENTED(); diff --git a/ui/events/ozone/event_factory_ozone.h b/ui/events/ozone/event_factory_ozone.h index d243761..b552d88 100644 --- a/ui/events/ozone/event_factory_ozone.h +++ b/ui/events/ozone/event_factory_ozone.h @@ -30,14 +30,6 @@ class EVENTS_OZONE_EXPORT EventFactoryOzone { EventFactoryOzone(); virtual ~EventFactoryOzone(); - // Called from WindowTreeHostOzone to initialize and start processing events. - // This should create the initial set of converters, and potentially arrange - // for more converters to be created as new event sources become available. - // No events processing should happen until this is called. All processes have - // an EventFactoryOzone but not all of them should process events. In chrome, - // events are dispatched in the browser process on the UI thread. - virtual void StartProcessingEvents(); - // Request to warp the cursor to a location within an AccelerateWidget. // If the cursor actually moves, the implementation must dispatch a mouse // move event with the new location. diff --git a/ui/ozone/platform/caca/caca_event_factory.cc b/ui/ozone/platform/caca/caca_event_factory.cc index dd8bfc2..c17e5a4 100644 --- a/ui/ozone/platform/caca/caca_event_factory.cc +++ b/ui/ozone/platform/caca/caca_event_factory.cc @@ -146,15 +146,15 @@ CacaEventFactory::CacaEventFactory(CacaConnection* connection) CacaEventFactory::~CacaEventFactory() { } -void CacaEventFactory::StartProcessingEvents() { - ScheduleEventProcessing(); -} - void CacaEventFactory::WarpCursorTo(gfx::AcceleratedWidget widget, const gfx::PointF& location) { NOTIMPLEMENTED(); } +void CacaEventFactory::OnDispatcherListChanged() { + ScheduleEventProcessing(); +} + void CacaEventFactory::ScheduleEventProcessing() { // Caca uses a poll based event retrieval. Since we don't want to block we'd // either need to spin up a new thread or just poll. For simplicity just poll diff --git a/ui/ozone/platform/caca/caca_event_factory.h b/ui/ozone/platform/caca/caca_event_factory.h index 18afe35..b3f13d1 100644 --- a/ui/ozone/platform/caca/caca_event_factory.h +++ b/ui/ozone/platform/caca/caca_event_factory.h @@ -15,17 +15,20 @@ namespace ui { class CacaConnection; -class CacaEventFactory : public EventFactoryOzone, PlatformEventSource { +class CacaEventFactory : public EventFactoryOzone, + public PlatformEventSource { public: CacaEventFactory(CacaConnection* connection); virtual ~CacaEventFactory(); - // ui::EventFactoryOzone overrides: - virtual void StartProcessingEvents() OVERRIDE; + // ui::EventFactoryOzone: virtual void WarpCursorTo(gfx::AcceleratedWidget widget, const gfx::PointF& location) OVERRIDE; private: + // PlatformEventSource: + virtual void OnDispatcherListChanged() OVERRIDE; + void ScheduleEventProcessing(); void TryProcessingEvent(); |