| Index: ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
|
| diff --git a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
|
| index c955cb23b734e3881e6a50d69a8da0c98aae1ce9..b34b20770787cbe1a5790623187d6df641ff4996 100644
|
| --- a/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
|
| +++ b/ui/ozone/platform/drm/host/drm_gpu_platform_support_host.cc
|
| @@ -82,7 +82,7 @@ void CursorIPC::Send(IPC::Message* message) {
|
| } // namespace
|
|
|
| DrmGpuPlatformSupportHost::DrmGpuPlatformSupportHost(DrmCursor* cursor)
|
| - : cursor_(cursor) {}
|
| + : cursor_(cursor), weak_ptr_factory_(this) {}
|
|
|
| DrmGpuPlatformSupportHost::~DrmGpuPlatformSupportHost() {}
|
|
|
| @@ -107,6 +107,7 @@ void DrmGpuPlatformSupportHost::OnGpuProcessLaunched(
|
| int host_id,
|
| scoped_refptr<base::SingleThreadTaskRunner> send_runner,
|
| const base::Callback<void(IPC::Message*)>& send_callback) {
|
| + DCHECK(!ui_runner_->BelongsToCurrentThread());
|
| TRACE_EVENT1("drm", "DrmGpuPlatformSupportHost::OnGpuProcessLaunched",
|
| "host_id", host_id);
|
| host_id_ = host_id;
|
| @@ -115,21 +116,10 @@ void DrmGpuPlatformSupportHost::OnGpuProcessLaunched(
|
|
|
| for (GpuThreadObserver& observer : gpu_thread_observers_)
|
| observer.OnGpuProcessLaunched();
|
| -}
|
| -
|
| -void DrmGpuPlatformSupportHost::OnChannelEstablished() {
|
| - TRACE_EVENT0("drm", "DrmGpuPlatformSupportHost::OnChannelEstablished");
|
| - channel_established_ = true;
|
| -
|
| - for (GpuThreadObserver& observer : gpu_thread_observers_)
|
| - observer.OnGpuThreadReady();
|
|
|
| - // The cursor is special since it will process input events on the IO thread
|
| - // and can by-pass the UI thread. This means that we need to special case it
|
| - // and notify it after all other observers/handlers are notified such that the
|
| - // (windowing) state on the GPU can be initialized before the cursor is
|
| - // allowed to IPC messages (which are targeted to a specific window).
|
| - cursor_->SetDrmCursorProxy(new CursorIPC(send_runner_, send_callback_));
|
| + ui_runner_->PostTask(
|
| + FROM_HERE, base::Bind(&DrmGpuPlatformSupportHost::OnChannelEstablished,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| void DrmGpuPlatformSupportHost::OnChannelDestroyed(int host_id) {
|
| @@ -148,6 +138,10 @@ void DrmGpuPlatformSupportHost::OnChannelDestroyed(int host_id) {
|
|
|
| }
|
|
|
| +void DrmGpuPlatformSupportHost::BindToCurrentThread() {
|
| + ui_runner_ = base::ThreadTaskRunnerHandle::Get();
|
| +}
|
| +
|
| bool DrmGpuPlatformSupportHost::OnMessageReceived(const IPC::Message& message) {
|
| if (OnMessageReceivedForDrmDisplayHostManager(message))
|
| return true;
|
| @@ -176,6 +170,21 @@ void DrmGpuPlatformSupportHost::UnRegisterHandlerForDrmDisplayHostManager() {
|
| display_manager_ = nullptr;
|
| }
|
|
|
| +void DrmGpuPlatformSupportHost::OnChannelEstablished() {
|
| + TRACE_EVENT0("drm", "DrmGpuPlatformSupportHost::OnChannelEstablished");
|
| + channel_established_ = true;
|
| +
|
| + for (GpuThreadObserver& observer : gpu_thread_observers_)
|
| + observer.OnGpuThreadReady();
|
| +
|
| + // The cursor is special since it will process input events on the IO thread
|
| + // and can by-pass the UI thread. This means that we need to special case it
|
| + // and notify it after all other observers/handlers are notified such that the
|
| + // (windowing) state on the GPU can be initialized before the cursor is
|
| + // allowed to IPC messages (which are targeted to a specific window).
|
| + cursor_->SetDrmCursorProxy(new CursorIPC(send_runner_, send_callback_));
|
| +}
|
| +
|
| bool DrmGpuPlatformSupportHost::OnMessageReceivedForDrmDisplayHostManager(
|
| const IPC::Message& message) {
|
| bool handled = true;
|
|
|