OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return NULL; | 244 return NULL; |
245 | 245 |
246 GpuProcessHost *host = g_hosts_by_id.Pointer()->Lookup(host_id); | 246 GpuProcessHost *host = g_hosts_by_id.Pointer()->Lookup(host_id); |
247 if (HostIsValid(host_id, host)) | 247 if (HostIsValid(host_id, host)) |
248 return host; | 248 return host; |
249 | 249 |
250 return NULL; | 250 return NULL; |
251 } | 251 } |
252 | 252 |
253 GpuProcessHost::GpuProcessHost(int host_id) | 253 GpuProcessHost::GpuProcessHost(int host_id) |
254 : BrowserChildProcessHost(GPU_PROCESS), | 254 : BrowserChildProcessHost(content::PROCESS_TYPE_GPU), |
255 host_id_(host_id), | 255 host_id_(host_id), |
256 gpu_process_(base::kNullProcessHandle), | 256 gpu_process_(base::kNullProcessHandle), |
257 in_process_(false), | 257 in_process_(false), |
258 software_rendering_(false) { | 258 software_rendering_(false) { |
259 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || | 259 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || |
260 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) | 260 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) |
261 in_process_ = true; | 261 in_process_ = true; |
262 | 262 |
263 // If the 'single GPU process' policy ever changes, we still want to maintain | 263 // If the 'single GPU process' policy ever changes, we still want to maintain |
264 // it for 'gpu thread' mode and only create one instance of host and thread. | 264 // it for 'gpu thread' mode and only create one instance of host and thread. |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 647 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); |
648 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | 648 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); |
649 } | 649 } |
650 | 650 |
651 void GpuProcessHost::CreateCommandBufferError( | 651 void GpuProcessHost::CreateCommandBufferError( |
652 CreateCommandBufferCallback* callback, int32 route_id) { | 652 CreateCommandBufferCallback* callback, int32 route_id) { |
653 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 653 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
654 wrapped_callback(callback); | 654 wrapped_callback(callback); |
655 callback->Run(route_id); | 655 callback->Run(route_id); |
656 } | 656 } |
OLD | NEW |