| Index: ui/ozone/platform/drm/cursor_proxy_mojo.cc
|
| diff --git a/ui/ozone/platform/drm/cursor_proxy_mojo.cc b/ui/ozone/platform/drm/cursor_proxy_mojo.cc
|
| index a0918fc0a2250a92eb8a51560bd2af26a22277b5..c48ddcad7c494d45fefb385d785b17860dfdb3cc 100644
|
| --- a/ui/ozone/platform/drm/cursor_proxy_mojo.cc
|
| +++ b/ui/ozone/platform/drm/cursor_proxy_mojo.cc
|
| @@ -9,35 +9,45 @@
|
|
|
| namespace ui {
|
|
|
| +// We assume that this is invoked only on the UI thread.
|
| CursorProxyMojo::CursorProxyMojo(service_manager::Connector* connector)
|
| : connector_(connector->Clone()) {
|
| + ui_thread_ref_ = base::PlatformThread::CurrentRef();
|
| connector->BindInterface(ui::mojom::kServiceName, &main_cursor_ptr_);
|
| }
|
|
|
| -void CursorProxyMojo::InitializeOnEvdev() {
|
| - evdev_ref_ = base::PlatformThread::CurrentRef();
|
| - connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
|
| -}
|
| -
|
| CursorProxyMojo::~CursorProxyMojo() {}
|
|
|
| void CursorProxyMojo::CursorSet(gfx::AcceleratedWidget widget,
|
| const std::vector<SkBitmap>& bitmaps,
|
| const gfx::Point& location,
|
| int frame_delay_ms) {
|
| - if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
|
| - evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
|
| - } else {
|
| + InitializeOnEvdevIfNecessary();
|
| + if (ui_thread_ref_ == base::PlatformThread::CurrentRef()) {
|
| main_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
|
| + } else {
|
| + evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
|
| }
|
| }
|
|
|
| void CursorProxyMojo::Move(gfx::AcceleratedWidget widget,
|
| const gfx::Point& location) {
|
| - if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
|
| - evdev_cursor_ptr_->MoveCursor(widget, location);
|
| - } else {
|
| + InitializeOnEvdevIfNecessary();
|
| + if (ui_thread_ref_ == base::PlatformThread::CurrentRef()) {
|
| main_cursor_ptr_->MoveCursor(widget, location);
|
| + } else {
|
| + evdev_cursor_ptr_->MoveCursor(widget, location);
|
| + }
|
| +}
|
| +
|
| +// Evdev runs this method on starting. But if a CursorProxyMojo is created long
|
| +// after Evdev has started (e.g. if the Viz process crashes (and the
|
| +// |CursorProxyMojo| self-destructs and then a new |CursorProxyMojo| is built
|
| +// when the GpuThread/DrmThread pair are once again running), we need to run it
|
| +// on cursor motions.
|
| +void CursorProxyMojo::InitializeOnEvdevIfNecessary() {
|
| + if (ui_thread_ref_ != base::PlatformThread::CurrentRef()) {
|
| + connector_->BindInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
|
| }
|
| }
|
|
|
|
|