Commit 057808f1 authored by Wez's avatar Wez Committed by Commit Bot

Reland "Enable -Wunreachable-code in Fuchsia builds."

This is a reland of ec7d2855, with fixes
to //chromecast to fix some unreachable code there.

Original change's description:
> Enable -Wunreachable-code in Fuchsia builds.
>
> Depends on https://chromium-review.googlesource.com/c/angle/angle/+/2112281
>
> Bug: 346399
> Change-Id: I6bf27dc15303c207be0ae85dd3256af217db005b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2111833
> Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
> Commit-Queue: Nico Weber <thakis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#752299}

TBR: spang, thakis, kmarshall, sergeyu
Cq-Include-Trybots: luci.chromium.try:fuchsia-arm64-cast;luci.chromium.try:fuchsia-x64-cast
Bug: 346399, 1063669
Change-Id: I87ec7863c1e34e9dbdbde929d9863561c3f5f235
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2113971Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Auto-Submit: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752337}
parent 6dffbb4e
......@@ -1591,7 +1591,8 @@ config("chromium_code") {
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if (!is_nacl && target_os == "linux" && !use_libfuzzer) {
if (!is_nacl && !use_libfuzzer &&
(target_os == "fuchsia" || target_os == "linux")) {
cflags += [ "-Wunreachable-code" ]
}
......
......@@ -232,29 +232,30 @@ class VolumeControlInternal : public SystemVolumeControl::Delegate {
CHECK(stored_values_.GetDouble(ContentTypeToDbFSKey(type), &dbfs));
volumes_[type] = VolumeControl::DbFSToVolume(dbfs);
volume_multipliers_[type] = 1.0f;
if (BUILDFLAG(SYSTEM_OWNS_VOLUME)) {
// If ALSA owns volume, our internal mixer should not apply any scaling
// multiplier.
mixer_->SetVolume(type, 1.0f);
} else {
mixer_->SetVolume(type, DbFsToScale(dbfs));
}
#if BUILDFLAG(SYSTEM_OWNS_VOLUME)
// If ALSA owns volume, our internal mixer should not apply any scaling
// multiplier.
mixer_->SetVolume(type, 1.0f);
#else // BUILDFLAG(SYSTEM_OWNS_VOLUME)
mixer_->SetVolume(type, DbFsToScale(dbfs));
#endif // BUILDFLAG(SYSTEM_OWNS_VOLUME)
// Note that mute state is not persisted across reboots.
muted_[type] = false;
}
if (BUILDFLAG(SYSTEM_OWNS_VOLUME)) {
// If ALSA owns the volume, then read the current volume and mute state
// from the ALSA mixer element(s).
volumes_[AudioContentType::kMedia] = system_volume_control_->GetVolume();
muted_[AudioContentType::kMedia] = system_volume_control_->IsMuted();
} else {
// Otherwise, make sure the ALSA mixer element correctly reflects the
// current volume state.
system_volume_control_->SetVolume(volumes_[AudioContentType::kMedia]);
system_volume_control_->SetMuted(false);
}
#if BUILDFLAG(SYSTEM_OWNS_VOLUME)
// If ALSA owns the volume, then read the current volume and mute state
// from the ALSA mixer element(s).
volumes_[AudioContentType::kMedia] = system_volume_control_->GetVolume();
muted_[AudioContentType::kMedia] = system_volume_control_->IsMuted();
#else // BUILDFLAG(SYSTEM_OWNS_VOLUME)
// Otherwise, make sure the ALSA mixer element correctly reflects the
// current volume state.
system_volume_control_->SetVolume(volumes_[AudioContentType::kMedia]);
system_volume_control_->SetMuted(false);
#endif // BUILDFLAG(SYSTEM_OWNS_VOLUME)
volumes_[AudioContentType::kOther] = 1.0;
muted_[AudioContentType::kOther] = false;
......
......@@ -74,8 +74,9 @@ void WebContentRunner::StartComponent(
this,
std::make_unique<base::fuchsia::StartupContext>(std::move(startup_info)),
std::move(controller_request));
if (BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT) != 0)
component->EnableRemoteDebugging();
#if BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT) != 0
component->EnableRemoteDebugging();
#endif
component->StartComponent();
component->LoadUrl(url, std::vector<fuchsia::net::http::Header>());
RegisterComponent(std::move(component));
......
......@@ -42,10 +42,10 @@ int main(int argc, char** argv) {
base::FilePath(base::fuchsia::kPersistedDataDirectoryPath)));
CHECK(create_context_params.data_directory());
if (BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT) != 0) {
create_context_params.set_remote_debugging_port(
BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT));
}
#if BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT) != 0
create_context_params.set_remote_debugging_port(
BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT));
#endif
WebContentRunner runner(
std::move(create_context_params),
......
......@@ -167,15 +167,16 @@ void ThreadCPUThrottler::ThrottlingThread::Throttle() {
}
void ThreadCPUThrottler::ThrottlingThread::Start() {
#ifdef USE_SIGNALS
#if defined(USE_SIGNALS) || defined(OS_WIN)
#if defined(USE_SIGNALS)
InstallSignalHandler();
#elif !defined(OS_WIN)
LOG(ERROR) << "CPU throttling is not supported.";
return;
#endif
if (!base::PlatformThread::Create(0, this, &throttling_thread_handle_)) {
LOG(ERROR) << "Failed to create throttling thread.";
}
#else
LOG(ERROR) << "CPU throttling is not supported.";
#endif
}
void ThreadCPUThrottler::ThrottlingThread::Sleep(base::TimeDelta duration) {
......
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