Chromium Code Reviews| 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 75096a0cb8dc615b89ceed60ffcd6e0642afc774..8d10a8b3885782ebb9e81d55eef47fa434669efb 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 |
| @@ -103,17 +103,26 @@ bool DrmGpuPlatformSupportHost::IsConnected() { |
| return host_id_ >= 0; |
| } |
| -void DrmGpuPlatformSupportHost::OnChannelEstablished( |
| +void DrmGpuPlatformSupportHost::OnGpuProcessLaunched( |
| int host_id, |
| scoped_refptr<base::SingleThreadTaskRunner> send_runner, |
| const base::Callback<void(IPC::Message*)>& send_callback) { |
| - TRACE_EVENT1("drm", "DrmGpuPlatformSupportHost::OnChannelEstablished", |
| + TRACE_EVENT1("drm", "DrmGpuPlatformSupportHost::OnGpuProcessLaunched", |
| "host_id", host_id); |
| host_id_ = host_id; |
| send_runner_ = send_runner; |
| send_callback_ = send_callback; |
| 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 |
| @@ -131,6 +140,7 @@ void DrmGpuPlatformSupportHost::OnChannelDestroyed(int host_id) { |
| if (host_id_ == host_id) { |
| cursor_->ResetDrmCursorProxy(); |
| host_id_ = -1; |
| + channel_established_ = false; |
| send_runner_ = nullptr; |
| send_callback_.Reset(); |
| for (GpuThreadObserver& observer : gpu_thread_observers_) |
| @@ -148,8 +158,10 @@ bool DrmGpuPlatformSupportHost::OnMessageReceived(const IPC::Message& message) { |
| return false; |
| } |
| -bool DrmGpuPlatformSupportHost::Send(IPC::Message* message) { |
| +bool DrmGpuPlatformSupportHost::SendInternal( |
| + IPC::Message* message, bool needChannelEstablished) { |
| if (IsConnected() && |
| + (!needChannelEstablished || channel_established_) && |
| send_runner_->PostTask(FROM_HERE, base::Bind(send_callback_, message))) |
|
piman
2016/10/31 23:45:46
Note, because you use PostTask here, it is possibl
hshi1
2016/11/01 01:00:48
The GpuProcessHost ctor is called from BrowserGpuM
hshi1
2016/11/01 01:04:41
To further clarify on this: at the time of GpuProc
|
| return true; |
| @@ -157,6 +169,10 @@ bool DrmGpuPlatformSupportHost::Send(IPC::Message* message) { |
| return false; |
| } |
| +bool DrmGpuPlatformSupportHost::Send(IPC::Message* message) { |
| + return SendInternal(message, true); |
| +} |
| + |
| // DisplayHost |
| void DrmGpuPlatformSupportHost::RegisterHandlerForDrmDisplayHostManager( |
| DrmDisplayHostManager* handler) { |
| @@ -230,7 +246,7 @@ bool DrmGpuPlatformSupportHost::GpuRelinquishDisplayControl() { |
| bool DrmGpuPlatformSupportHost::GpuAddGraphicsDevice( |
| const base::FilePath& path, |
| const base::FileDescriptor& fd) { |
| - return Send(new OzoneGpuMsg_AddGraphicsDevice(path, fd)); |
| + return SendInternal(new OzoneGpuMsg_AddGraphicsDevice(path, fd), false); |
| } |
| bool DrmGpuPlatformSupportHost::GpuRemoveGraphicsDevice( |