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" | |
21 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
22 #include "ipc/ipc_sync_message_filter.h" | 21 #include "ipc/ipc_sync_message_filter.h" |
23 #include "ui/gl/gl_implementation.h" | 22 #include "ui/gl/gl_implementation.h" |
24 | 23 |
25 const int kGpuTimeout = 10000; | 24 const int kGpuTimeout = 10000; |
26 | 25 |
27 namespace { | 26 namespace { |
28 | 27 |
29 bool GpuProcessLogMessageHandler(int severity, | 28 bool GpuProcessLogMessageHandler(int severity, |
30 const char* file, int line, | 29 const char* file, int line, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (handled) | 109 if (handled) |
111 return true; | 110 return true; |
112 | 111 |
113 return gpu_channel_manager_.get() && | 112 return gpu_channel_manager_.get() && |
114 gpu_channel_manager_->OnMessageReceived(msg); | 113 gpu_channel_manager_->OnMessageReceived(msg); |
115 } | 114 } |
116 | 115 |
117 void GpuChildThread::OnInitialize() { | 116 void GpuChildThread::OnInitialize() { |
118 if (dead_on_arrival_) { | 117 if (dead_on_arrival_) { |
119 VLOG(1) << "Exiting GPU process due to errors during initialization"; | 118 VLOG(1) << "Exiting GPU process due to errors during initialization"; |
120 | 119 MessageLoop::current()->Quit(); |
121 // Exit with the exit code that would be returned if the GPU process was | 120 return; |
122 // killed using task mamager so that it does not count as a crash. | |
123 // TODO(apatrick): this is temporary to see if this impacts the crash | |
124 // statistics. If it does then the crash accounting should be fixed. | |
125 exit(content::RESULT_CODE_KILLED); | |
126 } | 121 } |
127 | 122 |
128 // We don't need to pipe log messages if we are running the GPU thread in | 123 // We don't need to pipe log messages if we are running the GPU thread in |
129 // the browser process. | 124 // the browser process. |
130 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) && | 125 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) && |
131 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) | 126 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) |
132 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 127 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
133 | 128 |
134 // Record initialization only after collecting the GPU info because that can | 129 // Record initialization only after collecting the GPU info because that can |
135 // take a significant amount of time. | 130 // take a significant amount of time. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // Runs on the main thread. | 262 // Runs on the main thread. |
268 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, | 263 void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread, |
269 const content::DxDiagNode& node) { | 264 const content::DxDiagNode& node) { |
270 thread->gpu_info_.dx_diagnostics = node; | 265 thread->gpu_info_.dx_diagnostics = node; |
271 thread->gpu_info_.finalized = true; | 266 thread->gpu_info_.finalized = true; |
272 thread->collecting_dx_diagnostics_ = false; | 267 thread->collecting_dx_diagnostics_ = false; |
273 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); | 268 thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); |
274 } | 269 } |
275 | 270 |
276 #endif | 271 #endif |
OLD | NEW |