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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "content/browser/browser_thread.h" | 14 #include "content/browser/browser_thread.h" |
15 #include "content/browser/gpu/gpu_data_manager.h" | 15 #include "content/browser/gpu/gpu_data_manager.h" |
16 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 16 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
17 #include "content/browser/renderer_host/render_widget_host.h" | 17 #include "content/browser/renderer_host/render_widget_host.h" |
18 #include "content/browser/renderer_host/render_widget_host_view.h" | 18 #include "content/browser/renderer_host/render_widget_host_view.h" |
19 #include "content/common/content_switches.h" | 19 #include "content/common/content_switches.h" |
20 #include "content/common/gpu/gpu_messages.h" | 20 #include "content/common/gpu/gpu_messages.h" |
| 21 #include "content/common/result_codes.h" |
21 #include "content/gpu/gpu_child_thread.h" | 22 #include "content/gpu/gpu_child_thread.h" |
22 #include "content/gpu/gpu_process.h" | 23 #include "content/gpu/gpu_process.h" |
23 #include "ipc/ipc_channel_handle.h" | 24 #include "ipc/ipc_channel_handle.h" |
24 #include "ipc/ipc_switches.h" | 25 #include "ipc/ipc_switches.h" |
25 #include "ui/gfx/gl/gl_context.h" | 26 #include "ui/gfx/gl/gl_context.h" |
26 #include "ui/gfx/gl/gl_implementation.h" | 27 #include "ui/gfx/gl/gl_implementation.h" |
27 #include "ui/gfx/gl/gl_switches.h" | 28 #include "ui/gfx/gl/gl_switches.h" |
28 | 29 |
29 #if defined(TOOLKIT_USES_GTK) | 30 #if defined(TOOLKIT_USES_GTK) |
30 #include "ui/gfx/gtk_native_view_id_manager.h" | 31 #include "ui/gfx/gtk_native_view_id_manager.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 #endif | 477 #endif |
477 } | 478 } |
478 | 479 |
479 void GpuProcessHost::OnChildDied() { | 480 void GpuProcessHost::OnChildDied() { |
480 SendOutstandingReplies(); | 481 SendOutstandingReplies(); |
481 // Located in OnChildDied because OnProcessCrashed suffers from a race | 482 // Located in OnChildDied because OnProcessCrashed suffers from a race |
482 // condition on Linux. | 483 // condition on Linux. |
483 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 484 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
484 DIED_FIRST_TIME + g_gpu_crash_count, | 485 DIED_FIRST_TIME + g_gpu_crash_count, |
485 GPU_PROCESS_LIFETIME_EVENT_MAX); | 486 GPU_PROCESS_LIFETIME_EVENT_MAX); |
486 base::TerminationStatus status = GetChildTerminationStatus(NULL); | 487 |
| 488 int exit_code; |
| 489 base::TerminationStatus status = GetChildTerminationStatus(&exit_code); |
487 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus", | 490 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessTerminationStatus", |
488 status, | 491 status, |
489 base::TERMINATION_STATUS_MAX_ENUM); | 492 base::TERMINATION_STATUS_MAX_ENUM); |
| 493 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessExitCode", |
| 494 exit_code, |
| 495 content::RESULT_CODE_LAST_CODE); |
| 496 |
490 BrowserChildProcessHost::OnChildDied(); | 497 BrowserChildProcessHost::OnChildDied(); |
491 } | 498 } |
492 | 499 |
493 void GpuProcessHost::OnProcessCrashed(int exit_code) { | 500 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
494 SendOutstandingReplies(); | 501 SendOutstandingReplies(); |
495 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { | 502 if (++g_gpu_crash_count >= kGpuMaxCrashCount) { |
496 // The gpu process is too unstable to use. Disable it for current session. | 503 // The gpu process is too unstable to use. Disable it for current session. |
497 gpu_enabled_ = false; | 504 gpu_enabled_ = false; |
498 } | 505 } |
499 BrowserChildProcessHost::OnProcessCrashed(exit_code); | 506 BrowserChildProcessHost::OnProcessCrashed(exit_code); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 589 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); |
583 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | 590 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); |
584 } | 591 } |
585 | 592 |
586 void GpuProcessHost::CreateCommandBufferError( | 593 void GpuProcessHost::CreateCommandBufferError( |
587 CreateCommandBufferCallback* callback, int32 route_id) { | 594 CreateCommandBufferCallback* callback, int32 route_id) { |
588 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 595 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
589 wrapped_callback(callback); | 596 wrapped_callback(callback); |
590 callback->Run(route_id); | 597 callback->Run(route_id); |
591 } | 598 } |
OLD | NEW |