0

Suppress a few -Wunreachable-code warnings on iOS and Android.

While here, also replace an LOG(INFO) with a DLOG(INFO) on Windows
for a LOG(INFO) that had a TODO to switch to DLOG once crbug.com/730068
is fixed (which it now is).

Other than that, no behavior change.

Bug: 730068,346399
Change-Id: Ifa5cef7e27f3fc2f45ac30fe2769eeb6c44b5d5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2113738
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752493}
This commit is contained in:
Nico Weber
2020-03-23 17:47:16 +00:00
committed by Commit Bot
parent f21027ab4d
commit 0442890d7f
17 changed files with 61 additions and 82 deletions

@ -274,9 +274,6 @@ TEST_F(JavaObjectArrayReaderTest, ZeroLengthArray) {
EXPECT_TRUE(zero_length.empty());
EXPECT_EQ(zero_length.size(), 0);
EXPECT_EQ(zero_length.begin(), zero_length.end());
for (auto element : zero_length) {
FAIL() << "Loop body should not execute";
}
}
// Verify that we satisfy the C++ "InputIterator" named requirements.

@ -683,16 +683,13 @@ void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
#if defined(OS_ANDROID)
DownloadUtils::OpenDownload(download, DownloadOpenSource::kUnknown);
return;
#endif
#else
if (!DownloadItemModel(download).ShouldPreferOpeningInBrowser()) {
RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_PLATFORM);
OpenDownloadUsingPlatformHandler(download);
return;
}
#if !defined(OS_ANDROID)
content::WebContents* web_contents =
content::DownloadItemUtils::GetWebContents(download);
Browser* browser =
@ -714,9 +711,6 @@ void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
browser->OpenURL(params);
RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_BROWSER);
#else // OS_ANDROID
// ShouldPreferOpeningInBrowser() should never be true on Android.
NOTREACHED();
#endif // OS_ANDROID
}

@ -40,20 +40,14 @@ void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter) {
}
void ReportBluetoothAvailability() {
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_LINUX)
// This is only relevant for desktop platforms.
return;
#endif
#if defined(OS_MACOSX)
// TODO(kenrb): This is separate from other platforms because we get a
// little bit of extra information from the Mac-specific code. It might not
// be worth having the extra code path, and we should consider whether to
// combine them (https://crbug.com/907279).
ReportAvailability(bluetooth_utility::GetBluetoothAvailability());
return;
#endif // defined(OS_MACOSX)
#elif defined(OS_WIN) || defined(OS_LINUX)
// GetAdapter must be called on the UI thread, because it creates a
// WeakPtr, which is checked from that thread on future calls.
if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
@ -78,6 +72,7 @@ void ReportBluetoothAvailability() {
device::BluetoothAdapterFactory::Get().GetAdapter(
base::BindOnce(&OnGetAdapter));
#endif
}
} // namespace bluetooth_utility

@ -51,14 +51,14 @@ void NetworkQualityEstimatorProviderImpl::PostReplyOnNetworkQualityChanged(
AddEffectiveConnectionTypeObserverNow,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
return;
#endif
#else
bool task_posted = base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&NetworkQualityEstimatorProviderImpl::
AddEffectiveConnectionTypeObserverNow,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
DCHECK(task_posted);
#endif
}
void NetworkQualityEstimatorProviderImpl::AddEffectiveConnectionTypeObserverNow(

@ -451,9 +451,7 @@ void ProfileAttributesStorage::DownloadHighResAvatarIfNeeded(
void ProfileAttributesStorage::DownloadHighResAvatar(
size_t icon_index,
const base::FilePath& profile_path) {
#if defined(OS_ANDROID)
return;
#endif
#if !defined(OS_ANDROID)
const char* file_name =
profiles::GetDefaultAvatarIconFileNameAtIndex(icon_index);
DCHECK(file_name);
@ -472,6 +470,7 @@ void ProfileAttributesStorage::DownloadHighResAvatar(
AsWeakPtr(), profile_path)));
current_downloader->Start();
#endif
}
void ProfileAttributesStorage::SaveAvatarImageAtPath(

@ -15,6 +15,7 @@ namespace {
constexpr char kFieldInfoTableName[] = "field_info";
#if !defined(OS_ANDROID)
// Represents columns of the FieldInfoTable. Used with SQL queries that use all
// the columns.
enum class FieldInfoTableColumn {
@ -57,6 +58,7 @@ std::vector<FieldInfo> StatementToFieldInfo(sql::Statement* s) {
}
return results;
}
#endif
} // namespace
@ -79,12 +81,13 @@ void FieldInfoTable::Init(sql::Database* db) {
bool FieldInfoTable::CreateTableIfNecessary() {
#if defined(OS_ANDROID)
return true;
#endif // defined(OS_ANDROID)
#else
if (db_->DoesTableExist(kFieldInfoTableName))
return true;
SQLTableBuilder builder(kFieldInfoTableName);
InitializeFieldInfoBuilder(&builder);
return builder.CreateTable(db_);
#endif // defined(OS_ANDROID)
}
bool FieldInfoTable::DropTableIfExists() {
@ -96,7 +99,7 @@ bool FieldInfoTable::DropTableIfExists() {
bool FieldInfoTable::AddRow(const FieldInfo& field) {
#if defined(OS_ANDROID)
return false;
#endif // defined(OS_ANDROID)
#else
sql::Statement s(db_->GetCachedStatement(
SQL_FROM_HERE,
"INSERT OR IGNORE INTO field_info "
@ -111,13 +114,14 @@ bool FieldInfoTable::AddRow(const FieldInfo& field) {
s.BindInt64(GetColumnNumber(FieldInfoTableColumn::kCreateTime),
field.create_time.ToDeltaSinceWindowsEpoch().InMicroseconds());
return s.Run();
#endif // defined(OS_ANDROID)
}
bool FieldInfoTable::RemoveRowsByTime(base::Time remove_begin,
base::Time remove_end) {
#if defined(OS_ANDROID)
return false;
#endif // defined(OS_ANDROID)
#else
sql::Statement s(
db_->GetCachedStatement(SQL_FROM_HERE,
"DELETE FROM field_info WHERE "
@ -125,17 +129,19 @@ bool FieldInfoTable::RemoveRowsByTime(base::Time remove_begin,
s.BindInt64(0, remove_begin.ToDeltaSinceWindowsEpoch().InMicroseconds());
s.BindInt64(1, remove_end.ToDeltaSinceWindowsEpoch().InMicroseconds());
return s.Run();
#endif // defined(OS_ANDROID)
}
std::vector<FieldInfo> FieldInfoTable::GetAllRows() {
#if defined(OS_ANDROID)
return std::vector<FieldInfo>();
#endif // defined(OS_ANDROID)
#else
sql::Statement s(db_->GetCachedStatement(
SQL_FROM_HERE,
"SELECT form_signature, field_signature, field_type, create_time FROM "
"field_info"));
return StatementToFieldInfo(&s);
#endif // defined(OS_ANDROID)
}
// Returns all FieldInfo from the database which have |form_signature|.
@ -143,7 +149,7 @@ std::vector<FieldInfo> FieldInfoTable::GetAllRowsForFormSignature(
uint64_t form_signature) {
#if defined(OS_ANDROID)
return std::vector<FieldInfo>();
#endif // defined(OS_ANDROID)
#else
sql::Statement s(
db_->GetCachedStatement(SQL_FROM_HERE,
"SELECT form_signature, field_signature, "
@ -151,6 +157,7 @@ std::vector<FieldInfo> FieldInfoTable::GetAllRowsForFormSignature(
"WHERE form_signature = ?"));
s.BindInt64(0, form_signature);
return StatementToFieldInfo(&s);
#endif // defined(OS_ANDROID)
}
} // namespace password_manager

@ -953,8 +953,7 @@ bool PasswordFormManager::UsePossibleUsername(
// Do not trust local heuristics on Android.
// TODO(https://crbug.com/1051914): Make local heuristics more reliable.
return false;
#endif // defined(OS_ANDROID)
#else
// Check whether it is already learned from previous user actions whether
// |possible_username| corresponds to the valid username form.
const FieldInfoManager* field_info_manager = client_->GetFieldInfoManager();
@ -979,6 +978,7 @@ bool PasswordFormManager::UsePossibleUsername(
LogUsingPossibleUsername(client_, /*is_used*/ is_possible_username_valid,
"Local heuristics");
return is_possible_username_valid;
#endif // defined(OS_ANDROID)
}
} // namespace password_manager

@ -575,8 +575,7 @@ bool PasswordProtectionService::IsSupportedPasswordTypeForModalWarning(
// Android.
#if defined(OS_ANDROID)
return false;
#endif
#else
if (password_type.account_type() ==
ReusedPasswordAccountType::NON_GAIA_ENTERPRISE)
return true;
@ -588,6 +587,7 @@ bool PasswordProtectionService::IsSupportedPasswordTypeForModalWarning(
return password_type.is_account_syncing() ||
base::FeatureList::IsEnabled(
safe_browsing::kPasswordProtectionForSignedInUsers);
#endif
}
#if BUILDFLAG(FULL_SAFE_BROWSING)

@ -64,13 +64,12 @@ GURL GetStartupURL() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kBrowserTest))
return GURL();
const base::CommandLine::StringVector& args = command_line->GetArgs();
#if defined(OS_ANDROID)
// Delay renderer creation on Android until surface is ready.
return GURL();
#endif
#else
const base::CommandLine::StringVector& args = command_line->GetArgs();
if (args.empty())
return GURL("https://www.google.com/");
@ -80,6 +79,7 @@ GURL GetStartupURL() {
return net::FilePathToFileURL(
base::MakeAbsoluteFilePath(base::FilePath(args[0])));
#endif
}
scoped_refptr<base::RefCountedMemory> PlatformResourceProvider(int key) {

@ -12,6 +12,9 @@
#endif
bool IsMultiwindowSupported() {
return BUILDFLAG(IOS_MULTIWINDOW_ENABLED) &&
base::ios::IsRunningOnIOS13OrLater();
#if BUILDFLAG(IOS_MULTIWINDOW_ENABLED)
return base::ios::IsRunningOnIOS13OrLater();
#else
return false;
#endif
}

@ -356,6 +356,10 @@ class VideoCaptureDeviceTest
video_capture_device_factory_->GetDeviceDescriptors(
device_descriptors_.get());
if (device_descriptors_->empty()) {
DLOG(WARNING) << "No camera found";
return nullptr;
}
#if defined(OS_ANDROID)
for (const auto& descriptor : *device_descriptors_) {
// Android deprecated/legacy devices capture on a single thread, which is
@ -370,25 +374,11 @@ class VideoCaptureDeviceTest
}
DLOG(WARNING) << "No usable camera found";
return nullptr;
#endif
if (device_descriptors_->empty()) {
DLOG(WARNING) << "No camera found";
return nullptr;
}
#if defined(OS_WIN)
// Dump the camera model to help debugging.
// TODO(alaoui.rda@gmail.com): remove after http://crbug.com/730068 is
// fixed.
LOG(INFO) << "Using camera "
<< device_descriptors_->front().GetNameAndModel();
#else
DLOG(INFO) << "Using camera "
<< device_descriptors_->front().GetNameAndModel();
const auto& descriptor = device_descriptors_->front();
DLOG(INFO) << "Using camera " << descriptor.GetNameAndModel();
return std::make_unique<VideoCaptureDeviceDescriptor>(descriptor);
#endif
return std::make_unique<VideoCaptureDeviceDescriptor>(
device_descriptors_->front());
}
const VideoCaptureFormat& last_format() const { return last_format_; }

@ -1039,7 +1039,6 @@ TEST_F(RlzLibTest, ConcurrentStoreAccessWithProcessExitsWhileLockHeld) {
EXPECT_TRUE(success);
_exit(success ? 0 : 1);
}
_exit(0);
} else {
// Parent.
pids.push_back(pid);

@ -1915,17 +1915,19 @@ BPF_TEST_C(SandboxBPF, PthreadBitMask, PthreadPolicyBitMask) {
//
// Depending on the architecture, this may modify regs, so the caller is
// responsible for committing these changes using PTRACE_SETREGS.
#if !defined(__arm__) && !defined(__aarch64__) && !defined(__mips__)
long SetSyscall(pid_t pid, regs_struct* regs, int syscall_number) {
#if defined(__arm__)
// On ARM, the syscall is changed using PTRACE_SET_SYSCALL. We cannot use the
// libc ptrace call as the request parameter is an enum, and
// PTRACE_SET_SYSCALL may not be in the enum.
return syscall(__NR_ptrace, PTRACE_SET_SYSCALL, pid, NULL, syscall_number);
#endif
#else
SECCOMP_PT_SYSCALL(*regs) = syscall_number;
return 0;
#endif
}
#endif
const uint16_t kTraceData = 0xcc;
@ -1952,16 +1954,11 @@ SANDBOX_TEST(SandboxBPF, DISABLE_ON_TSAN(SeccompRetTrace)) {
// See https://code.google.com/p/chromium/issues/detail?id=383977
#if defined(__arm__) || defined(__aarch64__)
printf("This test is currently disabled on ARM32/64 due to a kernel bug.");
return;
#endif
#if defined(__mips__)
#elif defined(__mips__)
// TODO: Figure out how to support specificity of handling indirect syscalls
// in this test and enable it.
printf("This test is currently disabled on MIPS.");
return;
#endif
#else
pid_t pid = fork();
BPF_ASSERT_NE(-1, pid);
if (pid == 0) {
@ -2040,6 +2037,7 @@ SANDBOX_TEST(SandboxBPF, DISABLE_ON_TSAN(SeccompRetTrace)) {
BPF_ASSERT_NE(-1, ptrace(PTRACE_CONT, pid, NULL, NULL));
}
#endif
}
// Android does not expose pread64 nor pwrite64.

@ -516,8 +516,7 @@ int ProcessedLocalAudioSource::GetBufferSize(int sample_rate) const {
// TODO(henrika): Re-evaluate whether to use same logic as other platforms.
// https://crbug.com/638081
return (2 * sample_rate / 100);
#endif
#else
// If audio processing is turned on, require 10ms buffers.
if (audio_processor_->has_audio_processing() || audio_processor_proxy_)
return (sample_rate / 100);
@ -535,6 +534,7 @@ int ProcessedLocalAudioSource::GetBufferSize(int sample_rate) const {
// TODO(miu): Identify where/why the buffer size might be missing, fix the
// code, and then require it here. https://crbug.com/638081
return (sample_rate / 100);
#endif
}
} // namespace blink

@ -74,21 +74,19 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
return nullptr;
}
// For WebGL last-uploaded-frame-metadata API.
WebMediaPlayer::VideoFrameUploadMetadata frame_metadata = {};
int already_uploaded_id = HTMLVideoElement::kNoAlreadyUploadedFrame;
auto* frame_metadata_ptr = &frame_metadata;
if (RuntimeEnabledFeatures::ExtraWebGLVideoTextureMetadataEnabled())
already_uploaded_id = texture->GetLastUploadedVideoFrameId();
#if defined(OS_ANDROID)
// TODO(crbug.com/776222): support extension on Android
NOTIMPLEMENTED();
return nullptr;
#else // defined OS_ANDROID
target = GL_TEXTURE_2D;
#else
// For WebGL last-uploaded-frame-metadata API.
WebMediaPlayer::VideoFrameUploadMetadata frame_metadata = {};
auto* frame_metadata_ptr = &frame_metadata;
int already_uploaded_id = HTMLVideoElement::kNoAlreadyUploadedFrame;
if (RuntimeEnabledFeatures::ExtraWebGLVideoTextureMetadataEnabled())
already_uploaded_id = texture->GetLastUploadedVideoFrameId();
#endif // defined OS_ANDROID
target = GL_TEXTURE_2D;
// TODO(shaobo.yan@intel.com) : A fallback path or exception needs to be
// added when video is not using gpu decoder.
@ -120,6 +118,7 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
current_frame_metadata_->setPresentationTimestamp(
frame_metadata_ptr->timestamp.InSecondsF());
return current_frame_metadata_;
#endif // defined OS_ANDROID
}
} // namespace blink

@ -5794,11 +5794,8 @@ TEST_F(RenderTextTest, HarfBuzz_BreakRunsByEmojiVariationSelectors) {
return;
#endif
#if defined(OS_ANDROID)
// TODO(865709): make this work on Android.
return;
#endif
#if !defined(OS_ANDROID)
// Jump over the telephone: two codepoints, but a single glyph.
render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, SELECTION_NONE);
EXPECT_EQ(gfx::Range(3, 3), render_text->selection());
@ -5812,6 +5809,7 @@ TEST_F(RenderTextTest, HarfBuzz_BreakRunsByEmojiVariationSelectors) {
render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, SELECTION_NONE);
EXPECT_EQ(gfx::Range(4, 4), render_text->selection());
EXPECT_EQ(3 * kGlyphWidth, render_text->GetUpdatedCursorBounds().x());
#endif
}
TEST_F(RenderTextTest, HarfBuzz_OrphanedVariationSelector) {

@ -28,12 +28,11 @@ GURL GetStartupURL() {
if (command_line->HasSwitch(switches::kNoInitialNavigation))
return GURL();
const base::CommandLine::StringVector& args = command_line->GetArgs();
#if defined(OS_ANDROID)
// Delay renderer creation on Android until surface is ready.
return GURL();
#endif
#else
const base::CommandLine::StringVector& args = command_line->GetArgs();
if (args.empty())
return GURL("https://www.google.com/");
@ -44,6 +43,7 @@ GURL GetStartupURL() {
return net::FilePathToFileURL(
base::MakeAbsoluteFilePath(base::FilePath(args[0])));
#endif
}
class MainDelegateImpl : public MainDelegate {