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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "content/browser/browser_child_process_host.h" | 18 #include "content/browser/browser_child_process_host_impl.h" |
19 #include "content/browser/gpu/gpu_data_manager.h" | 19 #include "content/browser/gpu/gpu_data_manager.h" |
20 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 20 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
21 #include "content/browser/renderer_host/render_widget_host.h" | 21 #include "content/browser/renderer_host/render_widget_host.h" |
22 #include "content/browser/renderer_host/render_widget_host_view.h" | 22 #include "content/browser/renderer_host/render_widget_host_view.h" |
23 #include "content/common/child_process_host_impl.h" | 23 #include "content/common/child_process_host_impl.h" |
24 #include "content/common/gpu/gpu_messages.h" | 24 #include "content/common/gpu/gpu_messages.h" |
25 #include "content/gpu/gpu_child_thread.h" | 25 #include "content/gpu/gpu_child_thread.h" |
26 #include "content/gpu/gpu_process.h" | 26 #include "content/gpu/gpu_process.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // Post a task to create the corresponding GpuProcessHostUIShim. The | 264 // Post a task to create the corresponding GpuProcessHostUIShim. The |
265 // GpuProcessHostUIShim will be destroyed if either the browser exits, | 265 // GpuProcessHostUIShim will be destroyed if either the browser exits, |
266 // in which case it calls GpuProcessHostUIShim::DestroyAll, or the | 266 // in which case it calls GpuProcessHostUIShim::DestroyAll, or the |
267 // GpuProcessHost is destroyed, which happens when the corresponding GPU | 267 // GpuProcessHost is destroyed, which happens when the corresponding GPU |
268 // process terminates or fails to launch. | 268 // process terminates or fails to launch. |
269 BrowserThread::PostTask( | 269 BrowserThread::PostTask( |
270 BrowserThread::UI, | 270 BrowserThread::UI, |
271 FROM_HERE, | 271 FROM_HERE, |
272 base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id)); | 272 base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id)); |
273 | 273 |
274 process_.reset(new BrowserChildProcessHost(content::PROCESS_TYPE_GPU, this)); | 274 process_.reset( |
| 275 new BrowserChildProcessHostImpl(content::PROCESS_TYPE_GPU, this)); |
275 } | 276 } |
276 | 277 |
277 GpuProcessHost::~GpuProcessHost() { | 278 GpuProcessHost::~GpuProcessHost() { |
278 DCHECK(CalledOnValidThread()); | 279 DCHECK(CalledOnValidThread()); |
279 | 280 |
280 SendOutstandingReplies(); | 281 SendOutstandingReplies(); |
281 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 282 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
282 DIED_FIRST_TIME + g_gpu_crash_count, | 283 DIED_FIRST_TIME + g_gpu_crash_count, |
283 GPU_PROCESS_LIFETIME_EVENT_MAX); | 284 GPU_PROCESS_LIFETIME_EVENT_MAX); |
284 | 285 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 const IPC::ChannelHandle& channel_handle, | 622 const IPC::ChannelHandle& channel_handle, |
622 base::ProcessHandle renderer_process_for_gpu, | 623 base::ProcessHandle renderer_process_for_gpu, |
623 const content::GPUInfo& gpu_info) { | 624 const content::GPUInfo& gpu_info) { |
624 callback.Run(channel_handle, renderer_process_for_gpu, gpu_info); | 625 callback.Run(channel_handle, renderer_process_for_gpu, gpu_info); |
625 } | 626 } |
626 | 627 |
627 void GpuProcessHost::CreateCommandBufferError( | 628 void GpuProcessHost::CreateCommandBufferError( |
628 const CreateCommandBufferCallback& callback, int32 route_id) { | 629 const CreateCommandBufferCallback& callback, int32 route_id) { |
629 callback.Run(route_id); | 630 callback.Run(route_id); |
630 } | 631 } |
OLD | NEW |