Skip to content

Commit a9ee4a6

Browse files
leizleizCommit Bot
authored and
Commit Bot
committed
Switch to 1-parameter version of base::DeleteFile() in chrome/chrome_cleaner/.
The 1-parameter version is simpler, and the 2-parameter version is deprecated. Bug: 1009837 Change-Id: Iee024c6196b4f32fcbb82fbba568977931792660 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2284358 Reviewed-by: Joe Mason <joenotcharles@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#785997}
1 parent c241eac commit a9ee4a6

12 files changed

+17
-17
lines changed

chrome/chrome_cleaner/engines/target/libraries_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class ScopedChildProcessWithTempDir {
9090

9191
void DeleteSampleDll(const base::string16& sample_dll,
9292
const base::FilePath& directory) {
93-
CHECK(base::DeleteFile(directory.Append(sample_dll), /*recursive=*/false));
93+
CHECK(base::DeleteFile(directory.Append(sample_dll)));
9494
}
9595

9696
void ReplaceSampleDll(const base::string16& sample_dll,

chrome/chrome_cleaner/ipc/sandbox_unittest.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class SandboxTest : public base::MultiProcessTest {
9393
// exist.
9494
sandbox_process_log_file_path_ =
9595
ScopedLogging::GetLogFilePath(kSandboxLogFileSuffix);
96-
EXPECT_TRUE(base::DeleteFile(sandbox_process_log_file_path_, false));
96+
EXPECT_TRUE(base::DeleteFile(sandbox_process_log_file_path_));
9797
}
9898

9999
void TearDown() override {
@@ -148,7 +148,7 @@ MULTIPROCESS_TEST_MAIN(MockSandboxProcessMain) {
148148
base::FilePath temp_file;
149149
if (base::CreateTemporaryFileInDir(product_path, &temp_file)) {
150150
have_write_access = true;
151-
base::DeleteFile(temp_file, /*recursive=*/false);
151+
base::DeleteFile(temp_file);
152152
}
153153

154154
#if BUILDFLAG(IS_OFFICIAL_CHROME_CLEANER_BUILD)

chrome/chrome_cleaner/logging/cleaner_logging_service_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ TEST_P(CleanerLoggingServiceTest, CompleteFailure) {
667667
// Now forget about the scheduled logs upload retry.
668668
registry_logger_->GetNextLogFilePath(&log_file);
669669
ASSERT_FALSE(log_file.empty());
670-
bool success = base::DeleteFile(log_file, false);
670+
bool success = base::DeleteFile(log_file);
671671
EXPECT_TRUE(success) << "Failed to delete " << log_file.value();
672672
bool more_log_files = registry_logger_->RemoveLogFilePath(log_file);
673673
EXPECT_FALSE(more_log_files);

chrome/chrome_cleaner/logging/pending_logs_service.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void PendingLogsService::ClearPendingLogFile(
119119
LOG(ERROR) << "Failed to delete logs upload retry task.";
120120
}
121121

122-
if (!base::DeleteFile(log_file, false))
122+
if (!base::DeleteFile(log_file))
123123
LOG(ERROR) << "Failed to delete '" << SanitizePath(log_file) << "'.";
124124
}
125125

chrome/chrome_cleaner/logging/pending_logs_service_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ TEST_F(PendingLogsServiceTest, SuccessfulRegistration) {
172172

173173
// Cleanup.
174174
EXPECT_FALSE(registry_logger_->RemoveLogFilePath(log_file));
175-
EXPECT_TRUE(base::DeleteFile(log_file, false));
175+
EXPECT_TRUE(base::DeleteFile(log_file));
176176
}
177177

178178
TEST_F(PendingLogsServiceTest, FailToRegisterScheduledTask) {

chrome/chrome_cleaner/os/disk_util.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ void TruncateLogFileToTail(const base::FilePath& path,
937937

938938
if (bytes_read != tail_size_bytes) {
939939
// Something went wrong, clean the file.
940-
base::DeleteFile(path, /*recursive=*/false);
940+
base::DeleteFile(path);
941941
return;
942942
}
943943

chrome/chrome_cleaner/os/file_remover.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void DeleteEmptyDirectories(base::FilePath directory) {
4949
// folders list for the corresponding UwS, because they are not necessarily
5050
// matched by any rule by the scanner.
5151
LOG(INFO) << "Deleting empty directory " << SanitizePath(directory);
52-
if (!base::DeleteFile(directory, /*recursive=*/false))
52+
if (!base::DeleteFile(directory))
5353
break;
5454
directory = directory.DirName();
5555
}
@@ -194,7 +194,7 @@ void FileRemover::RemoveFile(const base::FilePath& path,
194194
return;
195195
}
196196

197-
if (!base::DeleteFile(path, /*recursive=*/false)) {
197+
if (!base::DeleteFile(path)) {
198198
// If the attempt to delete the file fails, propagate the failure as
199199
// normal so that the engine knows about it and can try a backup action,
200200
// but also register the file for post-reboot removal in case the engine

chrome/chrome_cleaner/test/cleaner_test.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ class CleanerTest
282282
if (locked_file_.IsValid())
283283
locked_file_.Close();
284284
// Remove any leftover UwS.
285-
base::DeleteFile(scan_only_test_uws_, /*recursive=*/false);
286-
base::DeleteFile(removable_test_uws_, /*recursive=*/false);
285+
base::DeleteFile(scan_only_test_uws_);
286+
base::DeleteFile(removable_test_uws_);
287287
}
288288

289289
void InitializeRemovableUwSArchivePath() {
@@ -486,7 +486,7 @@ TEST_P(CleanerTest, NoPotentialFalsePositivesOnCleanMachine) {
486486
chrome_cleaner::ExecutionMode::kCleanup)));
487487

488488
// Delete the scan only uws to make the machine clean.
489-
base::DeleteFile(scan_only_test_uws_, /*recursive=*/false);
489+
base::DeleteFile(scan_only_test_uws_);
490490

491491
ExpectExitCode(command_line, chrome_cleaner::RESULT_CODE_NO_PUPS_FOUND);
492492
}

chrome/chrome_cleaner/test/generate_test_uws_test.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ TEST(GenerateTestUwsTest, WriteTestUwS) {
2626

2727
base::FilePath uws_file_a =
2828
startup_dir.Append(chrome_cleaner::kTestUwsAFilename);
29-
ASSERT_TRUE(base::DeleteFile(uws_file_a, /*recursive=*/false));
29+
ASSERT_TRUE(base::DeleteFile(uws_file_a));
3030

3131
base::FilePath uws_file_b =
3232
startup_dir.Append(chrome_cleaner::kTestUwsBFilename);
33-
ASSERT_TRUE(base::DeleteFile(uws_file_b, /*recursive=*/false));
33+
ASSERT_TRUE(base::DeleteFile(uws_file_b));
3434

3535
// Delete the output files on exit, including on early exit.
3636
base::ScopedClosureRunner delete_uws_file_a(

chrome/chrome_cleaner/test/scoped_file.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ScopedFile::ScopedFile(const base::FilePath& file_path)
2727

2828
ScopedFile::~ScopedFile() {
2929
if (base::PathExists(file_path_))
30-
PCHECK(base::DeleteFile(file_path_, false /*recursive*/));
30+
PCHECK(base::DeleteFile(file_path_));
3131
}
3232

3333
const base::FilePath& ScopedFile::file_path() {

chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void OnArchiveDone(const base::FilePath& zip_file_path,
8080
if (result_code != ZipArchiverResultCode::kSuccess) {
8181
// The zip file handle has been closed by mojo. Delete the incomplete zip
8282
// file directly.
83-
if (!base::DeleteFile(zip_file_path, /*recursive=*/false))
83+
if (!base::DeleteFile(zip_file_path))
8484
LOG(ERROR) << "Failed to delete the incomplete zip file.";
8585
}
8686
// Call |result_callback| for SandboxedZipArchiver::Archive.

chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver_unittest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ TEST_F(ZipArchiverSandboxedArchiverTest, Archive) {
202202
}
203203

204204
TEST_F(ZipArchiverSandboxedArchiverTest, SourceFileNotFound) {
205-
ASSERT_TRUE(base::DeleteFile(test_file_.GetSourceFilePath(), false));
205+
ASSERT_TRUE(base::DeleteFile(test_file_.GetSourceFilePath()));
206206

207207
EXPECT_EQ(ZipArchiverResultCode::kErrorCannotOpenSourceFile,
208208
Archive(test_file_.GetSourceFilePath()));

0 commit comments

Comments
 (0)