Commit 7b28548a authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Switch to 1-parameter version of base::DeleteFile() in various dirs.

The 1-parameter version is simpler, and the 2-parameter version is
deprecated.

Bug: 1009837
Change-Id: I083906f5cb2f899814511707a639da591a711182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285177Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786068}
parent 7304c31e
...@@ -137,9 +137,9 @@ HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) { ...@@ -137,9 +137,9 @@ HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) {
return HRESULT_FROM_WIN32(exit_code); return HRESULT_FROM_WIN32(exit_code);
} }
} else { } else {
if (!base::DeleteFile(target_path, false)) { if (!base::DeleteFile(target_path)) {
SpoolerServiceCommand("stop"); SpoolerServiceCommand("stop");
bool deleted = base::DeleteFile(target_path, false); bool deleted = base::DeleteFile(target_path);
SpoolerServiceCommand("start"); SpoolerServiceCommand("start");
if (!deleted) { if (!deleted) {
......
...@@ -126,7 +126,7 @@ void DeleteLeakedFiles(const base::FilePath& dir) { ...@@ -126,7 +126,7 @@ void DeleteLeakedFiles(const base::FilePath& dir) {
for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); for (base::FilePath file_path = enumerator.Next(); !file_path.empty();
file_path = enumerator.Next()) { file_path = enumerator.Next()) {
if (enumerator.GetInfo().GetLastModifiedTime() < delete_before) if (enumerator.GetInfo().GetLastModifiedTime() < delete_before)
base::DeleteFile(file_path, false); base::DeleteFile(file_path);
} }
} }
...@@ -556,7 +556,7 @@ BOOL WINAPI Monitor2EndDocPort(HANDLE port_handle) { ...@@ -556,7 +556,7 @@ BOOL WINAPI Monitor2EndDocPort(HANDLE port_handle) {
} }
} }
if (delete_file) if (delete_file)
base::DeleteFile(port_data->file_path, false); base::DeleteFile(port_data->file_path);
} }
if (port_data->printer_handle != NULL) { if (port_data->printer_handle != NULL) {
// Tell the spooler that the job is complete. // Tell the spooler that the job is complete.
......
...@@ -431,7 +431,7 @@ Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, ...@@ -431,7 +431,7 @@ Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name,
base::File::FLAG_WRITE | base::File::FLAG_WRITE |
base::File::FLAG_EXCLUSIVE_WRITE)); base::File::FLAG_EXCLUSIVE_WRITE));
if (result != C_OK) if (result != C_OK)
base::DeleteFile(base::FilePath(new_file_name), false); base::DeleteFile(base::FilePath(new_file_name));
return result; return result;
} }
......
...@@ -242,7 +242,7 @@ BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_file_path, ...@@ -242,7 +242,7 @@ BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_file_path,
base::File::FLAG_WRITE | base::File::FLAG_WRITE |
base::File::FLAG_EXCLUSIVE_WRITE)); base::File::FLAG_EXCLUSIVE_WRITE));
if (result != OK) if (result != OK)
base::DeleteFile(new_file_path, false); base::DeleteFile(new_file_path);
return result; return result;
} }
......
...@@ -127,7 +127,7 @@ TEST_F(BaseRequestsServerTest, DownloadFileRequest_ValidFile) { ...@@ -127,7 +127,7 @@ TEST_F(BaseRequestsServerTest, DownloadFileRequest_ValidFile) {
std::string contents; std::string contents;
base::ReadFileToString(temp_file, &contents); base::ReadFileToString(temp_file, &contents);
base::DeleteFile(temp_file, false); base::DeleteFile(temp_file);
EXPECT_EQ(HTTP_SUCCESS, result_code); EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
......
...@@ -1958,7 +1958,7 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest) { ...@@ -1958,7 +1958,7 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest) {
std::string contents; std::string contents;
base::ReadFileToString(temp_file, &contents); base::ReadFileToString(temp_file, &contents);
base::DeleteFile(temp_file, false); base::DeleteFile(temp_file);
EXPECT_EQ(HTTP_SUCCESS, result_code); EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
...@@ -1992,7 +1992,7 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest_GetContentCallback) { ...@@ -1992,7 +1992,7 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest_GetContentCallback) {
run_loop.Run(); run_loop.Run();
} }
base::DeleteFile(temp_file, false); base::DeleteFile(temp_file);
EXPECT_EQ(HTTP_SUCCESS, result_code); EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
......
...@@ -399,9 +399,9 @@ class HeadlessBrowserRendererCommandPrefixTest : public HeadlessBrowserTest { ...@@ -399,9 +399,9 @@ class HeadlessBrowserRendererCommandPrefixTest : public HeadlessBrowserTest {
void TearDown() override { void TearDown() override {
if (!launcher_script_.empty()) if (!launcher_script_.empty())
base::DeleteFile(launcher_script_, false); base::DeleteFile(launcher_script_);
if (!launcher_stamp_.empty()) if (!launcher_stamp_.empty())
base::DeleteFile(launcher_stamp_, false); base::DeleteFile(launcher_stamp_);
} }
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
...@@ -454,7 +454,7 @@ class CrashReporterTest : public HeadlessBrowserTest, ...@@ -454,7 +454,7 @@ class CrashReporterTest : public HeadlessBrowserTest,
void TearDown() override { void TearDown() override {
base::ThreadRestrictions::SetIOAllowed(true); base::ThreadRestrictions::SetIOAllowed(true);
base::DeleteFile(crash_dumps_dir_, /* recursive */ false); base::DeleteFile(crash_dumps_dir_);
} }
// HeadlessWebContents::Observer implementation: // HeadlessWebContents::Observer implementation:
......
...@@ -92,7 +92,7 @@ TEST_F(PlatformWrapperTest, WrapPlatformHandle) { ...@@ -92,7 +92,7 @@ TEST_F(PlatformWrapperTest, WrapPlatformHandle) {
WriteMessageWithHandles(h, kMessage, &wrapped_handle, 1); WriteMessageWithHandles(h, kMessage, &wrapped_handle, 1);
}); });
base::DeleteFile(temp_file_path, false); base::DeleteFile(temp_file_path);
} }
DEFINE_TEST_CLIENT_TEST_WITH_PIPE(ReadPlatformFile, PlatformWrapperTest, h) { DEFINE_TEST_CLIENT_TEST_WITH_PIPE(ReadPlatformFile, PlatformWrapperTest, h) {
......
...@@ -114,7 +114,7 @@ std::pair<int64_t, int64_t> WriteReadData(int size, ...@@ -114,7 +114,7 @@ std::pair<int64_t, int64_t> WriteReadData(int size,
read_us = (tock - tick).InMicroseconds(); read_us = (tock - tick).InMicroseconds();
} }
CHECK(base::DeleteFile(path, false)); CHECK(base::DeleteFile(path));
return {write_us, read_us}; return {write_us, read_us};
} }
...@@ -169,7 +169,7 @@ void RandomlyReadWrite(std::atomic<bool>* should_stop, ...@@ -169,7 +169,7 @@ void RandomlyReadWrite(std::atomic<bool>* should_stop,
} }
LOG(INFO) << "Noisy neighbor " << i << ": Finishing"; LOG(INFO) << "Noisy neighbor " << i << ": Finishing";
base::DeleteFile(path, false); base::DeleteFile(path);
} }
} // namespace } // namespace
......
...@@ -261,7 +261,7 @@ bool TrafficAnnotationAuditor::RunExtractor( ...@@ -261,7 +261,7 @@ bool TrafficAnnotationAuditor::RunExtractor(
} }
base::SetCurrentDirectory(original_path); base::SetCurrentDirectory(original_path);
base::DeleteFile(options_filepath, false); base::DeleteFile(options_filepath);
return result; return result;
} }
......
...@@ -28,7 +28,7 @@ bool RemoveBrowserPersistenceStorageOnBackgroundThread( ...@@ -28,7 +28,7 @@ bool RemoveBrowserPersistenceStorageOnBackgroundThread(
for (const std::string& id : ids) { for (const std::string& id : ids) {
DCHECK(!id.empty()); DCHECK(!id.empty());
base::FilePath persistence_path = BuildPathForBrowserPersister(path, id); base::FilePath persistence_path = BuildPathForBrowserPersister(path, id);
if (!base::DeleteFile(persistence_path, /* recurse */ false)) if (!base::DeleteFile(persistence_path))
all_succeeded = false; all_succeeded = false;
} }
return all_succeeded; return all_succeeded;
......
...@@ -161,7 +161,7 @@ void NukeProfilesMarkedForDeletion() { ...@@ -161,7 +161,7 @@ void NukeProfilesMarkedForDeletion() {
base::DeletePathRecursively(GetDataPathFromDirName(dir_name)); base::DeletePathRecursively(GetDataPathFromDirName(dir_name));
// Only delete the marker if deletion is successful. // Only delete the marker if deletion is successful.
if (delete_success) { if (delete_success) {
base::DeleteFile(marker_path, /*recursive=*/false); base::DeleteFile(marker_path);
} }
} }
} }
......
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