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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 complete_gpu_info_already_requested_ = true; | 384 complete_gpu_info_already_requested_ = true; |
385 | 385 |
386 GpuProcessHost::SendOnIO( | 386 GpuProcessHost::SendOnIO( |
387 #if defined(OS_WIN) | 387 #if defined(OS_WIN) |
388 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, | 388 GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED, |
389 #else | 389 #else |
390 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 390 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
391 #endif | 391 #endif |
392 CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, | 392 gpu::CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED, |
393 new GpuMsg_CollectGraphicsInfo()); | 393 new GpuMsg_CollectGraphicsInfo()); |
394 } | 394 } |
395 | 395 |
396 bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const { | 396 bool GpuDataManagerImplPrivate::IsEssentialGpuInfoAvailable() const { |
397 if (gpu_info_.basic_info_state == gpu::kCollectInfoNone || | 397 if (gpu_info_.basic_info_state == gpu::kCollectInfoNone || |
398 gpu_info_.context_info_state == gpu::kCollectInfoNone) { | 398 gpu_info_.context_info_state == gpu::kCollectInfoNone) { |
399 return false; | 399 return false; |
400 } | 400 } |
401 return true; | 401 return true; |
402 } | 402 } |
403 | 403 |
404 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const { | 404 bool GpuDataManagerImplPrivate::IsCompleteGpuInfoAvailable() const { |
405 #if defined(OS_WIN) | 405 #if defined(OS_WIN) |
406 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone) | 406 if (gpu_info_.dx_diagnostics_info_state == gpu::kCollectInfoNone) |
407 return false; | 407 return false; |
408 #endif | 408 #endif |
409 return IsEssentialGpuInfoAvailable(); | 409 return IsEssentialGpuInfoAvailable(); |
410 } | 410 } |
411 | 411 |
412 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { | 412 void GpuDataManagerImplPrivate::RequestVideoMemoryUsageStatsUpdate() const { |
413 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 413 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
414 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | 414 gpu::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
415 new GpuMsg_GetVideoMemoryUsageStats()); | 415 new GpuMsg_GetVideoMemoryUsageStats()); |
416 } | 416 } |
417 | 417 |
418 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { | 418 bool GpuDataManagerImplPrivate::ShouldUseSwiftShader() const { |
419 return use_swiftshader_; | 419 return use_swiftshader_; |
420 } | 420 } |
421 | 421 |
422 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( | 422 void GpuDataManagerImplPrivate::RegisterSwiftShaderPath( |
423 const base::FilePath& path) { | 423 const base::FilePath& path) { |
424 swiftshader_path_ = path; | 424 swiftshader_path_ = path; |
(...skipping 25 matching lines...) Expand all Loading... |
450 // These policies could be refined, but at a certain point the behavior | 450 // These policies could be refined, but at a certain point the behavior |
451 // will become difficult to explain. | 451 // will become difficult to explain. |
452 std::string domain = GetDomainFromURL(url); | 452 std::string domain = GetDomainFromURL(url); |
453 | 453 |
454 blocked_domains_.erase(domain); | 454 blocked_domains_.erase(domain); |
455 timestamps_of_gpu_resets_.clear(); | 455 timestamps_of_gpu_resets_.clear(); |
456 } | 456 } |
457 | 457 |
458 void GpuDataManagerImplPrivate::DisableGpuWatchdog() { | 458 void GpuDataManagerImplPrivate::DisableGpuWatchdog() { |
459 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 459 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
460 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | 460 gpu::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
461 new GpuMsg_DisableWatchdog); | 461 new GpuMsg_DisableWatchdog); |
462 } | 462 } |
463 | 463 |
464 void GpuDataManagerImplPrivate::SetGLStrings(const std::string& gl_vendor, | 464 void GpuDataManagerImplPrivate::SetGLStrings(const std::string& gl_vendor, |
465 const std::string& gl_renderer, | 465 const std::string& gl_renderer, |
466 const std::string& gl_version) { | 466 const std::string& gl_version) { |
467 if (gl_vendor.empty() && gl_renderer.empty() && gl_version.empty()) | 467 if (gl_vendor.empty() && gl_renderer.empty() && gl_version.empty()) |
468 return; | 468 return; |
469 | 469 |
470 if (!is_initialized_) { | 470 if (!is_initialized_) { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 } | 889 } |
890 return value; | 890 return value; |
891 } | 891 } |
892 | 892 |
893 void GpuDataManagerImplPrivate::HandleGpuSwitch() { | 893 void GpuDataManagerImplPrivate::HandleGpuSwitch() { |
894 GpuDataManagerImpl::UnlockedSession session(owner_); | 894 GpuDataManagerImpl::UnlockedSession session(owner_); |
895 // Notify observers in the browser process. | 895 // Notify observers in the browser process. |
896 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 896 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
897 // Pass the notification to the GPU process to notify observers there. | 897 // Pass the notification to the GPU process to notify observers there. |
898 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 898 GpuProcessHost::SendOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
899 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, | 899 gpu::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, |
900 new GpuMsg_GpuSwitched); | 900 new GpuMsg_GpuSwitched); |
901 } | 901 } |
902 | 902 |
903 bool GpuDataManagerImplPrivate::UpdateActiveGpu(uint32_t vendor_id, | 903 bool GpuDataManagerImplPrivate::UpdateActiveGpu(uint32_t vendor_id, |
904 uint32_t device_id) { | 904 uint32_t device_id) { |
905 if (gpu_info_.gpu.vendor_id == vendor_id && | 905 if (gpu_info_.gpu.vendor_id == vendor_id && |
906 gpu_info_.gpu.device_id == device_id) { | 906 gpu_info_.gpu.device_id == device_id) { |
907 // The primary GPU is active. | 907 // The primary GPU is active. |
908 if (gpu_info_.gpu.active) | 908 if (gpu_info_.gpu.active) |
909 return false; | 909 return false; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1244 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1245 #if defined(OS_WIN) | 1245 #if defined(OS_WIN) |
1246 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1246 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1247 #endif | 1247 #endif |
1248 complete_gpu_info_already_requested_ = true; | 1248 complete_gpu_info_already_requested_ = true; |
1249 // Some observers might be waiting. | 1249 // Some observers might be waiting. |
1250 NotifyGpuInfoUpdate(); | 1250 NotifyGpuInfoUpdate(); |
1251 } | 1251 } |
1252 | 1252 |
1253 } // namespace content | 1253 } // namespace content |
OLD | NEW |