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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 return false; | 260 return false; |
261 } | 261 } |
262 | 262 |
263 // static | 263 // static |
264 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, | 264 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, |
265 content::CauseForGpuLaunch cause) { | 265 content::CauseForGpuLaunch cause) { |
266 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 266 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
267 | 267 |
268 // Don't grant further access to GPU if it is not allowed. | 268 // Don't grant further access to GPU if it is not allowed. |
269 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 269 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
270 if (gpu_data_manager != NULL && | 270 DCHECK(gpu_data_manager); |
271 (!gpu_data_manager->GpuAccessAllowed() || | 271 if (!gpu_data_manager->GpuAccessAllowed()) |
272 gpu_data_manager->GetBlacklistedFeatures() == | |
273 content::GPU_FEATURE_TYPE_ALL)) | |
274 return NULL; | 272 return NULL; |
275 | 273 |
276 if (g_gpu_process_hosts[kind] && HostIsValid(g_gpu_process_hosts[kind])) | 274 if (g_gpu_process_hosts[kind] && HostIsValid(g_gpu_process_hosts[kind])) |
277 return g_gpu_process_hosts[kind]; | 275 return g_gpu_process_hosts[kind]; |
278 | 276 |
279 if (cause == content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) | 277 if (cause == content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH) |
280 return NULL; | 278 return NULL; |
281 | 279 |
282 int host_id; | 280 int host_id; |
283 host_id = ++g_last_host_id; | 281 host_id = ++g_last_host_id; |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 const IPC::ChannelHandle& channel_handle, | 907 const IPC::ChannelHandle& channel_handle, |
910 base::ProcessHandle renderer_process_for_gpu, | 908 base::ProcessHandle renderer_process_for_gpu, |
911 const content::GPUInfo& gpu_info) { | 909 const content::GPUInfo& gpu_info) { |
912 callback.Run(channel_handle, gpu_info); | 910 callback.Run(channel_handle, gpu_info); |
913 } | 911 } |
914 | 912 |
915 void GpuProcessHost::CreateCommandBufferError( | 913 void GpuProcessHost::CreateCommandBufferError( |
916 const CreateCommandBufferCallback& callback, int32 route_id) { | 914 const CreateCommandBufferCallback& callback, int32 route_id) { |
917 callback.Run(route_id); | 915 callback.Run(route_id); |
918 } | 916 } |
OLD | NEW |