Chromium Code Reviews| Index: content/browser/gpu/browser_gpu_channel_host_factory.cc |
| diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc |
| index c387d68118ffc6f6abbc17f78e11eeca58d820ce..a6affc87de0fbe5ab8846e7b4f6c5af7d379514d 100644 |
| --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc |
| +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc |
| @@ -56,7 +56,8 @@ class BrowserGpuChannelHostFactory::EstablishRequest |
| ~EstablishRequest() {} |
| void EstablishOnIO(); |
| void OnEstablishedOnIO(const IPC::ChannelHandle& channel_handle, |
| - const gpu::GPUInfo& gpu_info); |
| + const gpu::GPUInfo& gpu_info, |
| + GpuProcessHost::EstablishChannelStatus status); |
| void FinishOnIO(); |
| void FinishOnMain(); |
| @@ -64,7 +65,6 @@ class BrowserGpuChannelHostFactory::EstablishRequest |
| const int gpu_client_id_; |
| const uint64_t gpu_client_tracing_id_; |
| int gpu_host_id_; |
| - bool reused_gpu_process_; |
| IPC::ChannelHandle channel_handle_; |
| gpu::GPUInfo gpu_info_; |
| bool finished_; |
| @@ -97,7 +97,6 @@ BrowserGpuChannelHostFactory::EstablishRequest::EstablishRequest( |
| gpu_client_id_(gpu_client_id), |
| gpu_client_tracing_id_(gpu_client_tracing_id), |
| gpu_host_id_(gpu_host_id), |
|
piman
2017/04/06 18:16:39
I think we don't need this one any more.
sadrul
2017/04/07 04:10:53
Yep. Removed.
|
| - reused_gpu_process_(false), |
| finished_(false), |
| main_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
| @@ -107,27 +106,12 @@ void BrowserGpuChannelHostFactory::EstablishRequest::EstablishOnIO() { |
| FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| "477117 " |
| "BrowserGpuChannelHostFactory::EstablishRequest::EstablishOnIO")); |
| - GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |
| + GpuProcessHost* host = |
| + GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); |
| if (!host) { |
| - host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED); |
| - if (!host) { |
| - LOG(ERROR) << "Failed to launch GPU process."; |
| - FinishOnIO(); |
| - return; |
| - } |
| - gpu_host_id_ = host->host_id(); |
| - reused_gpu_process_ = false; |
| - } else { |
| - if (reused_gpu_process_) { |
| - // We come here if we retried to establish the channel because of a |
| - // failure in ChannelEstablishedOnIO, but we ended up with the same |
| - // process ID, meaning the failure was not because of a channel error, |
| - // but another reason. So fail now. |
| - LOG(ERROR) << "Failed to create channel."; |
| - FinishOnIO(); |
| - return; |
| - } |
| - reused_gpu_process_ = true; |
| + LOG(ERROR) << "Failed to launch GPU process."; |
| + FinishOnIO(); |
| + return; |
| } |
| bool preempts = true; |
| @@ -143,18 +127,16 @@ void BrowserGpuChannelHostFactory::EstablishRequest::EstablishOnIO() { |
| void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( |
| const IPC::ChannelHandle& channel_handle, |
| - const gpu::GPUInfo& gpu_info) { |
| - if (!channel_handle.mojo_handle.is_valid() && reused_gpu_process_) { |
| - // We failed after re-using the GPU process, but it may have died in the |
| - // mean time. Retry to have a chance to create a fresh GPU process. |
| - DVLOG(1) << "Failed to create channel on existing GPU process. Trying to " |
| - "restart GPU process."; |
| + const gpu::GPUInfo& gpu_info, |
| + GpuProcessHost::EstablishChannelStatus status) { |
| + if (!channel_handle.mojo_handle.is_valid() && |
| + status == GpuProcessHost::EstablishChannelStatus::GPU_HOST_INVALID) { |
| EstablishOnIO(); |
| - } else { |
| - channel_handle_ = channel_handle; |
| - gpu_info_ = gpu_info; |
| - FinishOnIO(); |
| + return; |
| } |
| + channel_handle_ = channel_handle; |
| + gpu_info_ = gpu_info; |
| + FinishOnIO(); |
| } |
| void BrowserGpuChannelHostFactory::EstablishRequest::FinishOnIO() { |