Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/gpu/gpu_service.h" | 5 #include "services/ui/gpu/gpu_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 #if defined(OS_WIN) | 277 #if defined(OS_WIN) |
| 278 if (!in_host_process_) { | 278 if (!in_host_process_) { |
| 279 // The unsandboxed GPU process fulfilled its duty. Rest in peace. | 279 // The unsandboxed GPU process fulfilled its duty. Rest in peace. |
| 280 base::MessageLoop::current()->QuitWhenIdle(); | 280 base::MessageLoop::current()->QuitWhenIdle(); |
| 281 } | 281 } |
| 282 #endif | 282 #endif |
| 283 } | 283 } |
| 284 | 284 |
| 285 #if defined(OS_MACOSX) | 285 #if defined(OS_MACOSX) |
| 286 void GpuService::UpdateGpuInfoPlatform() { | 286 void GpuService::UpdateGpuInfoPlatform() { |
| 287 DCHECK(main_runner_->BelongsToCurrentThread()); | 287 if (gpu_info_.gpu.vendor_id == 0x10de) { // NVIDIA |
|
Zhenyao Mo
2017/06/13 19:01:24
See my comment in the workaround file. Let's not
jiajia.qin
2017/06/14 08:18:21
Acknowledged.
| |
| 288 // gpu::CollectContextGraphicsInfo() is already called during gpu process | 288 DCHECK(main_runner_->BelongsToCurrentThread()); |
| 289 // initialization (see GpuInit::InitializeAndStartSandbox()) on non-mac | 289 // gpu::CollectContextGraphicsInfo() is already called during gpu process |
| 290 // platforms, and during in-browser gpu thread initialization on all platforms | 290 // initialization (see GpuInit::InitializeAndStartSandbox()) on |
| 291 // (See InProcessGpuThread::Init()). | 291 // non-nvidia-mac platforms, and during in-browser gpu thread initialization |
| 292 if (in_host_process_) | 292 // on all platforms (See InProcessGpuThread::Init()). |
| 293 return; | 293 if (in_host_process_) |
| 294 return; | |
| 294 | 295 |
| 295 DCHECK_EQ(gpu::kCollectInfoNone, gpu_info_.context_info_state); | 296 DCHECK_EQ(gpu::kCollectInfoNone, gpu_info_.context_info_state); |
| 296 gpu::CollectInfoResult result = gpu::CollectContextGraphicsInfo(&gpu_info_); | 297 gpu::CollectInfoResult result = gpu::CollectContextGraphicsInfo(&gpu_info_); |
| 297 switch (result) { | 298 switch (result) { |
| 298 case gpu::kCollectInfoFatalFailure: | 299 case gpu::kCollectInfoFatalFailure: |
| 299 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal)."; | 300 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal)."; |
| 300 // TODO(piman): can we signal overall failure? | 301 // TODO(piman): can we signal overall failure? |
| 301 break; | 302 break; |
| 302 case gpu::kCollectInfoNonFatalFailure: | 303 case gpu::kCollectInfoNonFatalFailure: |
| 303 DVLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; | 304 DVLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; |
| 304 break; | 305 break; |
| 305 case gpu::kCollectInfoNone: | 306 case gpu::kCollectInfoNone: |
| 306 NOTREACHED(); | 307 NOTREACHED(); |
| 307 break; | 308 break; |
| 308 case gpu::kCollectInfoSuccess: | 309 case gpu::kCollectInfoSuccess: |
| 309 break; | 310 break; |
| 311 } | |
| 312 gpu::SetKeysForCrashLogging(gpu_info_); | |
| 310 } | 313 } |
| 311 gpu::SetKeysForCrashLogging(gpu_info_); | |
| 312 } | 314 } |
| 313 #elif defined(OS_WIN) | 315 #elif defined(OS_WIN) |
| 314 void GpuService::UpdateGpuInfoPlatform() { | 316 void GpuService::UpdateGpuInfoPlatform() { |
| 315 DCHECK(main_runner_->BelongsToCurrentThread()); | 317 DCHECK(main_runner_->BelongsToCurrentThread()); |
| 316 // GPU full info collection should only happen on un-sandboxed GPU process | 318 // GPU full info collection should only happen on un-sandboxed GPU process |
| 317 // or single process/in-process gpu mode on Windows. | 319 // or single process/in-process gpu mode on Windows. |
| 318 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 320 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 319 DCHECK(command_line->HasSwitch("disable-gpu-sandbox") || in_host_process_); | 321 DCHECK(command_line->HasSwitch("disable-gpu-sandbox") || in_host_process_); |
| 320 | 322 |
| 321 // This is slow, but it's the only thing the unsandboxed GPU process does, | 323 // This is slow, but it's the only thing the unsandboxed GPU process does, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 | 507 |
| 506 void GpuService::Stop(const StopCallback& callback) { | 508 void GpuService::Stop(const StopCallback& callback) { |
| 507 DCHECK(io_runner_->BelongsToCurrentThread()); | 509 DCHECK(io_runner_->BelongsToCurrentThread()); |
| 508 main_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] { | 510 main_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] { |
| 509 base::MessageLoop::current()->QuitWhenIdle(); | 511 base::MessageLoop::current()->QuitWhenIdle(); |
| 510 }), | 512 }), |
| 511 callback); | 513 callback); |
| 512 } | 514 } |
| 513 | 515 |
| 514 } // namespace ui | 516 } // namespace ui |
| OLD | NEW |