Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 | 411 |
| 412 void GpuDataManagerImplPrivate::RequestCompleteGpuInfoIfNeeded() { | 412 void GpuDataManagerImplPrivate::RequestCompleteGpuInfoIfNeeded() { |
| 413 if (complete_gpu_info_already_requested_ || IsCompleteGpuInfoAvailable() || | 413 if (complete_gpu_info_already_requested_ || IsCompleteGpuInfoAvailable() || |
| 414 base::CommandLine::ForCurrentProcess()->HasSwitch( | 414 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 415 switches::kGpuTestingNoCompleteInfoCollection)) { | 415 switches::kGpuTestingNoCompleteInfoCollection)) { |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 | 418 |
| 419 complete_gpu_info_already_requested_ = true; | 419 complete_gpu_info_already_requested_ = true; |
| 420 | 420 |
| 421 GpuProcessHost::SendOnIO( | 421 GpuProcessHost::CallOnIO( |
| 422 #if defined(OS_WIN) | 422 #if defined(OS_WIN) |
| 423 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, | 423 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, |
| 424 #else | 424 #else |
| 425 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 425 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 426 #endif | 426 #endif |
| 427 true /* force_create */, new GpuMsg_CollectGraphicsInfo()); | 427 true /* force_create */, base::Bind([](GpuProcessHost* host) { |
| 428 if (!host) | |
| 429 return; | |
| 430 host->gpu_service()->RequestCompleteGpuInfo( | |
| 431 base::Bind([](const gpu::GPUInfo& gpu_info) { | |
| 432 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); | |
| 433 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | |
|
piman
2017/03/20 21:02:36
Should we hop back to the UI thread, though?
I kno
sadrul
2017/03/20 21:21:44
Ah, that's a good point! I have moved this to hop
piman
2017/03/20 21:33:54
I think it would be useful. GpuDataManagerImplPriv
| |
| 434 })); | |
| 435 })); | |
| 428 } | 436 } |
| 429 | 437 |
| 430 bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const { | 438 bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const { |
| 431 if (gpu_info_.basic_info_state == gpu::kCollectInfoNone || | 439 if (gpu_info_.basic_info_state == gpu::kCollectInfoNone || |
| 432 gpu_info_.context_info_state == gpu::kCollectInfoNone) { | 440 gpu_info_.context_info_state == gpu::kCollectInfoNone) { |
| 433 return false; | 441 return false; |
| 434 } | 442 } |
| 435 return true; | 443 return true; |
| 436 } | 444 } |
| 437 | 445 |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1362 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1370 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1363 #if defined(OS_WIN) | 1371 #if defined(OS_WIN) |
| 1364 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1372 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1365 #endif | 1373 #endif |
| 1366 complete_gpu_info_already_requested_ = true; | 1374 complete_gpu_info_already_requested_ = true; |
| 1367 // Some observers might be waiting. | 1375 // Some observers might be waiting. |
| 1368 NotifyGpuInfoUpdate(); | 1376 NotifyGpuInfoUpdate(); |
| 1369 } | 1377 } |
| 1370 | 1378 |
| 1371 } // namespace content | 1379 } // namespace content |
| OLD | NEW |