| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 gpu::MergeGPUInfo(&gpu_info_, gpu_info); | 577 gpu::MergeGPUInfo(&gpu_info_, gpu_info); |
| 578 if (IsCompleteGpuInfoAvailable()) | 578 if (IsCompleteGpuInfoAvailable()) |
| 579 complete_gpu_info_already_requested_ = true; | 579 complete_gpu_info_already_requested_ = true; |
| 580 | 580 |
| 581 UpdateGpuInfoHelper(); | 581 UpdateGpuInfoHelper(); |
| 582 } | 582 } |
| 583 | 583 |
| 584 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 584 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
| 585 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 585 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 586 GpuDataManagerImpl::UnlockedSession session(owner_); | 586 GpuDataManagerImpl::UnlockedSession session(owner_); |
| 587 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 587 observer_list_->Notify(FROM_HERE, |
| 588 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
| 588 video_memory_usage_stats); | 589 video_memory_usage_stats); |
| 589 } | 590 } |
| 590 | 591 |
| 591 void GpuDataManagerImplPrivate::AppendRendererCommandLine( | 592 void GpuDataManagerImplPrivate::AppendRendererCommandLine( |
| 592 base::CommandLine* command_line) const { | 593 base::CommandLine* command_line) const { |
| 593 DCHECK(command_line); | 594 DCHECK(command_line); |
| 594 | 595 |
| 595 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 596 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
| 596 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | 597 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
| 597 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 598 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 FROM_HERE, | 789 FROM_HERE, |
| 789 base::Bind(&GpuDataManagerImpl::ProcessCrashed, | 790 base::Bind(&GpuDataManagerImpl::ProcessCrashed, |
| 790 base::Unretained(owner_), | 791 base::Unretained(owner_), |
| 791 exit_code)); | 792 exit_code)); |
| 792 return; | 793 return; |
| 793 } | 794 } |
| 794 { | 795 { |
| 795 gpu_info_.process_crash_count = GpuProcessHost::gpu_crash_count(); | 796 gpu_info_.process_crash_count = GpuProcessHost::gpu_crash_count(); |
| 796 GpuDataManagerImpl::UnlockedSession session(owner_); | 797 GpuDataManagerImpl::UnlockedSession session(owner_); |
| 797 observer_list_->Notify( | 798 observer_list_->Notify( |
| 798 &GpuDataManagerObserver::OnGpuProcessCrashed, exit_code); | 799 FROM_HERE, &GpuDataManagerObserver::OnGpuProcessCrashed, exit_code); |
| 799 } | 800 } |
| 800 } | 801 } |
| 801 | 802 |
| 802 base::ListValue* GpuDataManagerImplPrivate::GetLogMessages() const { | 803 base::ListValue* GpuDataManagerImplPrivate::GetLogMessages() const { |
| 803 base::ListValue* value = new base::ListValue; | 804 base::ListValue* value = new base::ListValue; |
| 804 for (size_t ii = 0; ii < log_messages_.size(); ++ii) { | 805 for (size_t ii = 0; ii < log_messages_.size(); ++ii) { |
| 805 base::DictionaryValue* dict = new base::DictionaryValue(); | 806 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 806 dict->SetInteger("level", log_messages_[ii].level); | 807 dict->SetInteger("level", log_messages_[ii].level); |
| 807 dict->SetString("header", log_messages_[ii].header); | 808 dict->SetString("header", log_messages_[ii].header); |
| 808 dict->SetString("message", log_messages_[ii].message); | 809 dict->SetString("message", log_messages_[ii].message); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 992 |
| 992 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { | 993 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { |
| 993 if (gpu_driver_bugs_.count(gpu::FORCE_DISCRETE_GPU) == 1) | 994 if (gpu_driver_bugs_.count(gpu::FORCE_DISCRETE_GPU) == 1) |
| 994 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); | 995 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); |
| 995 else if (gpu_driver_bugs_.count(gpu::FORCE_INTEGRATED_GPU) == 1) | 996 else if (gpu_driver_bugs_.count(gpu::FORCE_INTEGRATED_GPU) == 1) |
| 996 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); | 997 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); |
| 997 } | 998 } |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { | 1001 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { |
| 1001 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 1002 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); |
| 1002 } | 1003 } |
| 1003 | 1004 |
| 1004 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 1005 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
| 1005 if (ShouldUseWarp()) | 1006 if (ShouldUseWarp()) |
| 1006 return; | 1007 return; |
| 1007 | 1008 |
| 1008 if (!GpuAccessAllowed(NULL) || | 1009 if (!GpuAccessAllowed(NULL) || |
| 1009 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 1010 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
| 1010 if (!swiftshader_path_.empty() && | 1011 if (!swiftshader_path_.empty() && |
| 1011 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 1012 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 | 1125 |
| 1125 int64 GpuDataManagerImplPrivate::GetBlockAllDomainsDurationInMs() const { | 1126 int64 GpuDataManagerImplPrivate::GetBlockAllDomainsDurationInMs() const { |
| 1126 return kBlockAllDomainsMs; | 1127 return kBlockAllDomainsMs; |
| 1127 } | 1128 } |
| 1128 | 1129 |
| 1129 void GpuDataManagerImplPrivate::Notify3DAPIBlocked(const GURL& url, | 1130 void GpuDataManagerImplPrivate::Notify3DAPIBlocked(const GURL& url, |
| 1130 int render_process_id, | 1131 int render_process_id, |
| 1131 int render_view_id, | 1132 int render_view_id, |
| 1132 ThreeDAPIType requester) { | 1133 ThreeDAPIType requester) { |
| 1133 GpuDataManagerImpl::UnlockedSession session(owner_); | 1134 GpuDataManagerImpl::UnlockedSession session(owner_); |
| 1134 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, | 1135 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::DidBlock3DAPIs, |
| 1135 url, render_process_id, render_view_id, requester); | 1136 url, render_process_id, render_view_id, requester); |
| 1136 } | 1137 } |
| 1137 | 1138 |
| 1138 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1139 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
| 1139 gpu_process_accessible_ = false; | 1140 gpu_process_accessible_ = false; |
| 1140 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1141 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1141 #if defined(OS_WIN) | 1142 #if defined(OS_WIN) |
| 1142 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1143 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1143 #endif | 1144 #endif |
| 1144 complete_gpu_info_already_requested_ = true; | 1145 complete_gpu_info_already_requested_ = true; |
| 1145 // Some observers might be waiting. | 1146 // Some observers might be waiting. |
| 1146 NotifyGpuInfoUpdate(); | 1147 NotifyGpuInfoUpdate(); |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 } // namespace content | 1150 } // namespace content |
| OLD | NEW |