| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 GpuChildThread* child_thread_; | 228 GpuChildThread* child_thread_; |
| 229 | 229 |
| 230 DISALLOW_COPY_AND_ASSIGN(GpuMainThread); | 230 DISALLOW_COPY_AND_ASSIGN(GpuMainThread); |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 // static | 233 // static |
| 234 bool GpuProcessHost::HostIsValid(GpuProcessHost* host) { | 234 bool GpuProcessHost::HostIsValid(GpuProcessHost* host) { |
| 235 if (!host) | 235 if (!host) |
| 236 return false; | 236 return false; |
| 237 | 237 |
| 238 // Check if the GPU process has died and the host is about to be destroyed. | |
| 239 if (host->process_->disconnect_was_alive()) | |
| 240 return false; | |
| 241 | |
| 242 // The Gpu process is invalid if it's not using software, the card is | 238 // The Gpu process is invalid if it's not using software, the card is |
| 243 // blacklisted, and we can kill it and start over. | 239 // blacklisted, and we can kill it and start over. |
| 244 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || | 240 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || |
| 245 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) || | 241 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) || |
| 246 host->software_rendering() || | 242 host->software_rendering() || |
| 247 !GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()) { | 243 !GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()) { |
| 248 return true; | 244 return true; |
| 249 } | 245 } |
| 250 | 246 |
| 251 host->ForceShutdown(); | 247 host->ForceShutdown(); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 const IPC::ChannelHandle& channel_handle, | 857 const IPC::ChannelHandle& channel_handle, |
| 862 base::ProcessHandle renderer_process_for_gpu, | 858 base::ProcessHandle renderer_process_for_gpu, |
| 863 const content::GPUInfo& gpu_info) { | 859 const content::GPUInfo& gpu_info) { |
| 864 callback.Run(channel_handle, gpu_info); | 860 callback.Run(channel_handle, gpu_info); |
| 865 } | 861 } |
| 866 | 862 |
| 867 void GpuProcessHost::CreateCommandBufferError( | 863 void GpuProcessHost::CreateCommandBufferError( |
| 868 const CreateCommandBufferCallback& callback, int32 route_id) { | 864 const CreateCommandBufferCallback& callback, int32 route_id) { |
| 869 callback.Run(route_id); | 865 callback.Run(route_id); |
| 870 } | 866 } |
| OLD | NEW |