platform2: remove macro guards for libchrome r780000 uprev
BUG=chromium:1094927
TEST=CQ
Exempt-From-Owner-Approval: Mechanical change involving a lot of owners.
Change-Id: I8ab6f8fc78b1cb3c57acbf1a40ce2a546117c674
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2478722
Commit-Queue: Qijiang Fan <fqj@google.com>
Tested-by: Qijiang Fan <fqj@google.com>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Miriam Zimmerman <mutexlox@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
diff --git a/arc/vm/vsock_proxy/vsock_proxy_test.cc b/arc/vm/vsock_proxy/vsock_proxy_test.cc
index 746c44a..8e8afc6 100644
--- a/arc/vm/vsock_proxy/vsock_proxy_test.cc
+++ b/arc/vm/vsock_proxy/vsock_proxy_test.cc
@@ -225,14 +225,8 @@
auto server_fd = std::move(server_socket_pair->second);
// Register a read only FD to the client. This will cause a write error.
-#if BASE_VER < 679961
- int fds[2];
- ASSERT_EQ(pipe(fds), 0);
- base::ScopedFD client_fd_read(fds[0]), client_fd_write(fds[1]);
-#else
base::ScopedFD client_fd_read, client_fd_write;
base::CreatePipe(&client_fd_read, &client_fd_write, true);
-#endif
ASSERT_TRUE(client_fd_read.is_valid());
client()->RegisterFileDescriptor(
std::move(client_fd_read), arc_proxy::FileDescriptor::FIFO_READ, handle);
diff --git a/biod/main.cc b/biod/main.cc
index 88e166a..9652579 100644
--- a/biod/main.cc
+++ b/biod/main.cc
@@ -40,11 +40,7 @@
logging::LoggingSettings logging_settings;
logging_settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- logging_settings.log_file = log_file.value().c_str();
-#else
logging_settings.log_file_path = log_file.value().c_str();
-#endif
logging_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
logging::InitLogging(logging_settings);
logging::SetLogItems(true, // process ID
diff --git a/biod/tools/bio_crypto_init.cc b/biod/tools/bio_crypto_init.cc
index db7080a..f6dc4fc 100644
--- a/biod/tools/bio_crypto_init.cc
+++ b/biod/tools/bio_crypto_init.cc
@@ -151,11 +151,7 @@
logging::LoggingSettings logging_settings;
logging_settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- logging_settings.log_file = log_file_path.value().c_str();
-#else
logging_settings.log_file_path = log_file_path.value().c_str();
-#endif
logging_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
logging_settings.delete_old = logging::DELETE_OLD_LOG_FILE;
logging::InitLogging(logging_settings);
diff --git a/biod/tools/bio_fw_updater.cc b/biod/tools/bio_fw_updater.cc
index 04df48b..6dba360 100644
--- a/biod/tools/bio_fw_updater.cc
+++ b/biod/tools/bio_fw_updater.cc
@@ -61,11 +61,7 @@
logging::LoggingSettings logging_settings;
logging_settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- logging_settings.log_file = log_file_path.value().c_str();
-#else
logging_settings.log_file_path = log_file_path.value().c_str();
-#endif
logging_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
logging::InitLogging(logging_settings);
logging::SetLogItems(true, // process ID
diff --git a/camera/hal/ip/camera_device.h b/camera/hal/ip/camera_device.h
index 8074c55..94240bb 100644
--- a/camera/hal/ip/camera_device.h
+++ b/camera/hal/ip/camera_device.h
@@ -75,11 +75,7 @@
int width_;
int height_;
RequestQueue request_queue_;
-#if BASE_VER < 780000
- scoped_refptr<base::TaskRunner> ipc_task_runner_;
-#else
scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
-#endif
mojo::Binding<IpCameraFrameListener> binding_;
CameraBufferManager* buffer_manager_;
android::CameraMetadata static_metadata_;
diff --git a/chromeos-config/cros_config_main.cc b/chromeos-config/cros_config_main.cc
index 780c55a..cf39d4c 100644
--- a/chromeos-config/cros_config_main.cc
+++ b/chromeos-config/cros_config_main.cc
@@ -41,11 +41,7 @@
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- settings.log_file = "/var/log/cros_config.log";
-#else
settings.log_file_path = "/var/log/cros_config.log";
-#endif
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
logging::InitLogging(settings);
diff --git a/chromeos-config/libcros_config/cros_config_test.cc b/chromeos-config/libcros_config/cros_config_test.cc
index 2d16de1..a359ba5 100644
--- a/chromeos-config/libcros_config/cros_config_test.cc
+++ b/chromeos-config/libcros_config/cros_config_test.cc
@@ -177,11 +177,7 @@
int main(int argc, char** argv) {
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- settings.log_file = "log.test";
-#else
settings.log_file_path = "log.test";
-#endif
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
settings.delete_old = logging::DELETE_OLD_LOG_FILE;
logging::InitLogging(settings);
diff --git a/chromeos-config/libcros_config/fake_cros_config_test.cc b/chromeos-config/libcros_config/fake_cros_config_test.cc
index 37f7509..75a210e 100644
--- a/chromeos-config/libcros_config/fake_cros_config_test.cc
+++ b/chromeos-config/libcros_config/fake_cros_config_test.cc
@@ -28,11 +28,7 @@
int main(int argc, char** argv) {
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- settings.log_file = "log.test";
-#else
settings.log_file_path = "log.test";
-#endif
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
logging::InitLogging(settings);
diff --git a/crash-reporter/chrome_collector_test.cc b/crash-reporter/chrome_collector_test.cc
index 1997a85..5f0497c 100644
--- a/crash-reporter/chrome_collector_test.cc
+++ b/crash-reporter/chrome_collector_test.cc
@@ -384,12 +384,7 @@
FilePath log_file;
{
base::ScopedFILE output(
-#if BASE_VER < 780000
- base::CreateAndOpenTemporaryFileInDir
-#else
- base::CreateAndOpenTemporaryStreamInDir
-#endif
- (dir, &log_file));
+ base::CreateAndOpenTemporaryStreamInDir(dir, &log_file));
ASSERT_TRUE(output.get());
base::AutoReset<FILE*> auto_reset_file_ptr(&collector_.output_file_ptr_,
output.get());
@@ -442,12 +437,7 @@
FilePath log_file;
{
base::ScopedFILE output(
-#if BASE_VER < 780000
- base::CreateAndOpenTemporaryFileInDir
-#else
- base::CreateAndOpenTemporaryStreamInDir
-#endif
- (dir, &log_file));
+ base::CreateAndOpenTemporaryStreamInDir(dir, &log_file));
ASSERT_TRUE(output.get());
base::AutoReset<FILE*> auto_reset_file_ptr(&collector_.output_file_ptr_,
output.get());
@@ -502,12 +492,7 @@
FilePath log_file;
{
base::ScopedFILE output(
-#if BASE_VER < 780000
- base::CreateAndOpenTemporaryFileInDir
-#else
- base::CreateAndOpenTemporaryStreamInDir
-#endif
- (dir, &log_file));
+ base::CreateAndOpenTemporaryStreamInDir(dir, &log_file));
ASSERT_TRUE(output.get());
base::AutoReset<FILE*> auto_reset_file_ptr(&collector_.output_file_ptr_,
output.get());
diff --git a/crash-reporter/crash_collector.cc b/crash-reporter/crash_collector.cc
index 8fb380b..da83c35 100644
--- a/crash-reporter/crash_collector.cc
+++ b/crash-reporter/crash_collector.cc
@@ -242,11 +242,7 @@
FileEnumerator::FILES | FileEnumerator::DIRECTORIES |
FileEnumerator::SHOW_SYM_LINKS);
for (FilePath name = files.Next(); !name.empty(); name = files.Next()) {
-#if BASE_VER < 780000
- const struct stat st = files.GetInfo().stat();
-#else
const base::stat_wrapper_t st = files.GetInfo().stat();
-#endif
const FilePath subdir_path = name.DirName();
const FilePath file = name.BaseName();
diff --git a/crash-reporter/crash_sender_util.cc b/crash-reporter/crash_sender_util.cc
index f5eb366..5b606b7 100644
--- a/crash-reporter/crash_sender_util.cc
+++ b/crash-reporter/crash_sender_util.cc
@@ -297,12 +297,7 @@
base::FilePath temp_file_path;
base::ScopedFILE temp_file(
-#if BASE_VER < 780000
- base::CreateAndOpenTemporaryFileInDir
-#else
- base::CreateAndOpenTemporaryStreamInDir
-#endif
- (timestamps_dir, &temp_file_path));
+ base::CreateAndOpenTemporaryStreamInDir(timestamps_dir, &temp_file_path));
if (temp_file == nullptr) {
PLOG(ERROR) << "Failed to create a file in " << timestamps_dir.value();
} else {
diff --git a/cryptohome/dircrypto_data_migrator/migration_helper.cc b/cryptohome/dircrypto_data_migrator/migration_helper.cc
index a2281b6..30331fb 100644
--- a/cryptohome/dircrypto_data_migrator/migration_helper.cc
+++ b/cryptohome/dircrypto_data_migrator/migration_helper.cc
@@ -200,11 +200,7 @@
job_threads_[i] = std::make_unique<base::Thread>(
"MigrationHelper worker #" + base::NumberToString(i));
base::Thread::Options options;
-#if BASE_VER < 780000
- options.message_loop_type = base::MessagePumpType::IO;
-#else
options.message_pump_type = base::MessagePumpType::IO;
-#endif
if (!job_threads_[i]->StartWithOptions(options)) {
LOG(ERROR) << "Failed to start a job thread.";
return false;
@@ -431,11 +427,7 @@
}
}
ReportStatus(user_data_auth::DIRCRYPTO_MIGRATION_IN_PROGRESS);
-#if BASE_VER < 780000
- struct stat from_stat;
-#else
base::stat_wrapper_t from_stat;
-#endif
if (!platform_->Stat(from_base_path_, &from_stat)) {
PLOG(ERROR) << "Failed to stat from directory";
RecordFileErrorWithCurrentErrno(kMigrationFailedAtStat, base::FilePath());
diff --git a/cryptohome/dircrypto_data_migrator/migration_helper_unittest.cc b/cryptohome/dircrypto_data_migrator/migration_helper_unittest.cc
index 7ae3613..2ec1903 100644
--- a/cryptohome/dircrypto_data_migrator/migration_helper_unittest.cc
+++ b/cryptohome/dircrypto_data_migrator/migration_helper_unittest.cc
@@ -202,21 +202,13 @@
int ext2_attrs = FS_SYNC_FL | FS_NODUMP_FL;
ASSERT_EQ(0, ::ioctl(from_fd.get(), FS_IOC_SETFLAGS, &ext2_attrs));
-#if BASE_VER < 780000
- struct stat from_stat;
-#else
base::stat_wrapper_t from_stat;
-#endif
ASSERT_TRUE(platform.Stat(kFromDirPath, &from_stat));
EXPECT_TRUE(helper.Migrate(base::Bind(&MigrationHelperTest::ProgressCaptor,
base::Unretained(this))));
const FilePath kToDirPath = to_dir_.GetPath().Append(kDirectory);
-#if BASE_VER < 780000
- struct stat to_stat;
-#else
base::stat_wrapper_t to_stat;
-#endif
ASSERT_TRUE(platform.Stat(kToDirPath, &to_stat));
EXPECT_TRUE(platform.DirectoryExists(kToDirPath));
@@ -265,11 +257,7 @@
EXPECT_TRUE(helper.Migrate(base::Bind(&MigrationHelperTest::ProgressCaptor,
base::Unretained(this))));
-#if BASE_VER < 780000
- struct stat to_stat;
-#else
base::stat_wrapper_t to_stat;
-#endif
// Verify that stored timestamps for in-progress migrations are respected
ASSERT_TRUE(platform.Stat(to_dir_.GetPath(), &to_stat));
@@ -312,11 +300,7 @@
kFromAbsLinkPath));
ASSERT_TRUE(base::CreateSymbolicLink(kTargetInMigrationDirAbsLinkTarget,
kFromTargetInMigrationDirAbsLinkPath));
-#if BASE_VER < 780000
- struct stat from_stat;
-#else
base::stat_wrapper_t from_stat;
-#endif
ASSERT_TRUE(platform.Stat(kFromRelLinkPath, &from_stat));
EXPECT_TRUE(helper.Migrate(base::Bind(&MigrationHelperTest::ProgressCaptor,
@@ -331,11 +315,7 @@
to_dir_.GetPath().Append(kFileName);
// Verify that timestamps were updated appropriately.
-#if BASE_VER < 780000
- struct stat to_stat;
-#else
base::stat_wrapper_t to_stat;
-#endif
ASSERT_TRUE(platform.Stat(kToRelLinkPath, &to_stat));
EXPECT_EQ(from_stat.st_atim.tv_sec, to_stat.st_atim.tv_sec);
EXPECT_EQ(from_stat.st_atim.tv_nsec, to_stat.st_atim.tv_nsec);
@@ -478,20 +458,12 @@
int ext2_attrs = FS_SYNC_FL | FS_NODUMP_FL;
EXPECT_EQ(0, ::ioctl(from_fd.get(), FS_IOC_SETFLAGS, &ext2_attrs));
-#if BASE_VER < 780000
- struct stat from_stat;
-#else
base::stat_wrapper_t from_stat;
-#endif
ASSERT_TRUE(platform.Stat(kFromFilePath, &from_stat));
EXPECT_TRUE(helper.Migrate(base::Bind(&MigrationHelperTest::ProgressCaptor,
base::Unretained(this))));
-#if BASE_VER < 780000
- struct stat to_stat;
-#else
base::stat_wrapper_t to_stat;
-#endif
ASSERT_TRUE(platform.Stat(kToFilePath, &to_stat));
EXPECT_EQ(from_stat.st_atim.tv_sec, to_stat.st_atim.tv_sec);
EXPECT_EQ(from_stat.st_atim.tv_nsec, to_stat.st_atim.tv_nsec);
@@ -571,11 +543,7 @@
ASSERT_TRUE(base::CreateSymbolicLink(kLinkTarget, kToLink));
ASSERT_TRUE(real_platform.CreateDirectory(kToDir));
-#if BASE_VER < 780000
- struct stat stat;
-#else
base::stat_wrapper_t stat;
-#endif
ASSERT_TRUE(real_platform.Stat(kFromFile, &stat));
stat.st_uid = file_uid;
stat.st_gid = file_gid;
@@ -965,11 +933,7 @@
v1_path.AppendASCII("tmp/foobar/tmp.gdoc")));
// Mock the situation that user/GCache/v1/tmp is enumerated twice.
-#if BASE_VER < 780000
- struct stat stat_data = {};
-#else
base::stat_wrapper_t stat_data = {};
-#endif
stat_data.st_mode = S_IFDIR;
const FileEnumerator::FileInfo info(v1_path.AppendASCII("tmp"), stat_data);
NiceMock<MockFileEnumerator>* mock_v1 = new NiceMock<MockFileEnumerator>();
diff --git a/cryptohome/disk_cleanup_routines_unittest.cc b/cryptohome/disk_cleanup_routines_unittest.cc
index aa398df..7b744fd 100644
--- a/cryptohome/disk_cleanup_routines_unittest.cc
+++ b/cryptohome/disk_cleanup_routines_unittest.cc
@@ -48,11 +48,7 @@
const std::vector<base::FilePath>& children) {
auto* mock = new NiceMock<cryptohome::MockFileEnumerator>;
for (const auto& child : children) {
-#if BASE_VER < 780000
- struct stat stat = {};
-#else
base::stat_wrapper_t stat = {};
-#endif
mock->entries_.push_back(cryptohome::FileEnumerator::FileInfo(child, stat));
}
return mock;
@@ -305,11 +301,7 @@
auto* enumerator = new NiceMock<cryptohome::MockFileEnumerator>;
ASSERT_EQ(entriesToClean.size(), 2);
-#if BASE_VER < 780000
- struct stat stat = {};
-#else
base::stat_wrapper_t stat = {};
-#endif
stat.st_ino = 1;
enumerator->entries_.push_back(
diff --git a/cryptohome/homedirs_unittest.cc b/cryptohome/homedirs_unittest.cc
index 352c768..5cf9641 100644
--- a/cryptohome/homedirs_unittest.cc
+++ b/cryptohome/homedirs_unittest.cc
@@ -154,11 +154,7 @@
const std::vector<FilePath>& child_directories) {
auto* mock = new NiceMock<MockFileEnumerator>;
for (const auto& child : child_directories) {
-#if BASE_VER < 780000
- struct stat stat = {};
-#else
base::stat_wrapper_t stat = {};
-#endif
mock->entries_.push_back(FileEnumerator::FileInfo(child, stat));
}
return mock;
@@ -185,11 +181,7 @@
auto create_file_enumerator_function = [child_directories]() {
auto* mock = new NiceMock<MockFileEnumerator>;
for (const auto& child : child_directories) {
-#if BASE_VER < 780000
- struct stat stat = {};
-#else
base::stat_wrapper_t stat = {};
-#endif
mock->entries_.push_back(FileEnumerator::FileInfo(child, stat));
}
return mock;
diff --git a/cryptohome/make_tests.cc b/cryptohome/make_tests.cc
index 662e576..e0c2374 100644
--- a/cryptohome/make_tests.cc
+++ b/cryptohome/make_tests.cc
@@ -293,11 +293,7 @@
gid_t daemon_gid,
bool is_ecryptfs) {
scoped_refptr<Mount> temp_mount = new Mount();
-#if BASE_VER < 780000
- struct stat root_dir;
-#else
base::stat_wrapper_t root_dir;
-#endif
memset(&root_dir, 0, sizeof(root_dir));
root_dir.st_mode = S_IFDIR | S_ISVTX;
EXPECT_CALL(*platform,
@@ -306,11 +302,7 @@
_))
.WillRepeatedly(DoAll(SetArgPointee<1>(root_dir), Return(true)));
// Avoid triggering vault migration. (Is there another test for that?)
-#if BASE_VER < 780000
- struct stat root_vault_dir;
-#else
base::stat_wrapper_t root_vault_dir;
-#endif
memset(&root_vault_dir, 0, sizeof(root_vault_dir));
root_vault_dir.st_mode = S_IFDIR | S_ISVTX;
root_vault_dir.st_uid = 0;
@@ -318,11 +310,7 @@
EXPECT_CALL(*platform,
Stat(is_ecryptfs ? root_vault_path : root_vault_mount_path, _))
.WillRepeatedly(DoAll(SetArgPointee<1>(root_vault_dir), Return(true)));
-#if BASE_VER < 780000
- struct stat user_dir;
-#else
base::stat_wrapper_t user_dir;
-#endif
memset(&user_dir, 0, sizeof(user_dir));
user_dir.st_mode = S_IFDIR;
user_dir.st_uid = chronos_uid;
@@ -338,11 +326,7 @@
_))
.WillRepeatedly(DoAll(SetArgPointee<1>(user_dir), Return(true)));
}
-#if BASE_VER < 780000
- struct stat chronos_dir;
-#else
base::stat_wrapper_t chronos_dir;
-#endif
memset(&chronos_dir, 0, sizeof(chronos_dir));
chronos_dir.st_mode = S_IFDIR;
chronos_dir.st_uid = chronos_uid;
diff --git a/cryptohome/mock_platform.h b/cryptohome/mock_platform.h
index 54bd086..2a33e88 100644
--- a/cryptohome/mock_platform.h
+++ b/cryptohome/mock_platform.h
@@ -35,11 +35,7 @@
void AddFileEntry(base::FilePath path) {
// Add a placeholder struct stat.
-#if BASE_VER < 780000
- struct stat s;
-#else
base::stat_wrapper_t s;
-#endif
entries_.emplace_back(FileInfo(path, s));
}
@@ -211,14 +207,10 @@
(FILE*),
(override)); // NOLINT(readability/function)
MOCK_METHOD(FILE*, CreateAndOpenTemporaryFile, (base::FilePath*), (override));
-#if BASE_VER < 780000
- MOCK_METHOD(bool, Stat, (const base::FilePath&, struct stat*), (override));
-#else
MOCK_METHOD(bool,
Stat,
(const base::FilePath&, base::stat_wrapper_t*),
(override));
-#endif
MOCK_METHOD(bool,
HasExtendedFileAttribute,
(const base::FilePath&, const std::string&),
diff --git a/cryptohome/mount_helper.cc b/cryptohome/mount_helper.cc
index 6c72597..5e06757 100644
--- a/cryptohome/mount_helper.cc
+++ b/cryptohome/mount_helper.cc
@@ -136,11 +136,7 @@
for (size_t i = 1; i < num; i++)
check_path = check_path.Append(path_parts[i]);
-#if BASE_VER < 780000
- struct stat st;
-#else
base::stat_wrapper_t st;
-#endif
if (!platform_->Stat(check_path, &st)) {
// Dirent not there, so create and set ownership.
if (!platform_->CreateDirectory(check_path)) {
@@ -221,11 +217,7 @@
std::vector<FilePath> ent_list;
FilePath user_path(VaultPathToUserPath(vault_path));
FilePath root_path(VaultPathToRootPath(vault_path));
-#if BASE_VER < 780000
- struct stat st;
-#else
base::stat_wrapper_t st;
-#endif
// This check makes the migration idempotent; if we completed a migration,
// root_path will exist and we're done, and if we didn't complete it, we can
@@ -572,11 +564,7 @@
// same as for |etc_daemon_store_path| (usually
// <daemon_user>:<daemon_group>), which is what the daemon intended.
// Otherwise, it would end up being root-owned.
-#if BASE_VER < 780000
- struct stat etc_daemon_path_stat =
-#else
base::stat_wrapper_t etc_daemon_path_stat =
-#endif
file_enumerator->GetInfo().stat();
if (!platform_->SetOwnership(mount_source, etc_daemon_path_stat.st_uid,
etc_daemon_path_stat.st_gid,
diff --git a/cryptohome/mount_unittest.cc b/cryptohome/mount_unittest.cc
index b86cec7..7a479cc 100644
--- a/cryptohome/mount_unittest.cc
+++ b/cryptohome/mount_unittest.cc
@@ -506,11 +506,7 @@
constexpr char kDaemonName[] = "mock-daemon";
constexpr uid_t kDaemonUid = 123;
constexpr gid_t kDaemonGid = 234;
-#if BASE_VER < 780000
- struct stat stat_data = {};
-#else
base::stat_wrapper_t stat_data = {};
-#endif
stat_data.st_mode = S_IFDIR;
stat_data.st_uid = kDaemonUid;
stat_data.st_gid = kDaemonGid;
@@ -752,17 +748,9 @@
std::vector<FilePath> existing_files_in_download;
std::vector<FilePath> existing_files_in_myfiles_download;
auto* in_myfiles_download_enumerator = new NiceMock<MockFileEnumerator>();
-#if BASE_VER < 780000
- struct stat stat_file = {};
-#else
base::stat_wrapper_t stat_file = {};
-#endif
stat_file.st_mode = S_IRWXU;
-#if BASE_VER < 780000
- struct stat stat_dir = {};
-#else
base::stat_wrapper_t stat_dir = {};
-#endif
stat_dir.st_mode = S_IFDIR;
for (auto base : existing_files) {
@@ -806,17 +794,9 @@
std::vector<FilePath> existing_files_in_download;
std::vector<FilePath> existing_files_in_myfiles_download;
auto* in_myfiles_download_enumerator = new NiceMock<MockFileEnumerator>();
-#if BASE_VER < 780000
- struct stat stat_file = {};
-#else
base::stat_wrapper_t stat_file = {};
-#endif
stat_file.st_mode = S_IRWXU;
-#if BASE_VER < 780000
- struct stat stat_dir = {};
-#else
base::stat_wrapper_t stat_dir = {};
-#endif
stat_dir.st_mode = S_IFDIR;
for (auto base : existing_files) {
@@ -912,17 +892,10 @@
const uid_t kChapsUID;
const gid_t kSharedGID;
-#if BASE_VER < 780000
- struct stat base_stat_;
- struct stat salt_stat_;
- struct stat database_dir_stat_;
- struct stat database_file_stat_;
-#else
base::stat_wrapper_t base_stat_;
base::stat_wrapper_t salt_stat_;
base::stat_wrapper_t database_dir_stat_;
base::stat_wrapper_t database_file_stat_;
-#endif
scoped_refptr<Mount> mount_;
NiceMock<MockPlatform> platform_;
@@ -930,21 +903,12 @@
std::unique_ptr<UserOldestActivityTimestampCache> user_timestamp_cache_;
private:
-#if BASE_VER < 780000
- void InitStat(struct stat* s, mode_t mode, uid_t uid, gid_t gid) {
- memset(s, 0, sizeof(struct stat));
- s->st_mode = mode;
- s->st_uid = uid;
- s->st_gid = gid;
- }
-#else
void InitStat(base::stat_wrapper_t* s, mode_t mode, uid_t uid, gid_t gid) {
memset(s, 0, sizeof(base::stat_wrapper_t));
s->st_mode = mode;
s->st_uid = uid;
s->st_gid = gid;
}
-#endif
DISALLOW_COPY_AND_ASSIGN(ChapsDirectoryTest);
};
@@ -1056,11 +1020,7 @@
.WillRepeatedly(Return(true));
// Configure stat for the base directory.
-#if BASE_VER < 780000
- struct stat base_stat = {0};
-#else
base::stat_wrapper_t base_stat = {0};
-#endif
base_stat.st_mode = 040123;
base_stat.st_uid = 1;
base_stat.st_gid = 2;
@@ -1069,19 +1029,11 @@
// Configure a fake enumerator.
MockFileEnumerator* enumerator = platform_.mock_enumerator();
-#if BASE_VER < 780000
- struct stat file_info1 = {0};
-#else
base::stat_wrapper_t file_info1 = {0};
-#endif
file_info1.st_mode = 0555;
file_info1.st_uid = 3;
file_info1.st_gid = 4;
-#if BASE_VER < 780000
- struct stat file_info2 = {0};
-#else
base::stat_wrapper_t file_info2 = {0};
-#endif
file_info2.st_mode = 0777;
file_info2.st_uid = 5;
file_info2.st_gid = 6;
@@ -3438,11 +3390,7 @@
}
TEST_P(EphemeralNoUserSystemTest, MountGuestUserDir) {
-#if BASE_VER < 780000
- struct stat fake_root_st;
-#else
base::stat_wrapper_t fake_root_st;
-#endif
fake_root_st.st_uid = 0;
fake_root_st.st_gid = 0;
fake_root_st.st_mode = S_IFDIR | S_IRWXU;
@@ -3459,11 +3407,7 @@
EXPECT_CALL(platform_,
Stat(Property(&FilePath::value, StartsWith("/home/user/")), _))
.WillOnce(Return(false));
-#if BASE_VER < 780000
- struct stat fake_user_st;
-#else
base::stat_wrapper_t fake_user_st;
-#endif
fake_user_st.st_uid = chronos_uid_;
fake_user_st.st_gid = chronos_gid_;
fake_user_st.st_mode = S_IFDIR | S_IRWXU;
@@ -3562,11 +3506,7 @@
}
TEST_P(EphemeralNoUserSystemTest, MountGuestUserFailSetUserType) {
-#if BASE_VER < 780000
- struct stat fake_root_st;
-#else
base::stat_wrapper_t fake_root_st;
-#endif
fake_root_st.st_uid = 0;
fake_root_st.st_gid = 0;
fake_root_st.st_mode = S_IFDIR | S_IRWXU;
@@ -3582,11 +3522,7 @@
EXPECT_CALL(platform_,
Stat(Property(&FilePath::value, StartsWith("/home/user/")), _))
.WillOnce(Return(false));
-#if BASE_VER < 780000
- struct stat fake_user_st;
-#else
base::stat_wrapper_t fake_user_st;
-#endif
fake_user_st.st_uid = chronos_uid_;
fake_user_st.st_gid = chronos_gid_;
fake_user_st.st_mode = S_IFDIR | S_IRWXU;
diff --git a/cryptohome/platform.cc b/cryptohome/platform.cc
index e9c56f9..d925740 100644
--- a/cryptohome/platform.cc
+++ b/cryptohome/platform.cc
@@ -100,11 +100,7 @@
FilePath dir_;
};
-#if BASE_VER < 780000
-bool IsDirectory(const struct stat& file_info) {
-#else
bool IsDirectory(const base::stat_wrapper_t& file_info) {
-#endif
return !!S_ISDIR(file_info.st_mode);
}
@@ -592,11 +588,7 @@
}
bool Platform::DirectoryExists(const FilePath& path) {
-#if BASE_VER < 780000
- struct stat buf = {};
-#else
base::stat_wrapper_t buf = {};
-#endif
return Stat(path, &buf) && S_ISDIR(buf.st_mode);
}
@@ -609,11 +601,7 @@
}
FILE* Platform::CreateAndOpenTemporaryFile(FilePath* path) {
-#if BASE_VER < 780000
- return base::CreateAndOpenTemporaryFile(path);
-#else
return base::CreateAndOpenTemporaryStream(path).release();
-#endif
}
FILE* Platform::OpenFile(const FilePath& path, const char* mode) {
@@ -786,15 +774,9 @@
return base::Time::Now();
}
-#if BASE_VER < 780000
-bool Platform::Stat(const FilePath& path, struct stat* buf) {
- return lstat(path.value().c_str(), buf) == 0;
-}
-#else
bool Platform::Stat(const FilePath& path, base::stat_wrapper_t* buf) {
return base::File::Lstat(path.value().c_str(), buf) == 0;
}
-#endif
bool Platform::HasExtendedFileAttribute(const FilePath& path,
const std::string& name) {
@@ -935,11 +917,7 @@
bool Platform::CopyPermissionsCallback(const FilePath& old_base,
const FilePath& new_base,
const FilePath& file_path,
-#if BASE_VER < 780000
- const struct stat& file_info
-#else
const base::stat_wrapper_t& file_info
-#endif
) {
// Find the new path that corresponds with the old path given by file_info.
FilePath old_path = file_path;
@@ -996,11 +974,7 @@
const Permissions& default_dir_info,
const std::map<FilePath, Permissions>& special_cases,
const FilePath& file_path,
-#if BASE_VER < 780000
- const struct stat& file_info
-#else
const base::stat_wrapper_t& file_info
-#endif
) {
Permissions expected;
std::map<FilePath, Permissions>::const_iterator it =
@@ -1465,11 +1439,7 @@
bool Platform::WalkPath(const FilePath& path,
const FileEnumeratorCallback& callback) {
-#if BASE_VER < 780000
- struct stat base_entry_info;
-#else
base::stat_wrapper_t base_entry_info;
-#endif
if (!Stat(path, &base_entry_info)) {
PLOG(ERROR) << "Failed to stat " << path.value();
return false;
@@ -1590,11 +1560,7 @@
}
FileEnumerator::FileInfo::FileInfo(const FilePath& name,
-#if BASE_VER < 780000
- const struct stat& stat
-#else
const base::stat_wrapper_t& stat
-#endif
)
: name_(name), stat_(stat) {
}
@@ -1651,11 +1617,7 @@
return base::Time::FromTimeT(stat_.st_mtime);
}
-#if BASE_VER < 780000
-const struct stat& FileEnumerator::FileInfo::stat() const {
-#else
const base::stat_wrapper_t& FileEnumerator::FileInfo::stat() const {
-#endif
if (info_.get())
return info_->stat();
return stat_;
diff --git a/cryptohome/platform.h b/cryptohome/platform.h
index 7d7cd36..ecad9ba 100644
--- a/cryptohome/platform.h
+++ b/cryptohome/platform.h
@@ -84,11 +84,7 @@
class FileInfo {
public:
explicit FileInfo(const base::FileEnumerator::FileInfo& file_info);
-#if BASE_VER < 780000
- FileInfo(const base::FilePath& name, const struct stat& stat);
-#else
FileInfo(const base::FilePath& name, const base::stat_wrapper_t& stat);
-#endif
FileInfo(const FileInfo& other);
FileInfo();
virtual ~FileInfo();
@@ -98,22 +94,14 @@
base::FilePath GetName() const;
int64_t GetSize() const;
base::Time GetLastModifiedTime() const;
-#if BASE_VER < 780000
- const struct stat& stat() const;
-#else
const base::stat_wrapper_t& stat() const;
-#endif
private:
void Assign(const base::FileEnumerator::FileInfo& file_info);
std::unique_ptr<base::FileEnumerator::FileInfo> info_;
base::FilePath name_;
-#if BASE_VER < 780000
- struct stat stat_;
-#else
base::stat_wrapper_t stat_;
-#endif
};
FileEnumerator(const base::FilePath& root_path,
@@ -151,12 +139,8 @@
base::FilePath device;
};
-#if BASE_VER < 780000
- typedef base::Callback<bool(const base::FilePath&, const struct stat&)>
-#else
typedef base::Callback<bool(const base::FilePath&,
const base::stat_wrapper_t&)>
-#endif
FileEnumeratorCallback;
Platform();
@@ -556,11 +540,7 @@
// Parameters
// path - element to look up
// buf - buffer to store results into
-#if BASE_VER < 780000
- virtual bool Stat(const base::FilePath& path, struct stat* buf);
-#else
virtual bool Stat(const base::FilePath& path, base::stat_wrapper_t* buf);
-#endif
// Return true if |path| has extended attribute |name|.
//
@@ -936,12 +916,7 @@
bool CopyPermissionsCallback(const base::FilePath& old_base,
const base::FilePath& new_base,
const base::FilePath& file_path,
-#if BASE_VER < 780000
- const struct stat& file_info
-#else
- const base::stat_wrapper_t& file_info
-#endif
- );
+ const base::stat_wrapper_t& file_info);
// Applies ownership and permissions to a single file or directory.
//
@@ -955,12 +930,7 @@
const Permissions& default_dir_info,
const std::map<base::FilePath, Permissions>& special_cases,
const base::FilePath& file_path,
-#if BASE_VER < 780000
- const struct stat& file_info
-#else
- const base::stat_wrapper_t& file_info
-#endif
- );
+ const base::stat_wrapper_t& file_info);
void PostWorkerTask(const base::Closure& task);
diff --git a/cryptohome/platform_unittest.cc b/cryptohome/platform_unittest.cc
index 210fdcc..ec42554 100644
--- a/cryptohome/platform_unittest.cc
+++ b/cryptohome/platform_unittest.cc
@@ -354,11 +354,7 @@
mount_info_contents.append("/home/user/uid1 rw,nodev,relatime - ext4 ");
mount_info_contents.append("/dev/mmcblk0p1 rw,commit=600,data=ordered");
-#if BASE_VER < 780000
- fp = base::CreateAndOpenTemporaryFile(&mount_info);
-#else
fp = base::CreateAndOpenTemporaryStream(&mount_info).release();
-#endif
ASSERT_TRUE(fp != NULL);
EXPECT_EQ(
fwrite(mount_info_contents.c_str(), mount_info_contents.length(), 1, fp),
@@ -392,11 +388,7 @@
mount_info_contents.append("rw,nosuid,nodev,noexec,relatime - ecryptfs ");
mount_info_contents.append("/beg/uid2/vault rw,ecryp...");
-#if BASE_VER < 780000
- fp = base::CreateAndOpenTemporaryFile(&mount_info);
-#else
fp = base::CreateAndOpenTemporaryStream(&mount_info).release();
-#endif
ASSERT_TRUE(fp != NULL);
EXPECT_EQ(
fwrite(mount_info_contents.c_str(), mount_info_contents.length(), 1, fp),
@@ -456,11 +448,7 @@
ASSERT_TRUE(platform_.CreateSymbolicLink(link, regular_file));
EXPECT_TRUE(platform_.SetFileTimes(regular_file, atime1, mtime1, true));
-#if BASE_VER < 780000
- struct stat stat;
-#else
base::stat_wrapper_t stat;
-#endif
ASSERT_TRUE(platform_.Stat(regular_file, &stat));
EXPECT_EQ(atime1.tv_sec, stat.st_atim.tv_sec);
EXPECT_EQ(atime1.tv_nsec, stat.st_atim.tv_nsec);
@@ -513,11 +501,7 @@
base::File sparse_file(sparse_name,
base::File::FLAG_OPEN | base::File::FLAG_READ);
EXPECT_EQ(file_size, sparse_file.GetLength());
-#if BASE_VER < 780000
- struct stat stat;
-#else
base::stat_wrapper_t stat;
-#endif
EXPECT_TRUE(platform_.Stat(sparse_name, &stat));
// No blocks allocated for a sparse file.
EXPECT_EQ(0, stat.st_blocks);
diff --git a/cryptohome/proxy/dbus_proxy_service.cc b/cryptohome/proxy/dbus_proxy_service.cc
index 9ddbf12..8363214 100644
--- a/cryptohome/proxy/dbus_proxy_service.cc
+++ b/cryptohome/proxy/dbus_proxy_service.cc
@@ -41,11 +41,7 @@
// Start the dbus thread. Note that this will need to be an I/O thread
// because ListenForServiceOwnerChange() needs it.
base::Thread::Options options;
-#if BASE_VER < 780000
- options.message_loop_type = base::MessagePumpType::IO;
-#else
options.message_pump_type = base::MessagePumpType::IO;
-#endif
dbus_thread_.StartWithOptions(options);
dbus_thread_.task_runner()->PostTask(
diff --git a/cryptohome/service.cc b/cryptohome/service.cc
index 1815a8d..f54b737 100644
--- a/cryptohome/service.cc
+++ b/cryptohome/service.cc
@@ -246,12 +246,8 @@
parallel_task_count_ += 1;
}
-void MountThreadObserver::WillProcessTask(const base::PendingTask& pending_task
-#if BASE_VER > 780000
- ,
- bool was_blocked_or_low_priority
-#endif
-) {
+void MountThreadObserver::WillProcessTask(const base::PendingTask& pending_task,
+ bool was_blocked_or_low_priority) {
// Task name will be equal to the task handler name
std::string task_name = pending_task.posted_from.function_name();
@@ -691,11 +687,7 @@
}
base::Thread::Options options;
-#if BASE_VER < 780000
- options.message_loop_type = base::MessagePumpType::IO;
-#else
options.message_pump_type = base::MessagePumpType::IO;
-#endif
mount_thread_.StartWithOptions(options);
// Add task observer, message_loop is only available after the thread start.
diff --git a/cryptohome/service.h b/cryptohome/service.h
index d88a2ba..d987b22 100644
--- a/cryptohome/service.h
+++ b/cryptohome/service.h
@@ -68,12 +68,8 @@
void PostTask();
// This method is called before processing a task.
-#if BASE_VER > 780000
void WillProcessTask(const base::PendingTask& pending_task,
bool was_blocked_or_low_priority) override;
-#else
- void WillProcessTask(const base::PendingTask& pending_task) override;
-#endif
// This method is called after processing a task.
void DidProcessTask(const base::PendingTask& pending_task) override;
diff --git a/cryptohome/stateful_recovery_unittest.cc b/cryptohome/stateful_recovery_unittest.cc
index b5d43ac..4171cfe 100644
--- a/cryptohome/stateful_recovery_unittest.cc
+++ b/cryptohome/stateful_recovery_unittest.cc
@@ -450,11 +450,7 @@
mount_info_contents.append(device_in);
mount_info_contents.append(" rw,ecryp...");
-#if BASE_VER < 780000
- fp = base::CreateAndOpenTemporaryFile(&mount_info);
-#else
fp = base::CreateAndOpenTemporaryStream(&mount_info).release();
-#endif
ASSERT_TRUE(fp != NULL);
EXPECT_EQ(
fwrite(mount_info_contents.c_str(), mount_info_contents.length(), 1, fp),
diff --git a/cryptohome/userdataauth.cc b/cryptohome/userdataauth.cc
index 34b9343..c55a795 100644
--- a/cryptohome/userdataauth.cc
+++ b/cryptohome/userdataauth.cc
@@ -266,11 +266,7 @@
if (!disable_threading_) {
base::Thread::Options options;
-#if BASE_VER < 780000
- options.message_loop_type = base::MessagePumpType::IO;
-#else
options.message_pump_type = base::MessagePumpType::IO;
-#endif
mount_thread_.StartWithOptions(options);
}
diff --git a/debugd/src/process_with_output.cc b/debugd/src/process_with_output.cc
index 0eb55fd..b0748fb 100644
--- a/debugd/src/process_with_output.cc
+++ b/debugd/src/process_with_output.cc
@@ -49,20 +49,12 @@
return false;
}
-#if BASE_VER < 780000
- outfile_.reset(base::CreateAndOpenTemporaryFile(&outfile_path_));
-#else
outfile_ = base::CreateAndOpenTemporaryStream(&outfile_path_);
-#endif
if (!outfile_.get()) {
return false;
}
if (separate_stderr_) {
-#if BASE_VER < 780000
- errfile_.reset(base::CreateAndOpenTemporaryFile(&errfile_path_));
-#else
errfile_ = base::CreateAndOpenTemporaryStream(&errfile_path_);
-#endif
if (!errfile_.get()) {
return false;
}
diff --git a/diagnostics/cros_healthd/process/process_with_output.cc b/diagnostics/cros_healthd/process/process_with_output.cc
index 25aaeb7..50908d0 100644
--- a/diagnostics/cros_healthd/process/process_with_output.cc
+++ b/diagnostics/cros_healthd/process/process_with_output.cc
@@ -46,20 +46,12 @@
return false;
}
-#if BASE_VER < 780000
- outfile_.reset(base::CreateAndOpenTemporaryFile(&outfile_path_));
-#else
outfile_ = base::CreateAndOpenTemporaryStream(&outfile_path_);
-#endif
if (!outfile_.get()) {
return false;
}
if (separate_stderr_) {
-#if BASE_VER < 780000
- errfile_.reset(base::CreateAndOpenTemporaryFile(&errfile_path_));
-#else
errfile_ = base::CreateAndOpenTemporaryStream(&errfile_path_);
-#endif
if (!errfile_.get()) {
return false;
}
diff --git a/feedback/components/feedback/feedback_report.cc b/feedback/components/feedback/feedback_report.cc
index ab8d9c9..72a620a 100644
--- a/feedback/components/feedback/feedback_report.cc
+++ b/feedback/components/feedback/feedback_report.cc
@@ -59,11 +59,7 @@
void FeedbackReport::DeleteReportOnDisk() {
reports_task_runner_->PostTask(
FROM_HERE,
-#if BASE_VER < 780000
- base::Bind(base::IgnoreResult(&base::DeleteFile), file_, false)
-#else
base::BindOnce(base::GetDeleteFileCallback(), file_)
-#endif
); // NOLINT(whitespace/parens)
}
diff --git a/image-burner/image_burner_main.cc b/image-burner/image_burner_main.cc
index 8b609c4..5290219 100644
--- a/image-burner/image_burner_main.cc
+++ b/image-burner/image_burner_main.cc
@@ -14,11 +14,7 @@
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_ALL;
-#if BASE_VER < 780000
- settings.log_file = "/var/log/image_burner.log";
-#else
settings.log_file_path = "/var/log/image_burner.log";
-#endif
settings.lock_log = logging::LOCK_LOG_FILE;
settings.delete_old = logging::DELETE_OLD_LOG_FILE;
logging::InitLogging(settings);
diff --git a/init/clobber_state_main.cc b/init/clobber_state_main.cc
index 26ea032..514de93 100644
--- a/init/clobber_state_main.cc
+++ b/init/clobber_state_main.cc
@@ -41,11 +41,7 @@
int main(int argc, char* argv[]) {
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- settings.log_file = "/tmp/clobber-state.log";
-#else
settings.log_file_path = "/tmp/clobber-state.log";
-#endif
// All logging happens in the main thread, so there is no need to lock the log
// file.
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
diff --git a/login_manager/keygen.cc b/login_manager/keygen.cc
index a8a335d..b977ac8 100644
--- a/login_manager/keygen.cc
+++ b/login_manager/keygen.cc
@@ -36,11 +36,7 @@
log_file.assign(switches::kDefaultLogFile);
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_ALL;
-#if BASE_VER < 780000
- settings.log_file = log_file.c_str();
-#else
settings.log_file_path = log_file.c_str();
-#endif
settings.lock_log = logging::DONT_LOCK_LOG_FILE;
settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE;
logging::InitLogging(settings);
diff --git a/modemfwd/modem_helper.cc b/modemfwd/modem_helper.cc
index 388e2b8..c56002c 100644
--- a/modemfwd/modem_helper.cc
+++ b/modemfwd/modem_helper.cc
@@ -72,12 +72,8 @@
base::File output_base_file;
if (output) {
base::FilePath output_path;
-#if BASE_VER < 780000
- FILE* output_file = base::CreateAndOpenTemporaryFile(&output_path);
-#else
FILE* output_file =
base::CreateAndOpenTemporaryStream(&output_path).release();
-#endif
if (output_file == nullptr) {
LOG(ERROR) << "Failed to create tempfile for helper process output";
return false;
diff --git a/patchpanel/network_monitor_service_test.cc b/patchpanel/network_monitor_service_test.cc
index bc53c6b..2081ca9 100644
--- a/patchpanel/network_monitor_service_test.cc
+++ b/patchpanel/network_monitor_service_test.cc
@@ -185,13 +185,8 @@
// The internal implementation of Timer uses Now() so we need
// MOCK_TIME_AND_NOW here.
base::test::TaskEnvironment task_env_{
-#if BASE_VER < 780000
- base::test::TaskEnvironment::TimeSource::MOCK_TIME_AND_NOW
- };
-#else
base::test::TaskEnvironment::TimeSource::MOCK_TIME
};
-#endif
FakeNeighborConnectedStateChangedHandler fake_neighbor_event_handler_;
NeighborLinkMonitor::ConnectedStateChangedHandler callback_;
std::unique_ptr<shill::MockRTNLHandler> mock_rtnl_handler_;
diff --git a/power_manager/powerd/main.cc b/power_manager/powerd/main.cc
index a58ff02..273f872 100644
--- a/power_manager/powerd/main.cc
+++ b/power_manager/powerd/main.cc
@@ -329,11 +329,7 @@
logging::LoggingSettings logging_settings;
logging_settings.logging_dest = logging::LOG_TO_FILE;
-#if BASE_VER < 780000
- logging_settings.log_file = log_file.value().c_str();
-#else
logging_settings.log_file_path = log_file.value().c_str();
-#endif
logging_settings.lock_log = logging::DONT_LOCK_LOG_FILE;
logging::InitLogging(logging_settings);
LOG(INFO) << "vcsid " << VCSID;
diff --git a/vm_tools/cicerone/service_testing_helper.cc b/vm_tools/cicerone/service_testing_helper.cc
index 42a4267..88d0ef0 100644
--- a/vm_tools/cicerone/service_testing_helper.cc
+++ b/vm_tools/cicerone/service_testing_helper.cc
@@ -555,11 +555,7 @@
SetDbusCallbackNames();
base::Thread::Options dbus_thread_options;
-#if BASE_VER < 780000
- dbus_thread_options.message_loop_type = base::MessagePumpType::IO;
-#else
dbus_thread_options.message_pump_type = base::MessagePumpType::IO;
-#endif
CHECK(dbus_thread_.StartWithOptions(dbus_thread_options));
dbus::Bus::Options opts;