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_process_host.h" | 5 #include "content/browser/gpu_process_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/process_util.h" |
10 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
11 #include "chrome/browser/gpu_process_host_ui_shim.h" | 12 #include "chrome/browser/gpu_process_host_ui_shim.h" |
12 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
15 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
16 #include "content/browser/renderer_host/render_widget_host.h" | 17 #include "content/browser/renderer_host/render_widget_host.h" |
17 #include "content/browser/renderer_host/render_widget_host_view.h" | 18 #include "content/browser/renderer_host/render_widget_host_view.h" |
18 #include "content/common/gpu_messages.h" | 19 #include "content/common/gpu_messages.h" |
19 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 171 |
171 } // namespace | 172 } // namespace |
172 | 173 |
173 void GpuProcessHost::OnChildDied() { | 174 void GpuProcessHost::OnChildDied() { |
174 SendOutstandingReplies(host_id_); | 175 SendOutstandingReplies(host_id_); |
175 // Located in OnChildDied because OnProcessCrashed suffers from a race | 176 // Located in OnChildDied because OnProcessCrashed suffers from a race |
176 // condition on Linux. | 177 // condition on Linux. |
177 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 178 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
178 DIED_FIRST_TIME + g_gpu_crash_count, | 179 DIED_FIRST_TIME + g_gpu_crash_count, |
179 GPU_PROCESS_LIFETIME_EVENT_MAX); | 180 GPU_PROCESS_LIFETIME_EVENT_MAX); |
| 181 base::TerminationStatus status = GetChildTerminationStatus(NULL); |
| 182 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus", |
| 183 status, |
| 184 base::TERMINATION_STATUS_MAX_ENUM); |
180 BrowserChildProcessHost::OnChildDied(); | 185 BrowserChildProcessHost::OnChildDied(); |
181 } | 186 } |
182 | 187 |
183 void GpuProcessHost::OnProcessCrashed(int exit_code) { | 188 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
184 SendOutstandingReplies(host_id_); | 189 SendOutstandingReplies(host_id_); |
185 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { | 190 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { |
186 // The gpu process is too unstable to use. Disable it for current session. | 191 // The gpu process is too unstable to use. Disable it for current session. |
187 RenderViewHostDelegateHelper::set_gpu_enabled(false); | 192 RenderViewHostDelegateHelper::set_gpu_enabled(false); |
188 } | 193 } |
189 BrowserChildProcessHost::OnProcessCrashed(exit_code); | 194 BrowserChildProcessHost::OnProcessCrashed(exit_code); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 #elif defined(OS_POSIX) | 251 #elif defined(OS_POSIX) |
247 false, // Never use the zygote (GPU plugin can't be sandboxed). | 252 false, // Never use the zygote (GPU plugin can't be sandboxed). |
248 base::environment_vector(), | 253 base::environment_vector(), |
249 #endif | 254 #endif |
250 cmd_line); | 255 cmd_line); |
251 | 256 |
252 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 257 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
253 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); | 258 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); |
254 return true; | 259 return true; |
255 } | 260 } |
OLD | NEW |