Commit ad0565be authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Get rid of GpuDataManagerImpl::UpdateRendererPrefs().

BUG=744658
TEST=bots
R=piman@chromium.org,danakj@chromium.org,junov@chromium.org,dcheng@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I0f75939f5996ad0767214ba817344639332f1f18
Reviewed-on: https://chromium-review.googlesource.com/826252Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524137}
parent e7f340e5
......@@ -209,12 +209,6 @@ void GpuDataManagerImpl::AppendGpuCommandLine(
private_->AppendGpuCommandLine(command_line);
}
void GpuDataManagerImpl::UpdateRendererWebPrefs(
WebPreferences* prefs) const {
base::AutoLock auto_lock(lock_);
private_->UpdateRendererWebPrefs(prefs);
}
void GpuDataManagerImpl::UpdateGpuPreferences(
gpu::GpuPreferences* gpu_preferences) const {
base::AutoLock auto_lock(lock_);
......
......@@ -39,7 +39,6 @@ struct VideoMemoryUsageStats;
namespace content {
class GpuDataManagerImplPrivate;
struct WebPreferences;
class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager {
public:
......@@ -123,9 +122,6 @@ class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager {
// Insert switches into gpu process command line: kUseGL, etc.
void AppendGpuCommandLine(base::CommandLine* command_line) const;
// Update WebPreferences for renderer based on blacklisting decisions.
void UpdateRendererWebPrefs(WebPreferences* prefs) const;
// Update GpuPreferences based on blacklisting decisions.
void UpdateGpuPreferences(gpu::GpuPreferences* gpu_preferences) const;
......
......@@ -32,7 +32,6 @@
#include "content/public/common/content_constants.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/web_preferences.h"
#include "gpu/command_buffer/service/gpu_preferences.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_driver_bug_list.h"
......@@ -800,26 +799,9 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
}
}
void GpuDataManagerImplPrivate::UpdateRendererWebPrefs(
WebPreferences* prefs) const {
DCHECK(prefs);
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// TODO(zmo): Remove this when we check on the renderer side for 2d canvas.
if (command_line->HasSwitch(switches::kDisableGpuCompositing)) {
prefs->accelerated_2d_canvas_enabled = false;
}
if (!ShouldDisableAcceleratedVideoDecode(command_line) &&
!command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
prefs->pepper_accelerated_video_decode_enabled = true;
}
}
void GpuDataManagerImplPrivate::UpdateGpuPreferences(
gpu::GpuPreferences* gpu_preferences) const {
DCHECK(gpu_preferences);
gpu_preferences->gpu_program_cache_size =
gpu::ShaderDiskCache::CacheSizeBytes();
}
......
......@@ -77,8 +77,6 @@ class CONTENT_EXPORT GpuDataManagerImplPrivate {
void AppendGpuCommandLine(base::CommandLine* command_line) const;
void UpdateRendererWebPrefs(WebPreferences* prefs) const;
void UpdateGpuPreferences(gpu::GpuPreferences* gpu_preferences) const;
void GetBlacklistReasons(base::ListValue* reasons) const;
......
......@@ -423,6 +423,9 @@ WebPreferences RenderViewHostImpl::ComputeWebkitPrefs() {
prefs.save_previous_document_resources = GetSavePreviousDocumentResources();
prefs.accelerated_video_decode_enabled =
!command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode);
std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line);
if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) {
prefs.autoplay_policy = AutoplayPolicy::kNoUserGestureRequired;
......@@ -484,9 +487,6 @@ WebPreferences RenderViewHostImpl::ComputeWebkitPrefs() {
(!command_line.HasSwitch(switches::kDisableSmoothScrolling) &&
gfx::Animation::ScrollAnimationsEnabledBySystem());
// Certain GPU features might have been blacklisted.
GpuDataManagerImpl::GetInstance()->UpdateRendererWebPrefs(&prefs);
if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
GetProcess()->GetID())) {
prefs.loads_images_automatically = true;
......
......@@ -196,7 +196,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
IPC_STRUCT_TRAITS_MEMBER(v8_cache_options)
IPC_STRUCT_TRAITS_MEMBER(pepper_accelerated_video_decode_enabled)
IPC_STRUCT_TRAITS_MEMBER(accelerated_video_decode_enabled)
IPC_STRUCT_TRAITS_MEMBER(animation_policy)
IPC_STRUCT_TRAITS_MEMBER(user_gesture_required_for_presentation)
IPC_STRUCT_TRAITS_MEMBER(text_track_margin_percentage)
......
......@@ -182,7 +182,7 @@ WebPreferences::WebPreferences()
record_whole_document(false),
save_previous_document_resources(SavePreviousDocumentResources::NEVER),
cookie_enabled(true),
pepper_accelerated_video_decode_enabled(false),
accelerated_video_decode_enabled(false),
animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED),
user_gesture_required_for_presentation(true),
text_track_margin_percentage(0.0f),
......
......@@ -208,9 +208,9 @@ struct CONTENT_EXPORT WebPreferences {
// without raising a DOM security exception.
bool cookie_enabled;
// This flag indicates whether H/W accelerated video decode is enabled for
// pepper plugins. Defaults to false.
bool pepper_accelerated_video_decode_enabled;
// This flag indicates whether H/W accelerated video decode is enabled.
// Defaults to false.
bool accelerated_video_decode_enabled;
ImageAnimationPolicy animation_policy;
......
......@@ -35,7 +35,10 @@ ppapi::Preferences PpapiPreferencesBuilder::Build(
.status_values[gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE] ==
gpu::kGpuFeatureStatusEnabled));
ppapi_prefs.is_accelerated_video_decode_enabled =
prefs.pepper_accelerated_video_decode_enabled;
(prefs.accelerated_video_decode_enabled &&
(gpu_feature_info
.status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] ==
gpu::kGpuFeatureStatusEnabled));
return ppapi_prefs;
}
......
......@@ -353,12 +353,6 @@ GpuFeatureInfo ComputeGpuFeatureInfo(const GPUInfo& gpu_info,
}
#endif
if (gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_COMPOSITING] !=
kGpuFeatureStatusEnabled) {
gpu_feature_info.status_values[GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS] =
kGpuFeatureStatusSoftware;
}
gl::ExtensionSet all_disabled_extensions;
std::string disabled_gl_extensions_value =
command_line->GetSwitchValueASCII(switches::kDisableGLExtensions);
......
......@@ -247,15 +247,17 @@ void OffscreenCanvas::DiscardImageBuffer() {
ImageBuffer* OffscreenCanvas::GetOrCreateImageBuffer() {
if (!image_buffer_) {
bool is_accelerated_2d_canvas_blacklisted = true;
base::WeakPtr<WebGraphicsContext3DProviderWrapper>
context_provider_wrapper = SharedGpuContext::ContextProviderWrapper();
if (context_provider_wrapper) {
const gpu::GpuFeatureInfo& gpu_feature_info =
context_provider_wrapper->ContextProvider()->GetGpuFeatureInfo();
if (gpu::kGpuFeatureStatusEnabled ==
gpu_feature_info
.status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS]) {
is_accelerated_2d_canvas_blacklisted = false;
if (SharedGpuContext::IsGpuCompositingEnabled()) {
base::WeakPtr<WebGraphicsContext3DProviderWrapper>
context_provider_wrapper = SharedGpuContext::ContextProviderWrapper();
if (context_provider_wrapper) {
const gpu::GpuFeatureInfo& gpu_feature_info =
context_provider_wrapper->ContextProvider()->GetGpuFeatureInfo();
if (gpu::kGpuFeatureStatusEnabled ==
gpu_feature_info
.status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS]) {
is_accelerated_2d_canvas_blacklisted = false;
}
}
}
......
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