Index: ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
diff --git a/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc b/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
index 58dfe35ffc4cd1a28b6bed0d844587cc40b69d93..76d4108ce3307547a78ef30bfdbef13317e8661b 100644 |
--- a/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
+++ b/ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc |
@@ -37,9 +37,16 @@ class DrmGpuPlatformSupportMessageFilter : public IPC::MessageFilter { |
: window_manager_(window_manager), |
on_filter_added_callback_(on_filter_added_callback), |
main_thread_listener_(main_thread_listener), |
- main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
+ main_thread_task_runner_(0), |
pending_main_thread_operations_(0), |
- cursor_animating_(false) {} |
+ cursor_animating_(false) { |
+ // A bunch of unit tests and targets don't initialize the message loop, so |
+ // the GPU won't have the main thread's handler. In this case, fallback |
+ // silently and don't update the cursor related stuff in OnMessageReceived |
+ // (which is fine, because most of those targets don't use cursor at all). |
+ if (base::ThreadTaskRunnerHandle::IsSet()) |
+ main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
+ } |
void OnFilterAdded(IPC::Sender* sender) override { |
io_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
@@ -64,6 +71,11 @@ class DrmGpuPlatformSupportMessageFilter : public IPC::MessageFilter { |
if (!cursor_position_message && !cursor_state_message) |
return false; |
+ if (!main_thread_task_runner_) { |
+ NOTREACHED() << "Cursor implementation fail."; |
+ return false; |
+ } |
+ |
bool cursor_was_animating = cursor_animating_; |
UpdateAnimationState(message); |
if (cursor_state_message || pending_main_thread_operations_ || |