Commit 8a063346 authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

chromecast: Migrate IS_CHROMECAST to common buildflag

The IS_CHROMECAST define is declared in 16 different places, which is
risky especially if the define is used in a header file.

Move this to a common buildflag header in //build, alongside the chrome
branding flags. This flag needs to be in a widely scoped location, since
we don't know if we're allowed to use //chromecast until we check the
flag's value.

OS_CHROMEOS uses a global #define for this, and that would work here, but
global ifdefs are discouraged. There are few enough uses of IS_CHROMECAST
that having explicit dependencies on a buildflag header isn't too onerous.

No functional change.

Bug: 1030969
TBR=kylechar@chromium.org, dgozman@chromium.org, benwells@chromium.org, kbr@chromium.org, dalecurtis@chromium.org, reillyg@chromium.org, foolip@chromium.org

Change-Id: I48d9ffccde7e7a680ce572f15a8ba1ef11adcc6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1951981
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: default avatarLuke Halliwell (slow) <halliwell@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722665}
parent 6c753810
...@@ -2243,6 +2243,7 @@ component("i18n") { ...@@ -2243,6 +2243,7 @@ component("i18n") {
deps = [ deps = [
":base", ":base",
"//base/third_party/dynamic_annotations", "//base/third_party/dynamic_annotations",
"//build:chromecast_buildflags",
] ]
if (!is_debug) { if (!is_debug) {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "third_party/icu/source/common/unicode/putil.h" #include "third_party/icu/source/common/unicode/putil.h"
#include "third_party/icu/source/common/unicode/udata.h" #include "third_party/icu/source/common/unicode/udata.h"
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
#endif #endif
#if defined(OS_ANDROID) || defined(OS_FUCHSIA) || \ #if defined(OS_ANDROID) || defined(OS_FUCHSIA) || \
(defined(OS_LINUX) && !defined(IS_CHROMECAST)) (defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST))
#include "third_party/icu/source/i18n/unicode/timezone.h" #include "third_party/icu/source/i18n/unicode/timezone.h"
#endif #endif
...@@ -288,7 +289,7 @@ void InitializeIcuTimeZone() { ...@@ -288,7 +289,7 @@ void InitializeIcuTimeZone() {
fuchsia::IntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization(); fuchsia::IntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
icu::TimeZone::adoptDefault( icu::TimeZone::adoptDefault(
icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id))); icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
#elif defined(OS_LINUX) && !defined(IS_CHROMECAST) #elif defined(OS_LINUX) && !BUILDFLAG(IS_CHROMECAST)
// To respond to the timezone change properly, the default timezone // To respond to the timezone change properly, the default timezone
// cache in ICU has to be populated on starting up. // cache in ICU has to be populated on starting up.
// See TimeZoneMonitorLinux::NotifyClientsFromImpl(). // See TimeZoneMonitorLinux::NotifyClientsFromImpl().
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import("//build/buildflag_header.gni") import("//build/buildflag_header.gni")
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
source_set("buildflag_header_h") { source_set("buildflag_header_h") {
sources = [ sources = [
...@@ -26,3 +27,9 @@ buildflag_header("branding_buildflags") { ...@@ -26,3 +27,9 @@ buildflag_header("branding_buildflags") {
] ]
} }
} }
buildflag_header("chromecast_buildflags") {
header = "chromecast_buildflags.h"
flags = [ "IS_CHROMECAST=$is_chromecast" ]
}
...@@ -18,6 +18,4 @@ cast_source_set("gpu") { ...@@ -18,6 +18,4 @@ cast_source_set("gpu") {
"//content/public/child", "//content/public/child",
"//content/public/gpu", "//content/public/gpu",
] ]
defines = [ "IS_CHROMECAST" ]
} }
...@@ -190,6 +190,7 @@ viz_component("service") { ...@@ -190,6 +190,7 @@ viz_component("service") {
allow_circular_includes_from = [ ":gpu_service_dependencies" ] allow_circular_includes_from = [ ":gpu_service_dependencies" ]
deps = [ deps = [
"//build:chromecast_buildflags",
"//cc/base", "//cc/base",
"//cc/paint", "//cc/paint",
"//components/crash/core/common:crash_key", "//components/crash/core/common:crash_key",
...@@ -241,7 +242,6 @@ viz_component("service") { ...@@ -241,7 +242,6 @@ viz_component("service") {
} }
if (is_chromecast) { if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
deps += [ "//chromecast/media/service/mojom" ] deps += [ "//chromecast/media/service/mojom" ]
} }
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
#include "base/containers/adapters.h" #include "base/containers/adapters.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
#include "build/chromecast_buildflags.h"
#include "components/viz/common/quads/draw_quad.h" #include "components/viz/common/quads/draw_quad.h"
#include "components/viz/common/quads/solid_color_draw_quad.h" #include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/video_hole_draw_quad.h" #include "components/viz/common/quads/video_hole_draw_quad.h"
#include "components/viz/service/display/overlay_candidate_list.h" #include "components/viz/service/display/overlay_candidate_list.h"
#include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/rect_conversions.h"
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#endif #endif
...@@ -24,7 +25,7 @@ namespace { ...@@ -24,7 +25,7 @@ namespace {
base::LazyInstance<OverlayStrategyUnderlayCast::OverlayCompositedCallback>:: base::LazyInstance<OverlayStrategyUnderlayCast::OverlayCompositedCallback>::
DestructorAtExit g_overlay_composited_callback = LAZY_INSTANCE_INITIALIZER; DestructorAtExit g_overlay_composited_callback = LAZY_INSTANCE_INITIALIZER;
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
// This persistent mojo::Remote is bound then used by all the instances // This persistent mojo::Remote is bound then used by all the instances
// of OverlayStrategyUnderlayCast. // of OverlayStrategyUnderlayCast.
mojo::Remote<chromecast::media::mojom::VideoGeometrySetter>& mojo::Remote<chromecast::media::mojom::VideoGeometrySetter>&
...@@ -113,7 +114,7 @@ bool OverlayStrategyUnderlayCast::Attempt( ...@@ -113,7 +114,7 @@ bool OverlayStrategyUnderlayCast::Attempt(
// TODO(guohuideng): when migration to GPU process complete, remove // TODO(guohuideng): when migration to GPU process complete, remove
// the code that's for the browser process compositor. // the code that's for the browser process compositor.
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
if (g_overlay_composited_callback.Get().is_null()) { if (g_overlay_composited_callback.Get().is_null()) {
DCHECK(GetVideoGeometrySetter()); DCHECK(GetVideoGeometrySetter());
GetVideoGeometrySetter()->SetVideoGeometry( GetVideoGeometrySetter()->SetVideoGeometry(
...@@ -149,7 +150,7 @@ void OverlayStrategyUnderlayCast::SetOverlayCompositedCallback( ...@@ -149,7 +150,7 @@ void OverlayStrategyUnderlayCast::SetOverlayCompositedCallback(
g_overlay_composited_callback.Get() = cb; g_overlay_composited_callback.Get() = cb;
} }
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
// static // static
void OverlayStrategyUnderlayCast::ConnectVideoGeometrySetter( void OverlayStrategyUnderlayCast::ConnectVideoGeometrySetter(
mojo::PendingRemote<chromecast::media::mojom::VideoGeometrySetter> mojo::PendingRemote<chromecast::media::mojom::VideoGeometrySetter>
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "build/chromecast_buildflags.h"
#include "components/viz/service/display/overlay_strategy_underlay.h" #include "components/viz/service/display/overlay_strategy_underlay.h"
#include "components/viz/service/viz_service_export.h" #include "components/viz/service/viz_service_export.h"
#include "ui/gfx/overlay_transform.h" #include "ui/gfx/overlay_transform.h"
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
#include "chromecast/media/service/mojom/video_geometry_setter.mojom.h" #include "chromecast/media/service/mojom/video_geometry_setter.mojom.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#endif #endif
...@@ -46,7 +47,7 @@ class VIZ_SERVICE_EXPORT OverlayStrategyUnderlayCast ...@@ -46,7 +47,7 @@ class VIZ_SERVICE_EXPORT OverlayStrategyUnderlayCast
base::RepeatingCallback<void(const gfx::RectF&, gfx::OverlayTransform)>; base::RepeatingCallback<void(const gfx::RectF&, gfx::OverlayTransform)>;
static void SetOverlayCompositedCallback(const OverlayCompositedCallback& cb); static void SetOverlayCompositedCallback(const OverlayCompositedCallback& cb);
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
// In Chromecast build, OverlayStrategyUnderlayCast needs a valid mojo // In Chromecast build, OverlayStrategyUnderlayCast needs a valid mojo
// interface to VideoGeometrySetter Service (shared by all instances of // interface to VideoGeometrySetter Service (shared by all instances of
// OverlaystrategyUnderlayCast). This must be called before compositor starts. // OverlaystrategyUnderlayCast). This must be called before compositor starts.
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/chromecast_buildflags.h"
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "components/viz/common/display/renderer_settings.h" #include "components/viz/common/display/renderer_settings.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/frame_sinks/begin_frame_source.h"
...@@ -127,7 +128,7 @@ std::unique_ptr<OutputSurface> OutputSurfaceProviderImpl::CreateOutputSurface( ...@@ -127,7 +128,7 @@ std::unique_ptr<OutputSurface> OutputSurfaceProviderImpl::CreateOutputSurface(
renderer_settings); renderer_settings);
} }
if (!output_surface) { if (!output_surface) {
#if defined(OS_CHROMEOS) || defined(IS_CHROMECAST) #if defined(OS_CHROMEOS) || BUILDFLAG(IS_CHROMECAST)
// GPU compositing is expected to always work on Chrome OS so we should // GPU compositing is expected to always work on Chrome OS so we should
// never encounter fatal context error. This could be an unrecoverable // never encounter fatal context error. This could be an unrecoverable
// hardware error or a bug. // hardware error or a bug.
...@@ -165,7 +166,7 @@ std::unique_ptr<OutputSurface> OutputSurfaceProviderImpl::CreateOutputSurface( ...@@ -165,7 +166,7 @@ std::unique_ptr<OutputSurface> OutputSurfaceProviderImpl::CreateOutputSurface(
#endif #endif
if (IsFatalOrSurfaceFailure(context_result)) { if (IsFatalOrSurfaceFailure(context_result)) {
#if defined(OS_CHROMEOS) || defined(IS_CHROMECAST) #if defined(OS_CHROMEOS) || BUILDFLAG(IS_CHROMECAST)
// GL compositing is expected to always work on Chrome OS so we should // GL compositing is expected to always work on Chrome OS so we should
// never encounter fatal context error. This could be an unrecoverable // never encounter fatal context error. This could be an unrecoverable
// hardware error or a bug. // hardware error or a bug.
......
...@@ -51,7 +51,6 @@ source_set("main") { ...@@ -51,7 +51,6 @@ source_set("main") {
} }
if (is_chromecast) { if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
deps += [ "//chromecast/media/service/mojom" ] deps += [ "//chromecast/media/service/mojom" ]
} }
} }
...@@ -1983,10 +1983,6 @@ jumbo_source_set("browser") { ...@@ -1983,10 +1983,6 @@ jumbo_source_set("browser") {
defines += [ "ENABLE_PROTECTED_MEDIA_IDENTIFIER_PERMISSION" ] defines += [ "ENABLE_PROTECTED_MEDIA_IDENTIFIER_PERMISSION" ]
} }
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
if (is_chromecast && is_linux) { if (is_chromecast && is_linux) {
sources += [ sources += [
"tracing/cast_tracing_agent.cc", "tracing/cast_tracing_agent.cc",
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
...@@ -79,7 +80,7 @@ void MessagePortProvider::PostMessageToFrame( ...@@ -79,7 +80,7 @@ void MessagePortProvider::PostMessageToFrame(
} }
#endif #endif
#if defined(OS_FUCHSIA) || defined(IS_CHROMECAST) #if defined(OS_FUCHSIA) || BUILDFLAG(IS_CHROMECAST)
// static // static
void MessagePortProvider::PostMessageToFrame( void MessagePortProvider::PostMessageToFrame(
WebContents* web_contents, WebContents* web_contents,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "content/browser/tracing/tracing_controller_impl.h" #include "content/browser/tracing/tracing_controller_impl.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -461,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest, DoubleStopTracing) { ...@@ -461,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest, DoubleStopTracing) {
} }
// Only CrOS and Cast support system tracing. // Only CrOS and Cast support system tracing.
#if defined(OS_CHROMEOS) || (defined(IS_CHROMECAST) && defined(OS_LINUX)) #if defined(OS_CHROMEOS) || (BUILDFLAG(IS_CHROMECAST) && defined(OS_LINUX))
#define MAYBE_SystemTraceEvents SystemTraceEvents #define MAYBE_SystemTraceEvents SystemTraceEvents
#else #else
#define MAYBE_SystemTraceEvents DISABLED_SystemTraceEvents #define MAYBE_SystemTraceEvents DISABLED_SystemTraceEvents
......
...@@ -412,6 +412,7 @@ jumbo_source_set("browser_sources") { ...@@ -412,6 +412,7 @@ jumbo_source_set("browser_sources") {
} }
public_deps = [ public_deps = [
"//build:chromecast_buildflags",
"//components/download/public/common:public", "//components/download/public/common:public",
"//content/public/common:common_sources", "//content/public/common:common_sources",
"//ipc", "//ipc",
......
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#endif #endif
#if defined(OS_FUCHSIA) || defined(IS_CHROMECAST) #if defined(OS_FUCHSIA) || BUILDFLAG(IS_CHROMECAST)
#include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/common/messaging/message_port_channel.h"
#endif #endif
...@@ -49,7 +50,7 @@ class CONTENT_EXPORT MessagePortProvider { ...@@ -49,7 +50,7 @@ class CONTENT_EXPORT MessagePortProvider {
const base::android::JavaParamRef<jobjectArray>& ports); const base::android::JavaParamRef<jobjectArray>& ports);
#endif // OS_ANDROID #endif // OS_ANDROID
#if defined(OS_FUCHSIA) || defined(IS_CHROMECAST) #if defined(OS_FUCHSIA) || BUILDFLAG(IS_CHROMECAST)
// If |target_origin| is unset, then no origin scoping is applied. // If |target_origin| is unset, then no origin scoping is applied.
static void PostMessageToFrame( static void PostMessageToFrame(
WebContents* web_contents, WebContents* web_contents,
...@@ -57,7 +58,7 @@ class CONTENT_EXPORT MessagePortProvider { ...@@ -57,7 +58,7 @@ class CONTENT_EXPORT MessagePortProvider {
const base::Optional<base::string16>& target_origin, const base::Optional<base::string16>& target_origin,
const base::string16& data, const base::string16& data,
std::vector<mojo::ScopedMessagePipeHandle> channels); std::vector<mojo::ScopedMessagePipeHandle> channels);
#endif // OS_FUCHSIA || IS_CHROMECAST #endif // OS_FUCHSIA || BUILDFLAG(IS_CHROMECAST)
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortProvider); DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortProvider);
......
...@@ -664,10 +664,6 @@ target(link_target_type, "renderer") { ...@@ -664,10 +664,6 @@ target(link_target_type, "renderer") {
if (enable_ipc_fuzzer) { if (enable_ipc_fuzzer) {
configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ] configs += [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
} }
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
} }
# See comment at the top of //content/BUILD.gn for how this works. # See comment at the top of //content/BUILD.gn for how this works.
......
...@@ -1064,10 +1064,6 @@ test("content_browsertests") { ...@@ -1064,10 +1064,6 @@ test("content_browsertests") {
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
configs += [ configs += [
"//build/config:precompiled_headers", "//build/config:precompiled_headers",
"//build/config/compiler:no_size_t_to_int_warning", "//build/config/compiler:no_size_t_to_int_warning",
...@@ -1080,6 +1076,7 @@ test("content_browsertests") { ...@@ -1080,6 +1076,7 @@ test("content_browsertests") {
":web_test_support", ":web_test_support",
":web_ui_test_mojo_bindings", ":web_ui_test_mojo_bindings",
"//base/test:test_support", "//base/test:test_support",
"//build:chromecast_buildflags",
"//components/discardable_memory/client", "//components/discardable_memory/client",
"//components/discardable_memory/common", "//components/discardable_memory/common",
"//components/discardable_memory/service", "//components/discardable_memory/service",
...@@ -1929,6 +1926,7 @@ test("content_unittests") { ...@@ -1929,6 +1926,7 @@ test("content_unittests") {
"//base/allocator:buildflags", "//base/allocator:buildflags",
"//base/test:test_support", "//base/test:test_support",
"//base/third_party/dynamic_annotations", "//base/third_party/dynamic_annotations",
"//build:chromecast_buildflags",
"//cc", "//cc",
"//cc:test_support", "//cc:test_support",
"//components/cbor", "//components/cbor",
...@@ -2089,10 +2087,6 @@ test("content_unittests") { ...@@ -2089,10 +2087,6 @@ test("content_unittests") {
] ]
} }
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
# Screen capture unit tests. # Screen capture unit tests.
if (enable_screen_capture && !is_android) { if (enable_screen_capture && !is_android) {
deps += [ deps += [
......
...@@ -12,10 +12,6 @@ import("//testing/libfuzzer/fuzzer_test.gni") ...@@ -12,10 +12,6 @@ import("//testing/libfuzzer/fuzzer_test.gni")
# TODO(crbug.com/731689): Assert that extensions are enabled. # TODO(crbug.com/731689): Assert that extensions are enabled.
source_set("common_constants") { source_set("common_constants") {
if (is_chromecast) {
defines = [ "IS_CHROMECAST" ]
}
sources = [ sources = [
"constants.cc", "constants.cc",
"constants.h", "constants.h",
...@@ -23,6 +19,7 @@ source_set("common_constants") { ...@@ -23,6 +19,7 @@ source_set("common_constants") {
deps = [ deps = [
"//base", "//base",
"//build:chromecast_buildflags",
"//components/services/app_service/public/mojom", "//components/services/app_service/public/mojom",
"//components/version_info:channel", "//components/version_info:channel",
"//ui/base", "//ui/base",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "build/chromecast_buildflags.h"
namespace extensions { namespace extensions {
...@@ -97,7 +98,7 @@ const char kMimeTypePng[] = "image/png"; ...@@ -97,7 +98,7 @@ const char kMimeTypePng[] = "image/png";
namespace extension_misc { namespace extension_misc {
#if defined(OS_CHROMEOS) || defined(IS_CHROMECAST) #if defined(OS_CHROMEOS) || BUILDFLAG(IS_CHROMECAST)
// The extension id for the built-in component extension. // The extension id for the built-in component extension.
const char kChromeVoxExtensionId[] = "mndnfokpggljbaajbnioimlmbfngpief"; const char kChromeVoxExtensionId[] = "mndnfokpggljbaajbnioimlmbfngpief";
#else #else
......
...@@ -53,14 +53,12 @@ jumbo_component("service") { ...@@ -53,14 +53,12 @@ jumbo_component("service") {
"webgpu_command_buffer_stub.h", "webgpu_command_buffer_stub.h",
] ]
defines = [ "GPU_IPC_SERVICE_IMPLEMENTATION" ] defines = [ "GPU_IPC_SERVICE_IMPLEMENTATION" ]
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
if (subpixel_font_rendering_disabled) { if (subpixel_font_rendering_disabled) {
defines += [ "SUBPIXEL_FONT_RENDERING_DISABLED" ] defines += [ "SUBPIXEL_FONT_RENDERING_DISABLED" ]
} }
public_deps = [ public_deps = [
"//base", "//base",
"//build:chromecast_buildflags",
"//components/viz/common", "//components/viz/common",
"//gpu/config", "//gpu/config",
"//ipc", "//ipc",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/threading/scoped_blocking_call.h" #include "base/threading/scoped_blocking_call.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "components/viz/common/features.h" #include "components/viz/common/features.h"
#include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/service_utils.h" #include "gpu/command_buffer/service/service_utils.h"
...@@ -109,7 +110,7 @@ void InitializePlatformOverlaySettings(GPUInfo* gpu_info) { ...@@ -109,7 +110,7 @@ void InitializePlatformOverlaySettings(GPUInfo* gpu_info) {
#endif #endif
} }
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(IS_CHROMECAST) #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST)
bool CanAccessNvidiaDeviceFile() { bool CanAccessNvidiaDeviceFile() {
bool res = true; bool res = true;
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
...@@ -120,7 +121,7 @@ bool CanAccessNvidiaDeviceFile() { ...@@ -120,7 +121,7 @@ bool CanAccessNvidiaDeviceFile() {
} }
return res; return res;
} }
#endif // OS_LINUX && !OS_CHROMEOS && !IS_CHROMECAST #endif // OS_LINUX && !OS_CHROMEOS && !BUILDFLAG(IS_CHROMECAST)
class GpuWatchdogInit { class GpuWatchdogInit {
public: public:
...@@ -150,7 +151,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -150,7 +151,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
// need more context based GPUInfo. In such situations, switching to // need more context based GPUInfo. In such situations, switching to
// SwiftShader needs to wait until creating a context. // SwiftShader needs to wait until creating a context.
bool needs_more_info = true; bool needs_more_info = true;
#if !defined(OS_ANDROID) && !defined(IS_CHROMECAST) #if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMECAST)
needs_more_info = false; needs_more_info = false;
if (!PopGPUInfoCache(&gpu_info_)) { if (!PopGPUInfoCache(&gpu_info_)) {
CollectBasicGraphicsInfo(command_line, &gpu_info_); CollectBasicGraphicsInfo(command_line, &gpu_info_);
...@@ -181,7 +182,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, ...@@ -181,7 +182,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
gpu_feature_info_ = gpu::ComputeGpuFeatureInfo( gpu_feature_info_ = gpu::ComputeGpuFeatureInfo(
gpu_info_, gpu_preferences_, command_line, &needs_more_info); gpu_info_, gpu_preferences_, command_line, &needs_more_info);
} }
#endif // !OS_ANDROID && !IS_CHROMECAST #endif // !OS_ANDROID && !BUILDFLAG(IS_CHROMECAST)
gpu_info_.in_process_gpu = false; gpu_info_.in_process_gpu = false;
bool use_swiftshader = false; bool use_swiftshader = false;
...@@ -545,7 +546,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -545,7 +546,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
->GetSupportedFormatsForTexturing(); ->GetSupportedFormatsForTexturing();
#endif #endif
bool needs_more_info = true; bool needs_more_info = true;
#if !defined(IS_CHROMECAST) #if !BUILDFLAG(IS_CHROMECAST)
needs_more_info = false; needs_more_info = false;
if (!PopGPUInfoCache(&gpu_info_)) { if (!PopGPUInfoCache(&gpu_info_)) {
CollectBasicGraphicsInfo(command_line, &gpu_info_); CollectBasicGraphicsInfo(command_line, &gpu_info_);
...@@ -563,7 +564,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, ...@@ -563,7 +564,7 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
InitializeSwitchableGPUs( InitializeSwitchableGPUs(
gpu_feature_info_.enabled_gpu_driver_bug_workarounds); gpu_feature_info_.enabled_gpu_driver_bug_workarounds);
} }
#endif // !IS_CHROMECAST #endif // !BUILDFLAG(IS_CHROMECAST)
bool use_swiftshader = EnableSwiftShaderIfNeeded( bool use_swiftshader = EnableSwiftShaderIfNeeded(
command_line, gpu_feature_info_, command_line, gpu_feature_info_,
......
...@@ -32,9 +32,6 @@ if (is_android) { ...@@ -32,9 +32,6 @@ if (is_android) {
config("platform_config") { config("platform_config") {
defines = [] defines = []
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
if (use_alsa) { if (use_alsa) {
defines += [ "USE_ALSA" ] defines += [ "USE_ALSA" ]
} }
...@@ -149,6 +146,7 @@ source_set("audio") { ...@@ -149,6 +146,7 @@ source_set("audio") {
] ]
deps = [ deps = [
"//base", "//base",
"//build:chromecast_buildflags",
"//media/base", "//media/base",
"//url", "//url",
] ]
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "build/chromecast_buildflags.h"
#include "media/base/localized_strings.h" #include "media/base/localized_strings.h"
namespace media { namespace media {
...@@ -56,7 +57,7 @@ std::string AudioDeviceDescription::GetDefaultDeviceName() { ...@@ -56,7 +57,7 @@ std::string AudioDeviceDescription::GetDefaultDeviceName() {
std::string AudioDeviceDescription::GetCommunicationsDeviceName() { std::string AudioDeviceDescription::GetCommunicationsDeviceName() {
#if defined(OS_WIN) #if defined(OS_WIN)
return GetLocalizedStringUTF8(COMMUNICATIONS_AUDIO_DEVICE_NAME); return GetLocalizedStringUTF8(COMMUNICATIONS_AUDIO_DEVICE_NAME);
#elif defined(IS_CHROMECAST) #elif BUILDFLAG(IS_CHROMECAST)
return ""; return "";
#else #else
NOTREACHED(); NOTREACHED();
......
...@@ -74,6 +74,7 @@ source_set("formats") { ...@@ -74,6 +74,7 @@ source_set("formats") {
] ]
deps = [ deps = [
"//build:chromecast_buildflags",
"//media:media_buildflags", "//media:media_buildflags",
"//media/base", "//media/base",
"//third_party/libwebm", "//third_party/libwebm",
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/numerics/checked_math.h" #include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "build/chromecast_buildflags.h"
#include "media/base/decrypt_config.h" #include "media/base/decrypt_config.h"
#include "media/base/demuxer_memory_limit.h" #include "media/base/demuxer_memory_limit.h"
#include "media/base/encryption_pattern.h" #include "media/base/encryption_pattern.h"
...@@ -497,7 +498,7 @@ bool TrackRunIterator::Init(const MovieFragment& moof) { ...@@ -497,7 +498,7 @@ bool TrackRunIterator::Init(const MovieFragment& moof) {
// If we don't have a per-sample IV, get the constant IV. // If we don't have a per-sample IV, get the constant IV.
bool is_encrypted = index == 0 ? track_encryption->is_encrypted bool is_encrypted = index == 0 ? track_encryption->is_encrypted
: info_entry->is_encrypted; : info_entry->is_encrypted;
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
// On Chromecast, we only support setting the pattern values in the // On Chromecast, we only support setting the pattern values in the
// 'tenc' box for the track (not varying on per sample group basis). // 'tenc' box for the track (not varying on per sample group basis).
// Thus we need to verify that the settings in the sample group // Thus we need to verify that the settings in the sample group
...@@ -516,7 +517,7 @@ bool TrackRunIterator::Init(const MovieFragment& moof) { ...@@ -516,7 +517,7 @@ bool TrackRunIterator::Init(const MovieFragment& moof) {
"sample group does not match that in the tenc " "sample group does not match that in the tenc "
"box . This is not currently supported."); "box . This is not currently supported.");
} }
#endif // defined(IS_CHROMECAST) #endif // BUILDFLAG(IS_CHROMECAST)
if (is_encrypted && !iv_size) { if (is_encrypted && !iv_size) {
const uint8_t constant_iv_size = const uint8_t constant_iv_size =
index == 0 ? track_encryption->default_constant_iv_size index == 0 ? track_encryption->default_constant_iv_size
......
...@@ -171,13 +171,13 @@ source_set("media_manifest") { ...@@ -171,13 +171,13 @@ source_set("media_manifest") {
] ]
deps = [ deps = [
"//base", "//base",
"//build:chromecast_buildflags",
"//media/mojo:buildflags", "//media/mojo:buildflags",
"//media/mojo/mojom", "//media/mojo/mojom",
"//media/mojo/mojom:constants", "//media/mojo/mojom:constants",
"//services/service_manager/public/cpp", "//services/service_manager/public/cpp",
] ]
if (is_chromecast) { if (is_chromecast) {
defines = [ "IS_CHROMECAST" ]
deps += [ "//chromecast/common/mojom" ] deps += [ "//chromecast/common/mojom" ]
} }
} }
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#include "media/mojo/services/media_manifest.h" #include "media/mojo/services/media_manifest.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "build/chromecast_buildflags.h"
#include "media/mojo/buildflags.h" #include "media/mojo/buildflags.h"
#include "media/mojo/mojom/constants.mojom.h" #include "media/mojo/mojom/constants.mojom.h"
#include "media/mojo/mojom/media_service.mojom.h" #include "media/mojo/mojom/media_service.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h" #include "services/service_manager/public/cpp/manifest_builder.h"
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
#include "chromecast/common/mojom/constants.mojom.h" #include "chromecast/common/mojom/constants.mojom.h"
#endif #endif
...@@ -36,7 +37,7 @@ const service_manager::Manifest& GetMediaManifest() { ...@@ -36,7 +37,7 @@ const service_manager::Manifest& GetMediaManifest() {
.ExposeCapability( .ExposeCapability(
"media:media", "media:media",
service_manager::Manifest::InterfaceList<mojom::MediaService>()) service_manager::Manifest::InterfaceList<mojom::MediaService>())
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
.RequireCapability(chromecast::mojom::kChromecastServiceName, .RequireCapability(chromecast::mojom::kChromecastServiceName,
"multizone") "multizone")
#endif #endif
...@@ -58,7 +59,7 @@ const service_manager::Manifest& GetMediaRendererManifest() { ...@@ -58,7 +59,7 @@ const service_manager::Manifest& GetMediaRendererManifest() {
.ExposeCapability( .ExposeCapability(
"media:media", "media:media",
service_manager::Manifest::InterfaceList<mojom::MediaService>()) service_manager::Manifest::InterfaceList<mojom::MediaService>())
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
.RequireCapability(chromecast::mojom::kChromecastServiceName, .RequireCapability(chromecast::mojom::kChromecastServiceName,
"multizone") "multizone")
#endif #endif
......
...@@ -66,6 +66,7 @@ source_set("audio") { ...@@ -66,6 +66,7 @@ source_set("audio") {
deps = [ deps = [
":testing_api_support", ":testing_api_support",
"//build:chromecast_buildflags",
"//components/crash/core/common:crash_key", # Temporary: crbug.com/888478 "//components/crash/core/common:crash_key", # Temporary: crbug.com/888478
] ]
...@@ -101,10 +102,6 @@ source_set("audio") { ...@@ -101,10 +102,6 @@ source_set("audio") {
"//media:media_config", "//media:media_config",
"//media/audio:platform_config", "//media/audio:platform_config",
] ]
if (is_chromecast) {
defines = [ "IS_CHROMECAST" ]
}
} }
# NOTE: This is its own component target because it exposes static storage # NOTE: This is its own component target because it exposes static storage
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
#include "build/chromecast_buildflags.h"
#include "components/crash/core/common/crash_key.h" #include "components/crash/core/common/crash_key.h"
#include "media/audio/audio_device_description.h" #include "media/audio/audio_device_description.h"
#include "services/audio/input_stream.h" #include "services/audio/input_stream.h"
...@@ -126,7 +127,7 @@ void StreamFactory::CreateOutputStream( ...@@ -126,7 +127,7 @@ void StreamFactory::CreateOutputStream(
// This is required for multizone audio playback on Cast devices. // This is required for multizone audio playback on Cast devices.
// See //chromecast/media/cast_audio_manager.h for more information. // See //chromecast/media/cast_audio_manager.h for more information.
const std::string device_id_or_group_id = const std::string device_id_or_group_id =
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
(::media::AudioDeviceDescription::IsCommunicationsDevice( (::media::AudioDeviceDescription::IsCommunicationsDevice(
output_device_id) || output_device_id) ||
group_id.is_empty()) group_id.is_empty())
......
...@@ -24,6 +24,7 @@ source_set("time_zone_monitor") { ...@@ -24,6 +24,7 @@ source_set("time_zone_monitor") {
deps = [ deps = [
"//base", "//base",
"//build:chromecast_buildflags",
"//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings",
"//third_party/icu", "//third_party/icu",
] ]
...@@ -51,10 +52,6 @@ source_set("time_zone_monitor") { ...@@ -51,10 +52,6 @@ source_set("time_zone_monitor") {
if (is_fuchsia) { if (is_fuchsia) {
sources += [ "time_zone_monitor_fuchsia.cc" ] sources += [ "time_zone_monitor_fuchsia.cc" ]
} }
if (is_chromecast) {
defines = [ "IS_CHROMECAST" ]
}
} }
if (is_android) { if (is_android) {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "base/threading/scoped_blocking_call.h" #include "base/threading/scoped_blocking_call.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "third_party/icu/source/i18n/unicode/timezone.h" #include "third_party/icu/source/i18n/unicode/timezone.h"
namespace device { namespace device {
...@@ -36,7 +37,7 @@ class TimeZoneMonitorLinux : public TimeZoneMonitor { ...@@ -36,7 +37,7 @@ class TimeZoneMonitorLinux : public TimeZoneMonitor {
~TimeZoneMonitorLinux() override; ~TimeZoneMonitorLinux() override;
void NotifyClientsFromImpl() { void NotifyClientsFromImpl() {
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
// On Chromecast, ICU's default time zone is already set to a new zone. No // On Chromecast, ICU's default time zone is already set to a new zone. No
// need to redetect it with detectHostTimeZone() or to update ICU. // need to redetect it with detectHostTimeZone() or to update ICU.
// See http://b/112498903 and http://b/113344065. // See http://b/112498903 and http://b/113344065.
......
...@@ -219,6 +219,7 @@ jumbo_component("network_service") { ...@@ -219,6 +219,7 @@ jumbo_component("network_service") {
deps = [ deps = [
"//base", "//base",
"//build:chromecast_buildflags",
"//components/content_settings/core/common", "//components/content_settings/core/common",
"//components/cookie_config", "//components/cookie_config",
"//components/domain_reliability", "//components/domain_reliability",
...@@ -274,10 +275,6 @@ jumbo_component("network_service") { ...@@ -274,10 +275,6 @@ jumbo_component("network_service") {
defines = [ "IS_NETWORK_SERVICE_IMPL" ] defines = [ "IS_NETWORK_SERVICE_IMPL" ]
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
if (trial_comparison_cert_verifier_supported) { if (trial_comparison_cert_verifier_supported) {
sources += [ sources += [
"trial_comparison_cert_verifier_mojo.cc", "trial_comparison_cert_verifier_mojo.cc",
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "components/cookie_config/cookie_store_util.h" #include "components/cookie_config/cookie_store_util.h"
#include "components/domain_reliability/monitor.h" #include "components/domain_reliability/monitor.h"
#include "components/network_session_configurator/browser/network_session_configurator.h" #include "components/network_session_configurator/browser/network_session_configurator.h"
...@@ -1756,7 +1757,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( ...@@ -1756,7 +1757,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
net::CookieCryptoDelegate* crypto_delegate = nullptr; net::CookieCryptoDelegate* crypto_delegate = nullptr;
if (params_->enable_encrypted_cookies) { if (params_->enable_encrypted_cookies) {
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(IS_CHROMECAST) #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST)
DCHECK(network_service_->os_crypt_config_set()) DCHECK(network_service_->os_crypt_config_set())
<< "NetworkService::SetCryptConfig must be called before creating a " << "NetworkService::SetCryptConfig must be called before creating a "
"NetworkContext with encrypted cookies."; "NetworkContext with encrypted cookies.";
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/values.h" #include "base/values.h"
#include "build/chromecast_buildflags.h"
#include "components/network_session_configurator/common/network_features.h" #include "components/network_session_configurator/common/network_features.h"
#include "components/os_crypt/os_crypt.h" #include "components/os_crypt/os_crypt.h"
#include "mojo/core/embedder/embedder.h" #include "mojo/core/embedder/embedder.h"
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
#include "third_party/boringssl/src/include/openssl/cpu.h" #include "third_party/boringssl/src/include/openssl/cpu.h"
#endif #endif
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(IS_CHROMECAST) #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_CHROMECAST)
#include "components/os_crypt/key_storage_config_linux.h" #include "components/os_crypt/key_storage_config_linux.h"
#endif #endif
...@@ -615,7 +616,7 @@ void NetworkService::OnCertDBChanged() { ...@@ -615,7 +616,7 @@ void NetworkService::OnCertDBChanged() {
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
void NetworkService::SetCryptConfig(mojom::CryptConfigPtr crypt_config) { void NetworkService::SetCryptConfig(mojom::CryptConfigPtr crypt_config) {
#if !defined(IS_CHROMECAST) #if !BUILDFLAG(IS_CHROMECAST)
DCHECK(!os_crypt_config_set_); DCHECK(!os_crypt_config_set_);
auto config = std::make_unique<os_crypt::Config>(); auto config = std::make_unique<os_crypt::Config>();
config->store = crypt_config->store; config->store = crypt_config->store;
......
...@@ -110,10 +110,6 @@ jumbo_component("cpp") { ...@@ -110,10 +110,6 @@ jumbo_component("cpp") {
] ]
defines = [ "IS_NETWORK_CPP_IMPL" ] defines = [ "IS_NETWORK_CPP_IMPL" ]
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
} }
jumbo_component("cpp_base") { jumbo_component("cpp_base") {
......
...@@ -98,6 +98,7 @@ if (!is_nacl && !is_ios) { ...@@ -98,6 +98,7 @@ if (!is_nacl && !is_ios) {
all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ] all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
deps = [ deps = [
"//build:chromecast_buildflags",
"//third_party/perfetto/include/perfetto/protozero", "//third_party/perfetto/include/perfetto/protozero",
"//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite",
] ]
...@@ -111,10 +112,6 @@ if (!is_nacl && !is_ios) { ...@@ -111,10 +112,6 @@ if (!is_nacl && !is_ios) {
deps += [ "//third_party/perfetto/src/tracing:ipc" ] deps += [ "//third_party/perfetto/src/tracing:ipc" ]
} }
if (is_chromecast) {
defines += [ "IS_CHROMECAST" ]
}
if (is_android && can_unwind_with_cfi_table && is_official_build) { if (is_android && can_unwind_with_cfi_table && is_official_build) {
sources += [ sources += [
"stack_sampling/stack_sampler_android.cc", "stack_sampling/stack_sampler_android.cc",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/trace_event/trace_config.h" #include "base/trace_event/trace_config.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "services/tracing/public/mojom/perfetto_service.mojom.h" #include "services/tracing/public/mojom/perfetto_service.mojom.h"
namespace tracing { namespace tracing {
...@@ -102,7 +103,7 @@ perfetto::TraceConfig GetDefaultPerfettoConfig( ...@@ -102,7 +103,7 @@ perfetto::TraceConfig GetDefaultPerfettoConfig(
// Capture system trace events if supported and enabled. The datasources will // Capture system trace events if supported and enabled. The datasources will
// only emit events if system tracing is enabled in |chrome_config|. // only emit events if system tracing is enabled in |chrome_config|.
if (!privacy_filtering_enabled) { if (!privacy_filtering_enabled) {
#if defined(OS_CHROMEOS) || (defined(IS_CHROMECAST) && defined(OS_LINUX)) #if defined(OS_CHROMEOS) || (BUILDFLAG(IS_CHROMECAST) && defined(OS_LINUX))
AddDataSourceConfig(&perfetto_config, AddDataSourceConfig(&perfetto_config,
tracing::mojom::kSystemTraceDataSourceName, tracing::mojom::kSystemTraceDataSourceName,
chrome_config_string, privacy_filtering_enabled); chrome_config_string, privacy_filtering_enabled);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "components/tracing/common/tracing_switches.h" #include "components/tracing/common/tracing_switches.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -36,7 +37,7 @@ const base::Feature kPerfettoForceOutOfProcessProducer{ ...@@ -36,7 +37,7 @@ const base::Feature kPerfettoForceOutOfProcessProducer{
// Runs the tracing service as an in-process browser service. // Runs the tracing service as an in-process browser service.
const base::Feature kTracingServiceInProcess { const base::Feature kTracingServiceInProcess {
"TracingServiceInProcess", "TracingServiceInProcess",
#if defined(OS_ANDROID) || defined(IS_CHROMECAST) #if defined(OS_ANDROID) || BUILDFLAG(IS_CHROMECAST)
base::FEATURE_ENABLED_BY_DEFAULT base::FEATURE_ENABLED_BY_DEFAULT
#else #else
base::FEATURE_DISABLED_BY_DEFAULT base::FEATURE_DISABLED_BY_DEFAULT
......
...@@ -448,6 +448,7 @@ jumbo_source_set("unit_tests") { ...@@ -448,6 +448,7 @@ jumbo_source_set("unit_tests") {
deps = [ deps = [
":modules", ":modules",
":modules_testing", ":modules_testing",
"//build:chromecast_buildflags",
"//media:test_support", "//media:test_support",
"//net:quic_test_tools", "//net:quic_test_tools",
"//services/device/public/cpp:test_support", "//services/device/public/cpp:test_support",
......
...@@ -95,6 +95,7 @@ blink_modules_sources("mediastream") { ...@@ -95,6 +95,7 @@ blink_modules_sources("mediastream") {
"webmediaplayer_ms_compositor.h", "webmediaplayer_ms_compositor.h",
] ]
deps = [ deps = [
"//build:chromecast_buildflags",
"//media/capture/mojom:image_capture_blink", "//media/capture/mojom:image_capture_blink",
"//media/webrtc", "//media/webrtc",
] ]
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "media/base/audio_fifo.h" #include "media/base/audio_fifo.h"
#include "media/base/audio_parameters.h" #include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h" #include "media/base/channel_layout.h"
...@@ -531,10 +532,10 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule( ...@@ -531,10 +532,10 @@ void MediaStreamAudioProcessor::InitializeAudioProcessingModule(
base::FeatureList::IsEnabled(features::kWebRtcHybridAgc); base::FeatureList::IsEnabled(features::kWebRtcHybridAgc);
config.Set<webrtc::ExperimentalAgc>(experimental_agc); config.Set<webrtc::ExperimentalAgc>(experimental_agc);
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
} else { } else {
config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(false)); config.Set<webrtc::ExperimentalAgc>(new webrtc::ExperimentalAgc(false));
#endif // defined(IS_CHROMECAST) #endif // BUILDFLAG(IS_CHROMECAST)
} }
// Create and configure the webrtc::AudioProcessing. // Create and configure the webrtc::AudioProcessing.
...@@ -617,12 +618,12 @@ void MediaStreamAudioProcessor::InitializeCaptureFifo( ...@@ -617,12 +618,12 @@ void MediaStreamAudioProcessor::InitializeCaptureFifo(
// what format it would prefer. // what format it would prefer.
const int output_sample_rate = audio_processing_ const int output_sample_rate = audio_processing_
? ?
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
std::min(blink::kAudioProcessingSampleRate, std::min(blink::kAudioProcessingSampleRate,
input_format.sample_rate()) input_format.sample_rate())
#else #else
blink::kAudioProcessingSampleRate blink::kAudioProcessingSampleRate
#endif // defined(IS_CHROMECAST) #endif // BUILDFLAG(IS_CHROMECAST)
: input_format.sample_rate(); : input_format.sample_rate();
media::ChannelLayout output_channel_layout; media::ChannelLayout output_channel_layout;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "media/base/audio_bus.h" #include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h" #include "media/base/audio_parameters.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
...@@ -241,10 +242,10 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) { ...@@ -241,10 +242,10 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) {
32000, 32000,
44100, 44100,
48000 48000
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
, ,
96000 96000
#endif // defined(IS_CHROMECAST) #endif // BUILDFLAG(IS_CHROMECAST)
}; };
for (size_t i = 0; i < base::size(kSupportedSampleRates); ++i) { for (size_t i = 0; i < base::size(kSupportedSampleRates); ++i) {
int buffer_size = kSupportedSampleRates[i] / 100; int buffer_size = kSupportedSampleRates[i] / 100;
...@@ -255,11 +256,11 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) { ...@@ -255,11 +256,11 @@ TEST_F(MediaStreamAudioProcessorTest, MAYBE_TestAllSampleRates) {
VerifyDefaultComponents(audio_processor.get()); VerifyDefaultComponents(audio_processor.get());
int expected_sample_rate = int expected_sample_rate =
#if defined(IS_CHROMECAST) #if BUILDFLAG(IS_CHROMECAST)
std::min(kSupportedSampleRates[i], blink::kAudioProcessingSampleRate); std::min(kSupportedSampleRates[i], blink::kAudioProcessingSampleRate);
#else #else
blink::kAudioProcessingSampleRate; blink::kAudioProcessingSampleRate;
#endif // defined(IS_CHROMECAST) #endif // BUILDFLAG(IS_CHROMECAST)
ProcessDataAndVerifyFormat(audio_processor.get(), expected_sample_rate, ProcessDataAndVerifyFormat(audio_processor.get(), expected_sample_rate,
kAudioProcessingNumberOfChannel, kAudioProcessingNumberOfChannel,
expected_sample_rate / 100); expected_sample_rate / 100);
......
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