ozone: scenic: Use IO message loop for VizCompositorThread
Like Windows, we need to be able to respond to messages from the platform
about display surfaces from any thread that creates them.
Without one it blows up with the following:
ASSERT FAILED at (../../third_party/fuchsia-sdk/sdk/pkg/fidl_cpp/internal/message_reader.cc:104): dispatcher_ != nullptr
either |dispatcher| must be non-null, or |async_get_default_dispatcher| must be configured to return a non-null value
Bug: 922242
Test: run_content_shell --enable-features=VizDisplayCompositor on fuchsia
Change-Id: Id58efa6164c9840a27964afba1585d002152ff4d
Reviewed-on: https://chromium-review.googlesource.com/c/1413657
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Robert Kroeger <rjkroege@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623409}
diff --git a/components/viz/service/main/viz_compositor_thread_runner.cc b/components/viz/service/main/viz_compositor_thread_runner.cc
index 70b6b86..f40cceb 100644
--- a/components/viz/service/main/viz_compositor_thread_runner.cc
+++ b/components/viz/service/main/viz_compositor_thread_runner.cc
@@ -29,6 +29,10 @@
#include "components/ui_devtools/viz/overlay_agent_viz.h"
#endif
+#if defined(USE_OZONE)
+#include "ui/ozone/public/ozone_platform.h"
+#endif
+
namespace viz {
namespace {
@@ -45,10 +49,14 @@
base::Thread::Options thread_options;
#if defined(OS_WIN)
- // Windows needs a UI message loop for child HWND. Other platforms can use the
- // default message loop type.
+ // Windows needs a UI message loop for child HWND.
thread_options.message_loop_type = base::MessageLoop::TYPE_UI;
-#elif defined(OS_CHROMEOS)
+#elif defined(USE_OZONE)
+ // We may need a non-default message loop type for the platform surface.
+ thread_options.message_loop_type =
+ ui::OzonePlatform::GetInstance()->GetMessageLoopTypeForGpu();
+#endif
+#if defined(OS_CHROMEOS)
thread_options.priority = base::ThreadPriority::DISPLAY;
#endif