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/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/child_process.h" | 14 #include "content/common/child_process.h" |
15 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
16 #include "content/gpu/gpu_info_collector.h" | 16 #include "content/gpu/gpu_info_collector.h" |
17 #include "content/gpu/gpu_watchdog_thread.h" | 17 #include "content/gpu/gpu_watchdog_thread.h" |
18 #include "content/public/common/content_client.h" | 18 #include "content/public/common/content_client.h" |
19 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
| 20 #include "content/public/common/result_codes.h" |
20 #include "ipc/ipc_channel_handle.h" | 21 #include "ipc/ipc_channel_handle.h" |
21 #include "ipc/ipc_sync_message_filter.h" | 22 #include "ipc/ipc_sync_message_filter.h" |
22 #include "ui/gl/gl_implementation.h" | 23 #include "ui/gl/gl_implementation.h" |
23 | 24 |
24 const int kGpuTimeout = 10000; | 25 const int kGpuTimeout = 10000; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 bool GpuProcessLogMessageHandler(int severity, | 29 bool GpuProcessLogMessageHandler(int severity, |
29 const char* file, int line, | 30 const char* file, int line, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (handled) | 108 if (handled) |
108 return true; | 109 return true; |
109 | 110 |
110 return gpu_channel_manager_.get() && | 111 return gpu_channel_manager_.get() && |
111 gpu_channel_manager_->OnMessageReceived(msg); | 112 gpu_channel_manager_->OnMessageReceived(msg); |
112 } | 113 } |
113 | 114 |
114 void GpuChildThread::OnInitialize() { | 115 void GpuChildThread::OnInitialize() { |
115 if (dead_on_arrival_) { | 116 if (dead_on_arrival_) { |
116 VLOG(1) << "Exiting GPU process due to errors during initialization"; | 117 VLOG(1) << "Exiting GPU process due to errors during initialization"; |
117 MessageLoop::current()->Quit(); | 118 |
118 return; | 119 // Exit with the exit code that would be returned if the GPU process was |
| 120 // killed using task mamager so that it does not count as a crash. |
| 121 // TODO(apatrick): this is temporary to see if this impacts the crash |
| 122 // statistics. If it does then the crash accounting should be fixed. |
| 123 exit(content::RESULT_CODE_KILLED); |
119 } | 124 } |
120 | 125 |
121 // We don't need to pipe log messages if we are running the GPU thread in | 126 // We don't need to pipe log messages if we are running the GPU thread in |
122 // the browser process. | 127 // the browser process. |
123 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) && | 128 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) && |
124 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) | 129 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) |
125 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 130 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
126 | 131 |
127 // Record initialization only after collecting the GPU info because that can | 132 // Record initialization only after collecting the GPU info because that can |
128 // take a significant amount of time. | 133 // take a significant amount of time. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // Runs on the main thread. | 257 // Runs on the main thread. |
253 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, | 258 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, |
254 const content::DxDiagNode& node) { | 259 const content::DxDiagNode& node) { |
255 thread->gpu_info_.dx_diagnostics = node; | 260 thread->gpu_info_.dx_diagnostics = node; |
256 thread->gpu_info_.finalized = true; | 261 thread->gpu_info_.finalized = true; |
257 thread->collecting_dx_diagnostics_ = false; | 262 thread->collecting_dx_diagnostics_ = false; |
258 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 263 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
259 } | 264 } |
260 | 265 |
261 #endif | 266 #endif |
OLD | NEW |