Commit 50cf1995 authored by reveman@chromium.org's avatar reveman@chromium.org

Re-land: content: Avoid duplicating the logic used to determine GPU features.

For features that need to be determined if used in the browser,
keep all the logic on browser side rather than duplicating it
in the renderer.

BUG=354449

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260311 0039d316-1c4b-4281-b951-d872f2087c98
parent f8ecc8d0
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
namespace content { namespace content {
// Note: When adding a function here, please make sure the logic is not
// duplicated in the renderer.
// Returns true if the threaded compositor is on (via flags or field trial). // Returns true if the threaded compositor is on (via flags or field trial).
CONTENT_EXPORT bool IsThreadedCompositingEnabled(); CONTENT_EXPORT bool IsThreadedCompositingEnabled();
......
...@@ -956,13 +956,16 @@ StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { ...@@ -956,13 +956,16 @@ StoragePartition* RenderProcessHostImpl::GetStoragePartition() const {
} }
static void AppendGpuCommandLineFlags(CommandLine* command_line) { static void AppendGpuCommandLineFlags(CommandLine* command_line) {
if (content::IsThreadedCompositingEnabled()) if (IsThreadedCompositingEnabled())
command_line->AppendSwitch(switches::kEnableThreadedCompositing); command_line->AppendSwitch(switches::kEnableThreadedCompositing);
if (content::IsDelegatedRendererEnabled()) if (IsForceCompositingModeEnabled())
command_line->AppendSwitch(switches::kForceCompositingMode);
if (IsDelegatedRendererEnabled())
command_line->AppendSwitch(switches::kEnableDelegatedRenderer); command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
if (content::IsImplSidePaintingEnabled()) if (IsImplSidePaintingEnabled())
command_line->AppendSwitch(switches::kEnableImplSidePainting); command_line->AppendSwitch(switches::kEnableImplSidePainting);
// Appending disable-gpu-feature switches due to software rendering list. // Appending disable-gpu-feature switches due to software rendering list.
...@@ -1028,7 +1031,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -1028,7 +1031,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisableCompositingForFixedPosition, switches::kDisableCompositingForFixedPosition,
switches::kDisableCompositingForTransition, switches::kDisableCompositingForTransition,
switches::kDisableDatabases, switches::kDisableDatabases,
switches::kDisableDelegatedRenderer,
switches::kDisableDesktopNotifications, switches::kDisableDesktopNotifications,
switches::kDisableDirectNPAPIRequests, switches::kDisableDirectNPAPIRequests,
switches::kDisableFastTextAutosizing, switches::kDisableFastTextAutosizing,
...@@ -1040,7 +1042,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -1040,7 +1042,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisableGpuVsync, switches::kDisableGpuVsync,
switches::kDisableLowResTiling, switches::kDisableLowResTiling,
switches::kDisableHistogramCustomizer, switches::kDisableHistogramCustomizer,
switches::kDisableImplSidePainting,
switches::kDisableLCDText, switches::kDisableLCDText,
switches::kDisableLayerSquashing, switches::kDisableLayerSquashing,
switches::kDisableLocalStorage, switches::kDisableLocalStorage,
...@@ -1054,7 +1055,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -1054,7 +1055,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisableSessionStorage, switches::kDisableSessionStorage,
switches::kDisableSharedWorkers, switches::kDisableSharedWorkers,
switches::kDisableSpeechInput, switches::kDisableSpeechInput,
switches::kDisableThreadedCompositing,
switches::kDisableTouchAdjustment, switches::kDisableTouchAdjustment,
switches::kDisableTouchDragDrop, switches::kDisableTouchDragDrop,
switches::kDisableTouchEditing, switches::kDisableTouchEditing,
...@@ -1072,7 +1072,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -1072,7 +1072,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableCompositingForFixedPosition, switches::kEnableCompositingForFixedPosition,
switches::kEnableCompositingForTransition, switches::kEnableCompositingForTransition,
switches::kEnableDeferredImageDecoding, switches::kEnableDeferredImageDecoding,
switches::kEnableDelegatedRenderer,
switches::kEnableEncryptedMedia, switches::kEnableEncryptedMedia,
switches::kEnableExperimentalCanvasFeatures, switches::kEnableExperimentalCanvasFeatures,
switches::kEnableExperimentalWebPlatformFeatures, switches::kEnableExperimentalWebPlatformFeatures,
...@@ -1085,7 +1084,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -1085,7 +1084,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableHighDpiCompositingForFixedPosition, switches::kEnableHighDpiCompositingForFixedPosition,
switches::kEnableHTMLImports, switches::kEnableHTMLImports,
switches::kEnableLowResTiling, switches::kEnableLowResTiling,
switches::kEnableImplSidePainting,
switches::kEnableInbandTextTracks, switches::kEnableInbandTextTracks,
switches::kEnableLCDText, switches::kEnableLCDText,
switches::kEnableLayerSquashing, switches::kEnableLayerSquashing,
...@@ -1105,7 +1103,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( ...@@ -1105,7 +1103,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableStatsTable, switches::kEnableStatsTable,
switches::kEnableStrictSiteIsolation, switches::kEnableStrictSiteIsolation,
switches::kEnableTargetedStyleRecalc, switches::kEnableTargetedStyleRecalc,
switches::kEnableThreadedCompositing,
switches::kEnableUniversalAcceleratedOverflowScroll, switches::kEnableUniversalAcceleratedOverflowScroll,
switches::kEnableTouchDragDrop, switches::kEnableTouchDragDrop,
switches::kEnableTouchEditing, switches::kEnableTouchEditing,
......
...@@ -414,9 +414,7 @@ WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) { ...@@ -414,9 +414,7 @@ WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) {
prefs.accelerated_compositing_enabled = prefs.accelerated_compositing_enabled =
GpuProcessHost::gpu_enabled() && GpuProcessHost::gpu_enabled() &&
!command_line.HasSwitch(switches::kDisableAcceleratedCompositing); !command_line.HasSwitch(switches::kDisableAcceleratedCompositing);
prefs.force_compositing_mode = prefs.force_compositing_mode = content::IsForceCompositingModeEnabled();
content::IsForceCompositingModeEnabled() &&
!command_line.HasSwitch(switches::kDisableForceCompositingMode);
prefs.accelerated_2d_canvas_enabled = prefs.accelerated_2d_canvas_enabled =
GpuProcessHost::gpu_enabled() && GpuProcessHost::gpu_enabled() &&
!command_line.HasSwitch(switches::kDisableAccelerated2dCanvas); !command_line.HasSwitch(switches::kDisableAccelerated2dCanvas);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "content/browser/android/in_process/synchronous_compositor_impl.h" #include "content/browser/android/in_process/synchronous_compositor_impl.h"
#include "content/browser/android/overscroll_glow.h" #include "content/browser/android/overscroll_glow.h"
#include "content/browser/devtools/render_view_devtools_agent_host.h" #include "content/browser/devtools/render_view_devtools_agent_host.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/gpu/gpu_surface_tracker.h" #include "content/browser/gpu/gpu_surface_tracker.h"
...@@ -152,10 +153,7 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( ...@@ -152,10 +153,7 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
widget_host->GetProcess()->GetID(), widget_host->GetProcess()->GetID(),
widget_host->GetRoutingID()) != NULL), widget_host->GetRoutingID()) != NULL),
frame_evictor_(new DelegatedFrameEvictor(this)), frame_evictor_(new DelegatedFrameEvictor(this)),
using_delegated_renderer_(CommandLine::ForCurrentProcess()->HasSwitch( using_delegated_renderer_(IsDelegatedRendererEnabled()),
switches::kEnableDelegatedRenderer) &&
!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableDelegatedRenderer)),
locks_on_frame_count_(0), locks_on_frame_count_(0),
root_window_destroyed_(false) { root_window_destroyed_(false) {
if (!using_delegated_renderer_) { if (!using_delegated_renderer_) {
......
...@@ -411,8 +411,7 @@ void RenderThreadImpl::Init() { ...@@ -411,8 +411,7 @@ void RenderThreadImpl::Init() {
RegisterExtension(GpuBenchmarkingExtension::Get()); RegisterExtension(GpuBenchmarkingExtension::Get());
is_impl_side_painting_enabled_ = is_impl_side_painting_enabled_ =
command_line.HasSwitch(switches::kEnableImplSidePainting) && command_line.HasSwitch(switches::kEnableImplSidePainting);
!command_line.HasSwitch(switches::kDisableImplSidePainting);
webkit::WebLayerImpl::SetImplSidePaintingEnabled( webkit::WebLayerImpl::SetImplSidePaintingEnabled(
is_impl_side_painting_enabled_); is_impl_side_painting_enabled_);
......
...@@ -942,8 +942,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { ...@@ -942,8 +942,7 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
} }
uint32 output_surface_id = next_output_surface_id_++; uint32 output_surface_id = next_output_surface_id_++;
if (command_line.HasSwitch(switches::kEnableDelegatedRenderer) && if (command_line.HasSwitch(switches::kEnableDelegatedRenderer)) {
!command_line.HasSwitch(switches::kDisableDelegatedRenderer)) {
DCHECK(is_threaded_compositing_enabled_); DCHECK(is_threaded_compositing_enabled_);
return scoped_ptr<cc::OutputSurface>( return scoped_ptr<cc::OutputSurface>(
new DelegatedCompositorOutputSurface( new DelegatedCompositorOutputSurface(
......
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