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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/threading/worker_pool.h" | 9 #include "base/threading/worker_pool.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // initialization has succeeded. | 151 // initialization has succeeded. |
152 gpu_channel_manager_.reset( | 152 gpu_channel_manager_.reset( |
153 new GpuChannelManager(this, | 153 new GpuChannelManager(this, |
154 watchdog_thread_.get(), | 154 watchdog_thread_.get(), |
155 ChildProcess::current()->io_message_loop_proxy(), | 155 ChildProcess::current()->io_message_loop_proxy(), |
156 ChildProcess::current()->GetShutDownEvent())); | 156 ChildProcess::current()->GetShutDownEvent())); |
157 | 157 |
158 // Ensure the browser process receives the GPU info before a reply to any | 158 // Ensure the browser process receives the GPU info before a reply to any |
159 // subsequent IPC it might send. | 159 // subsequent IPC it might send. |
160 if (!in_browser_process_) | 160 if (!in_browser_process_) |
161 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 161 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
Zhenyao Mo
2014/03/12 00:02:39
By the way, since you update the gpu_info in GpuHo
| |
162 } | 162 } |
163 | 163 |
164 void GpuChildThread::StopWatchdog() { | 164 void GpuChildThread::StopWatchdog() { |
165 if (watchdog_thread_.get()) { | 165 if (watchdog_thread_.get()) { |
166 watchdog_thread_->Stop(); | 166 watchdog_thread_->Stop(); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 void GpuChildThread::OnCollectGraphicsInfo() { | 170 void GpuChildThread::OnCollectGraphicsInfo() { |
171 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
172 // GPU full info collection should only happen on un-sandboxed GPU process | 172 // GPU full info collection should only happen on un-sandboxed GPU process |
173 // or single process/in-process gpu mode on Windows. | 173 // or single process/in-process gpu mode on Windows. |
174 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 174 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
175 DCHECK(command_line->HasSwitch(switches::kDisableGpuSandbox) || | 175 DCHECK(command_line->HasSwitch(switches::kDisableGpuSandbox) || |
176 in_browser_process_); | 176 in_browser_process_); |
177 #endif // OS_WIN | 177 #endif // OS_WIN |
178 | 178 |
179 if (!gpu::CollectContextGraphicsInfo(&gpu_info_)) | 179 gpu::CollectInfoResult result = |
180 VLOG(1) << "gpu::CollectGraphicsInfo failed"; | 180 gpu::CollectContextGraphicsInfo(&gpu_info_); |
181 switch (result) { | |
182 case gpu::kCollectInfoFatalFailure: | |
183 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal)."; | |
184 // TODO(piman): can we signal overall failure? | |
185 break; | |
186 case gpu::kCollectInfoNonFatalFailure: | |
187 VLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; | |
188 break; | |
189 case gpu::kCollectInfoSuccess: | |
190 break; | |
191 } | |
181 GetContentClient()->SetGpuInfo(gpu_info_); | 192 GetContentClient()->SetGpuInfo(gpu_info_); |
182 | 193 |
183 #if defined(OS_WIN) | 194 #if defined(OS_WIN) |
184 // This is slow, but it's the only thing the unsandboxed GPU process does, | 195 // This is slow, but it's the only thing the unsandboxed GPU process does, |
185 // and GpuDataManager prevents us from sending multiple collecting requests, | 196 // and GpuDataManager prevents us from sending multiple collecting requests, |
186 // so it's OK to be blocking. | 197 // so it's OK to be blocking. |
187 gpu::GetDxDiagnostics(&gpu_info_.dx_diagnostics); | 198 gpu::GetDxDiagnostics(&gpu_info_.dx_diagnostics); |
188 gpu_info_.finalized = true; | 199 gpu_info_.finalized = true; |
189 #endif // OS_WIN | 200 #endif // OS_WIN |
190 | 201 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 // the future posting of tasks to the message loop. | 245 // the future posting of tasks to the message loop. |
235 if (watchdog_thread_->message_loop()) | 246 if (watchdog_thread_->message_loop()) |
236 watchdog_thread_->PostAcknowledge(); | 247 watchdog_thread_->PostAcknowledge(); |
237 // Prevent rearming. | 248 // Prevent rearming. |
238 watchdog_thread_->Stop(); | 249 watchdog_thread_->Stop(); |
239 } | 250 } |
240 } | 251 } |
241 | 252 |
242 } // namespace content | 253 } // namespace content |
243 | 254 |
OLD | NEW |