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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return false; | 249 return false; |
250 } | 250 } |
251 | 251 |
252 // static | 252 // static |
253 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, | 253 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, |
254 content::CauseForGpuLaunch cause) { | 254 content::CauseForGpuLaunch cause) { |
255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
256 | 256 |
257 // Don't grant further access to GPU if it is not allowed. | 257 // Don't grant further access to GPU if it is not allowed. |
258 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 258 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
259 if (gpu_data_manager != NULL && !gpu_data_manager->GpuAccessAllowed()) | 259 if (gpu_data_manager != NULL && |
| 260 (!gpu_data_manager->GpuAccessAllowed() || |
| 261 gpu_data_manager->GetGpuFeatureType() == content::GPU_FEATURE_TYPE_ALL)) |
260 return NULL; | 262 return NULL; |
261 | 263 |
262 if (g_gpu_process_hosts[kind] && HostIsValid(g_gpu_process_hosts[kind])) | 264 if (g_gpu_process_hosts[kind] && HostIsValid(g_gpu_process_hosts[kind])) |
263 return g_gpu_process_hosts[kind]; | 265 return g_gpu_process_hosts[kind]; |
264 | 266 |
265 if (cause == content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) | 267 if (cause == content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) |
266 return NULL; | 268 return NULL; |
267 | 269 |
268 int host_id; | 270 int host_id; |
269 host_id = ++g_last_host_id; | 271 host_id = ++g_last_host_id; |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 const IPC::ChannelHandle& channel_handle, | 862 const IPC::ChannelHandle& channel_handle, |
861 base::ProcessHandle renderer_process_for_gpu, | 863 base::ProcessHandle renderer_process_for_gpu, |
862 const content::GPUInfo& gpu_info) { | 864 const content::GPUInfo& gpu_info) { |
863 callback.Run(channel_handle, gpu_info); | 865 callback.Run(channel_handle, gpu_info); |
864 } | 866 } |
865 | 867 |
866 void GpuProcessHost::CreateCommandBufferError( | 868 void GpuProcessHost::CreateCommandBufferError( |
867 const CreateCommandBufferCallback& callback, int32 route_id) { | 869 const CreateCommandBufferCallback& callback, int32 route_id) { |
868 callback.Run(route_id); | 870 callback.Run(route_id); |
869 } | 871 } |
OLD | NEW |