Chromium Code Reviews| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 return host; | 288 return host; |
| 289 | 289 |
| 290 delete host; | 290 delete host; |
| 291 return NULL; | 291 return NULL; |
| 292 } | 292 } |
| 293 | 293 |
| 294 // static | 294 // static |
| 295 void GpuProcessHost::SendOnIO(GpuProcessKind kind, | 295 void GpuProcessHost::SendOnIO(GpuProcessKind kind, |
| 296 content::CauseForGpuLaunch cause, | 296 content::CauseForGpuLaunch cause, |
| 297 IPC::Message* message) { | 297 IPC::Message* message) { |
| 298 BrowserThread::PostTask( | 298 if (!BrowserThread::PostTask( |
| 299 BrowserThread::IO, FROM_HERE, | 299 BrowserThread::IO, FROM_HERE, |
| 300 base::Bind( | 300 base::Bind( |
| 301 &SendGpuProcessMessage, kind, cause, message)); | 301 &SendGpuProcessMessage, kind, cause, message))) { |
|
ccameron
2012/08/20 21:20:02
Note that SendGpuProcessMessage will delete messag
| |
| 302 delete message; | |
| 303 } | |
| 302 } | 304 } |
| 303 | 305 |
| 304 // static | 306 // static |
| 305 GpuProcessHost* GpuProcessHost::FromID(int host_id) { | 307 GpuProcessHost* GpuProcessHost::FromID(int host_id) { |
| 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 307 | 309 |
| 308 for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { | 310 for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { |
| 309 GpuProcessHost* host = g_gpu_process_hosts[i]; | 311 GpuProcessHost* host = g_gpu_process_hosts[i]; |
| 310 if (host && host->host_id_ == host_id && HostIsValid(host)) | 312 if (host && host->host_id_ == host_id && HostIsValid(host)) |
| 311 return host; | 313 return host; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 const IPC::ChannelHandle& channel_handle, | 880 const IPC::ChannelHandle& channel_handle, |
| 879 base::ProcessHandle renderer_process_for_gpu, | 881 base::ProcessHandle renderer_process_for_gpu, |
| 880 const content::GPUInfo& gpu_info) { | 882 const content::GPUInfo& gpu_info) { |
| 881 callback.Run(channel_handle, gpu_info); | 883 callback.Run(channel_handle, gpu_info); |
| 882 } | 884 } |
| 883 | 885 |
| 884 void GpuProcessHost::CreateCommandBufferError( | 886 void GpuProcessHost::CreateCommandBufferError( |
| 885 const CreateCommandBufferCallback& callback, int32 route_id) { | 887 const CreateCommandBufferCallback& callback, int32 route_id) { |
| 886 callback.Run(route_id); | 888 callback.Run(route_id); |
| 887 } | 889 } |
| OLD | NEW |