Skip to content

Commit

Permalink
Move some content_switches into blink.
Browse files Browse the repository at this point in the history
These switches will be used inside blink when the LayerTreeSettings
are created solely in blink (instead of at the content layer). In order
to do that we have to move some switches first.

BUG=1097816

Change-Id: I5771d65c454dd6bb276270f90f1f8f7df556ee65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2260938
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782444}
  • Loading branch information
dtapuska authored and Commit Bot committed Jun 25, 2020
1 parent e03c513 commit 9bcf6cc
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 139 deletions.
5 changes: 3 additions & 2 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
#include "third_party/blink/public/common/experiments/memory_ablation_experiment.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/forcedark/forcedark_switches.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/leveldatabase/leveldb_features.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h"
Expand Down Expand Up @@ -2500,8 +2501,8 @@ const FeatureEntry kFeatureEntries[] = {
#endif // OS_ANDROID
{"enable-zero-copy", flag_descriptions::kZeroCopyName,
flag_descriptions::kZeroCopyDescription, kOsAll,
ENABLE_DISABLE_VALUE_TYPE(switches::kEnableZeroCopy,
switches::kDisableZeroCopy)},
ENABLE_DISABLE_VALUE_TYPE(blink::switches::kEnableZeroCopy,
blink::switches::kDisableZeroCopy)},
{"enable-vulkan", flag_descriptions::kEnableVulkanName,
flag_descriptions::kEnableVulkanDescription,
kOsWin | kOsLinux | kOsAndroid, FEATURE_VALUE_TYPE(features::kVulkan)},
Expand Down
17 changes: 9 additions & 8 deletions chrome/browser/chromeos/login/chrome_restart_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "media/capture/capture_switches.h"
#include "media/media_buildflags.h"
#include "services/service_manager/sandbox/switches.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/cros_system_api/switches/chrome_switches.h"
#include "ui/base/ui_base_switches.h"
#include "ui/display/display_switches.h"
Expand Down Expand Up @@ -99,32 +100,25 @@ void DeriveCommandLine(const GURL& start_url,
::switches::kDisableGpuWatchdog,
::switches::kDisableGpuCompositing,
::switches::kDisableGpuRasterization,
::switches::kDisableLowResTiling,
::switches::kDisableOopRasterization,
::switches::kDisablePartialRaster,
::switches::kDisablePepper3DImageChromium,
::switches::kDisablePreferCompositingToLCDText,
::switches::kDisableRGBA4444Textures,
::switches::kDisableThreadedScrolling,
::switches::kDisableTouchDragDrop,
::switches::kDisableVideoCaptureUseGpuMemoryBuffer,
::switches::kDisableYUVImageDecoding,
::switches::kDisableZeroCopy,
::switches::kEnableBlinkFeatures,
::switches::kEnableGpuMemoryBufferVideoFrames,
::switches::kEnableGpuRasterization,
::switches::kEnableLogging,
::switches::kEnableLowResTiling,
::switches::kEnableNativeGpuMemoryBuffers,
::switches::kEnableOopRasterization,
::switches::kEnablePreferCompositingToLCDText,
::switches::kEnableRGBA4444Textures,
::switches::kEnableTouchDragDrop,
::switches::kEnableUnifiedDesktop,
::switches::kEnableUseHDRTransferFunction,
::switches::kEnableUseZoomForDSF,
::switches::kEnableViewport,
::switches::kEnableZeroCopy,
::switches::kEnableHardwareOverlays,
::switches::kEdgeTouchFiltering,
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
Expand All @@ -134,7 +128,6 @@ void DeriveCommandLine(const GURL& start_url,
::switches::kMainFrameResizesAreOrientationChanges,
::switches::kForceDeviceScaleFactor,
::switches::kForceGpuMemAvailableMb,
::switches::kGpuRasterizationMSAASampleCount,
::switches::kGpuStartupDialog,
::switches::kGpuSandboxStartEarly,
::switches::kNumRasterThreads,
Expand Down Expand Up @@ -173,6 +166,14 @@ void DeriveCommandLine(const GURL& start_url,
ash::switches::kAuraLegacyPowerButton,
ash::switches::kEnableDimShelf,
ash::switches::kShowTaps,
blink::switches::kDisableLowResTiling,
blink::switches::kDisablePartialRaster,
blink::switches::kDisableRGBA4444Textures,
blink::switches::kDisableZeroCopy,
blink::switches::kEnableLowResTiling,
blink::switches::kEnableRGBA4444Textures,
blink::switches::kEnableZeroCopy,
blink::switches::kGpuRasterizationMSAASampleCount,
chromeos::switches::kDefaultWallpaperLarge,
chromeos::switches::kDefaultWallpaperSmall,
chromeos::switches::kGuestWallpaperLarge,
Expand Down
16 changes: 9 additions & 7 deletions content/browser/gpu/compositor_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "gpu/ipc/host/gpu_memory_buffer_support.h"
#include "gpu/vulkan/buildflags.h"
#include "media/media_buildflags.h"
#include "third_party/blink/public/common/switches.h"
#include "ui/gl/gl_switches.h"

namespace content {
Expand Down Expand Up @@ -411,22 +412,22 @@ bool IsZeroCopyUploadEnabled() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
#if defined(OS_MACOSX)
return !command_line.HasSwitch(switches::kDisableZeroCopy);
return !command_line.HasSwitch(blink::switches::kDisableZeroCopy);
#else
return command_line.HasSwitch(switches::kEnableZeroCopy);
return command_line.HasSwitch(blink::switches::kEnableZeroCopy);
#endif
}

bool IsPartialRasterEnabled() {
const auto& command_line = *base::CommandLine::ForCurrentProcess();
return !command_line.HasSwitch(switches::kDisablePartialRaster);
return !command_line.HasSwitch(blink::switches::kDisablePartialRaster);
}

bool IsGpuMemoryBufferCompositorResourcesEnabled() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(
switches::kEnableGpuMemoryBufferCompositorResources)) {
blink::switches::kEnableGpuMemoryBufferCompositorResources)) {
return true;
}
if (command_line.HasSwitch(
Expand All @@ -445,22 +446,23 @@ int GpuRasterizationMSAASampleCount() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();

if (!command_line.HasSwitch(switches::kGpuRasterizationMSAASampleCount))
if (!command_line.HasSwitch(
blink::switches::kGpuRasterizationMSAASampleCount))
#if defined(OS_ANDROID)
return 4;
#else
// Desktop platforms will compute this automatically based on DPI.
return -1;
#endif
std::string string_value = command_line.GetSwitchValueASCII(
switches::kGpuRasterizationMSAASampleCount);
blink::switches::kGpuRasterizationMSAASampleCount);
int msaa_sample_count = 0;
if (base::StringToInt(string_value, &msaa_sample_count) &&
msaa_sample_count >= kMinMSAASampleCount) {
return msaa_sample_count;
} else {
DLOG(WARNING) << "Failed to parse switch "
<< switches::kGpuRasterizationMSAASampleCount << ": "
<< blink::switches::kGpuRasterizationMSAASampleCount << ": "
<< string_value;
return 0;
}
Expand Down
35 changes: 18 additions & 17 deletions content/browser/renderer_host/render_process_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3193,18 +3193,19 @@ static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) {

int msaa_sample_count = GpuRasterizationMSAASampleCount();
if (msaa_sample_count >= 0) {
command_line->AppendSwitchASCII(switches::kGpuRasterizationMSAASampleCount,
base::NumberToString(msaa_sample_count));
command_line->AppendSwitchASCII(
blink::switches::kGpuRasterizationMSAASampleCount,
base::NumberToString(msaa_sample_count));
}

if (IsZeroCopyUploadEnabled())
command_line->AppendSwitch(switches::kEnableZeroCopy);
command_line->AppendSwitch(blink::switches::kEnableZeroCopy);
if (!IsPartialRasterEnabled())
command_line->AppendSwitch(switches::kDisablePartialRaster);
command_line->AppendSwitch(blink::switches::kDisablePartialRaster);

if (IsGpuMemoryBufferCompositorResourcesEnabled()) {
command_line->AppendSwitch(
switches::kEnableGpuMemoryBufferCompositorResources);
blink::switches::kEnableGpuMemoryBufferCompositorResources);
}

if (IsMainFrameBeforeActivationEnabled())
Expand Down Expand Up @@ -3281,9 +3282,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kAudioBufferSize,
switches::kAutoplayPolicy,
switches::kBlinkSettings,
switches::kDefaultTileWidth,
switches::kDefaultTileHeight,
switches::kMinHeightForGpuRasterTile,
switches::kMojoCoreLibraryPath,
switches::kDisable2dCanvasImageChromium,
switches::kDisableYUVImageDecoding,
Expand All @@ -3296,8 +3294,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisableFileSystem,
switches::kDisableFrameRateLimit,
switches::kDisableGpuMemoryBufferVideoFrames,
switches::kDisableImageAnimationResync,
switches::kDisableLowResTiling,
switches::kDisableHistogramCustomizer,
switches::kDisableLCDText,
switches::kDisableLogging,
Expand All @@ -3309,7 +3305,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kDisablePepper3DImageChromium,
switches::kDisablePermissionsAPI,
switches::kDisablePresentationAPI,
switches::kDisableRGBA4444Textures,
switches::kDisableRTCSmoothnessAlgorithm,
switches::kDisableScrollToTextFragment,
switches::kDisableSharedWorkers,
Expand All @@ -3332,15 +3327,13 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableGpuClientTracing,
switches::kEnableGpuMemoryBufferVideoFrames,
switches::kEnableGPUServiceLogging,
switches::kEnableLowResTiling,
switches::kEnableLCDText,
switches::kEnableLogging,
switches::kEnableNetworkInformationDownlinkMax,
switches::kEnableOopRasterization,
switches::kEnablePluginPlaceholderTesting,
switches::kEnablePreciseMemoryInfo,
switches::kEnablePreferCompositingToLCDText,
switches::kEnableRGBA4444Textures,
switches::kEnableSkiaBenchmarking,
switches::kEnableThreadedCompositing,
switches::kEnableTouchDragDrop,
Expand All @@ -3366,8 +3359,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kLogFile,
switches::kLoggingLevel,
switches::kMaxActiveWebGLContexts,
switches::kMaxUntiledLayerWidth,
switches::kMaxUntiledLayerHeight,
switches::kMSEAudioBufferSizeLimitMb,
switches::kMSEVideoBufferSizeLimitMb,
switches::kNetworkQuietTimeout,
Expand All @@ -3384,8 +3375,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kRemoteDebuggingPort,
switches::kRendererStartupDialog,
switches::kReportVp9AsAnUnsupportedMimeType,
switches::kShowLayoutShiftRegions,
switches::kShowPaintRects,
switches::kStatsCollectionController,
switches::kSkiaFontCacheLimitMb,
switches::kSkiaResourceCacheLimitMb,
Expand All @@ -3405,6 +3394,18 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kWebglMSAASampleCount,
// Please keep these in alphabetical order.
blink::switches::kAllowPreCommitInput,
blink::switches::kDefaultTileWidth,
blink::switches::kDefaultTileHeight,
blink::switches::kDisableImageAnimationResync,
blink::switches::kDisableLowResTiling,
blink::switches::kDisableRGBA4444Textures,
blink::switches::kEnableLowResTiling,
blink::switches::kEnableRGBA4444Textures,
blink::switches::kMinHeightForGpuRasterTile,
blink::switches::kMaxUntiledLayerWidth,
blink::switches::kMaxUntiledLayerHeight,
blink::switches::kShowLayoutShiftRegions,
blink::switches::kShowPaintRects,
// Please keep these in alphabetical order. Compositor switches here
// should also be added to
// chrome/browser/chromeos/login/chrome_restart_request.cc.
Expand Down
5 changes: 3 additions & 2 deletions content/child/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/network_switches.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/base/ui_base_features.h"
Expand Down Expand Up @@ -75,7 +76,7 @@ void SetRuntimeFeatureDefaultsForPlatform(
#if defined(OS_MACOSX)
const bool enable_canvas_2d_image_chromium =
command_line.HasSwitch(
switches::kEnableGpuMemoryBufferCompositorResources) &&
blink::switches::kEnableGpuMemoryBufferCompositorResources) &&
!command_line.HasSwitch(switches::kDisable2dCanvasImageChromium) &&
!command_line.HasSwitch(switches::kDisableGpu) &&
base::FeatureList::IsEnabled(features::kCanvas2DImageChromium);
Expand All @@ -88,7 +89,7 @@ void SetRuntimeFeatureDefaultsForPlatform(
#if defined(OS_MACOSX)
const bool enable_web_gl_image_chromium =
command_line.HasSwitch(
switches::kEnableGpuMemoryBufferCompositorResources) &&
blink::switches::kEnableGpuMemoryBufferCompositorResources) &&
!command_line.HasSwitch(switches::kDisableWebGLImageChromium) &&
!command_line.HasSwitch(switches::kDisableGpu) &&
base::FeatureList::IsEnabled(features::kWebGLImageChromium);
Expand Down
Loading

0 comments on commit 9bcf6cc

Please sign in to comment.