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

Unified Diff: ui/ozone/platform/drm/gpu/drm_gpu_platform_support.cc

Issue 1042903004: [Ozone-Drm] Fallback silently when main thread runner is not present (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix conditional Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ ||
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698