Make consistent with Accelerated 2D Canvas flag on both implementation and chrome://gpu.

Currently, we don't enable accelerated 2d canvas in software rendering mode, but
chrome://gpu does not concern software rendering mode.

This CL adds GPUInfo::SupportsAccelerated2dCanvas() so that any clients query if
accelerated 2d canvas is supported.

Review URL: https://codereview.chromium.org/95013004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238347 0039d316-1c4b-4281-b951-d872f2087c98
parent 9dcf7246
...@@ -24,14 +24,6 @@ struct GpuFeatureInfo { ...@@ -24,14 +24,6 @@ struct GpuFeatureInfo {
bool fallback_to_software; bool fallback_to_software;
}; };
// Determine if accelerated-2d-canvas is supported, which depends on whether
// lose_context could happen.
bool SupportsAccelerated2dCanvas() {
if (GpuDataManagerImpl::GetInstance()->GetGPUInfo().can_lose_context)
return false;
return true;
}
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
const size_t kNumFeatures = 14; const size_t kNumFeatures = 14;
#else #else
...@@ -47,7 +39,8 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index) { ...@@ -47,7 +39,8 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index) {
manager->IsFeatureBlacklisted( manager->IsFeatureBlacklisted(
gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS),
command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) ||
!SupportsAccelerated2dCanvas(), !GpuDataManagerImpl::GetInstance()->
GetGPUInfo().SupportsAccelerated2dCanvas(),
"Accelerated 2D canvas is unavailable: either disabled at the command" "Accelerated 2D canvas is unavailable: either disabled at the command"
" line or not supported by the current system.", " line or not supported by the current system.",
true true
......
...@@ -615,11 +615,7 @@ bool RendererWebKitPlatformSupportImpl::canAccelerate2dCanvas() { ...@@ -615,11 +615,7 @@ bool RendererWebKitPlatformSupportImpl::canAccelerate2dCanvas() {
if (!host) if (!host)
return false; return false;
const gpu::GPUInfo& gpu_info = host->gpu_info(); return host->gpu_info().SupportsAccelerated2dCanvas();
if (gpu_info.can_lose_context || gpu_info.software_rendering)
return false;
return true;
} }
bool RendererWebKitPlatformSupportImpl::isThreadedCompositingEnabled() { bool RendererWebKitPlatformSupportImpl::isThreadedCompositingEnabled() {
......
...@@ -44,6 +44,10 @@ struct GPU_EXPORT GPUInfo { ...@@ -44,6 +44,10 @@ struct GPU_EXPORT GPUInfo {
GPUInfo(); GPUInfo();
~GPUInfo(); ~GPUInfo();
bool SupportsAccelerated2dCanvas() const {
return !can_lose_context && !software_rendering;
}
// Whether more GPUInfo fields might be collected in the future. // Whether more GPUInfo fields might be collected in the future.
bool finalized; bool finalized;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment