Skip to content

Commit

Permalink
[Chromecast] Rename disable_display flag to is_cast_audio_only.
Browse files Browse the repository at this point in the history
The disable_display flag is problematic in two ways:
 * It is not obviously Cast-specific from the name.
 * It is not named in the affirmative.

Fix these two problems by renaming this flag to is_cast_audio_only.

BUG=627641

Review-Url: https://codereview.chromium.org/2288283002
Cr-Commit-Position: refs/heads/master@{#415941}
  • Loading branch information
slan authored and Commit bot committed Sep 1, 2016
1 parent bc8e5f7 commit a0671e4
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions build/config/chromecast_build.gni
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ declare_args() {
is_chromecast = false

# Set this true for an audio-only Chromecast build.
disable_display = false
is_cast_audio_only = false
}

# Note(slan): This arg depends on the value of is_chromecast, and thus must be
Expand All @@ -31,6 +31,6 @@ declare_args() {
assert(is_linux || is_android || !is_chromecast,
"Chromecast builds are not supported on $target_os")

# Assert that disable_display and is_cast_desktop_build are both false on a
# Assert that is_cast_audio_only and is_cast_desktop_build are both false on a
# non-Chromecast build.
assert(is_chromecast || !(disable_display || is_cast_desktop_build))
assert(is_chromecast || (!is_cast_audio_only && !is_cast_desktop_build))
6 changes: 3 additions & 3 deletions chromecast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ cast_test_group("cast_tests") {
# Disable ProcessUtilTest.* (need to define OS_ANDROID)
# Disable StackContainer.BufferAlignment (don't support 16-byte alignment)
# Disable SystemMetrics2Test.GetSystemMemoryInfo (buffers>0 can't be guaranteed)
if (disable_display) {
if (is_cast_audio_only) {
# Also disable TimeFormattingTest on audio-only builds, since we don't
# include the necessary info in icudtl.dat.
filters += [ "base_unittests --gtest_filter=-ProcessMetricsTest.GetNumberOfThreads:ProcessUtilTest.*:StackContainer.BufferAlignment:SystemMetrics2Test.GetSystemMemoryInfo:TimeFormattingTest.*" ]
Expand Down Expand Up @@ -144,7 +144,7 @@ cast_test_group("cast_tests") {
}
}

if (!disable_display) {
if (!is_cast_audio_only) {
tests += [ "//gpu:gpu_unittests" ]
}
}
Expand Down Expand Up @@ -306,7 +306,7 @@ action("chromecast_locales_pak") {

buildflag_header("chromecast_features") {
header = "chromecast_features.h"
flags = [ "DISABLE_DISPLAY=$disable_display" ]
flags = [ "IS_CAST_AUDIO_ONLY=$is_cast_audio_only" ]
}

if (is_android) {
Expand Down
8 changes: 4 additions & 4 deletions chromecast/browser/cast_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ DefaultCommandLineSwitch g_default_switches[] = {
// Enable media sessions by default (even on non-Android platforms).
{ switches::kEnableDefaultMediaSession, "" },
#endif
#if BUILDFLAG(DISABLE_DISPLAY)
#if BUILDFLAG(IS_CAST_AUDIO_ONLY)
{ switches::kDisableGpu, "" },
#endif
#if defined(OS_LINUX)
Expand All @@ -234,7 +234,7 @@ DefaultCommandLineSwitch g_default_switches[] = {
#elif defined(ARCH_CPU_ARM_FAMILY)
// On Linux arm, enable CMA pipeline by default.
{ switches::kEnableCmaMediaPipeline, "" },
#if !BUILDFLAG(DISABLE_DISPLAY)
#if !BUILDFLAG(IS_CAST_AUDIO_ONLY)
{ switches::kEnableHardwareOverlays, "" },
#endif
#endif
Expand Down Expand Up @@ -462,9 +462,9 @@ void CastBrowserMainParts::PreMainMessageLoopRun() {
cast_browser_process_->browser_client()
->EnableRemoteDebuggingImmediately()));

#if defined(USE_AURA) && !BUILDFLAG(DISABLE_DISPLAY)
#if defined(USE_AURA) && !BUILDFLAG(IS_CAST_AUDIO_ONLY)
// TODO(halliwell) move audio builds to use ozone_platform_cast, then can
// simplify this by removing DISABLE_DISPLAY condition. Should then also
// simplify this by removing IS_CAST_AUDIO_ONLY condition. Should then also
// assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone.
gfx::Size display_size =
display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel();
Expand Down
2 changes: 1 addition & 1 deletion chromecast/browser/test/chromecast_shell_browser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ IN_PROC_BROWSER_TEST_F(ChromecastShellBrowserTest, AudioPlaybackWavPcm) {
PlayAudio("bear_pcm.wav");
}

#if !BUILDFLAG(DISABLE_DISPLAY)
#if !BUILDFLAG(IS_CAST_AUDIO_ONLY)
IN_PROC_BROWSER_TEST_F(ChromecastShellBrowserTest, VideoPlaybackMp4) {
PlayVideo("bear.mp4");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace chromecast {
namespace media {
namespace {
#if BUILDFLAG(DISABLE_DISPLAY)
#if BUILDFLAG(IS_CAST_AUDIO_ONLY)
constexpr int kAudioDecoderLimit = std::numeric_limits<int>::max();
#else
constexpr int kAudioDecoderLimit = 2;
Expand Down
2 changes: 1 addition & 1 deletion media/media_options.gni
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ declare_args() {
# Alsa should be used on non-Android, non-Mac POSIX systems.
# Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
if (is_posix && !is_android && !is_mac &&
(!is_chromecast || is_cast_desktop_build || disable_display)) {
(!is_chromecast || is_cast_desktop_build || is_cast_audio_only)) {
use_alsa = true

# Pulse is not supported on Chromecast platforms.
Expand Down
2 changes: 1 addition & 1 deletion ui/ozone/ozone.gni
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare_args() {
# platform with --ozone-platform=x11.
# TODO(halliwell): Create a libcast_graphics implementation for desktop
# using X11, and disable this platform.
if (is_cast_desktop_build && !disable_display) {
if (is_cast_desktop_build && !is_cast_audio_only) {
ozone_platform_x11 = true
} else {
ozone_platform = "cast"
Expand Down
4 changes: 2 additions & 2 deletions ui/ozone/platform/cast/ozone_platform_cast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ class OzonePlatformCast : public OzonePlatform {
// or if we're an audio-only build.
// Note: switch is kDisableGpu from content/public/common/content_switches.h
bool enable_dummy_software_rendering = true;
#if !BUILDFLAG(DISABLE_DISPLAY)
#if !BUILDFLAG(IS_CAST_AUDIO_ONLY)
enable_dummy_software_rendering =
base::CommandLine::ForCurrentProcess()->HasSwitch("disable-gpu");
#endif // BUILDFLAG(DISABLE_DISPLAY)
#endif // BUILDFLAG(IS_CAST_AUDIO_ONLY)

if (enable_dummy_software_rendering)
surface_factory_.reset(new SurfaceFactoryCast());
Expand Down

0 comments on commit a0671e4

Please sign in to comment.