Commit 9382efe1 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove deprecated 2-param base::DeleteFile().

Convert the few remaining callers within base/.

Bug: 1009837
Change-Id: I32d4aa4290deb753c2b1c0773a3cbde1cdf71578
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2313376
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791528}
parent b9f5fe33
......@@ -27,16 +27,8 @@
namespace base {
#if !defined(OS_NACL_NONSFI)
namespace {
void DeleteFileHelper(const FilePath& path) {
DeleteFile(path, /*recursive=*/false);
}
} // namespace
OnceCallback<void(const FilePath&)> GetDeleteFileCallback() {
return BindOnce(&DeleteFileHelper);
return BindOnce(IgnoreResult(&DeleteFile));
}
OnceCallback<void(const FilePath&)> GetDeletePathRecursivelyCallback() {
......
......@@ -81,23 +81,6 @@ BASE_EXPORT bool DeleteFile(const FilePath& path);
// WARNING: USING THIS EQUIVALENT TO "rm -rf", SO USE WITH CAUTION.
BASE_EXPORT bool DeletePathRecursively(const FilePath& path);
// DEPRECATED. Please use the functions immediately above.
// https://crbug.com/1009837
//
// Deletes the given path, whether it's a file or a directory.
// If it's a directory, it's perfectly happy to delete all of the
// directory's contents. Passing true to recursively delete
// subdirectories and their contents as well.
// Returns true if successful, false otherwise. It is considered successful
// to attempt to delete a file that does not exist.
//
// In POSIX environment and if |path| is a symbolic link, this deletes only
// the symlink. (even if the symlink points to a non-existent file)
//
// WARNING: USING THIS WITH recursive==true IS EQUIVALENT
// TO "rm -rf", SO USE WITH CAUTION.
BASE_EXPORT bool DeleteFile(const FilePath& path, bool recursive);
// Simplified way to get a callback to do DeleteFile(path) and ignore the
// DeleteFile() result.
BASE_EXPORT OnceCallback<void(const FilePath&)> GetDeleteFileCallback();
......
......@@ -375,10 +375,6 @@ bool DeletePathRecursively(const FilePath& path) {
return DoDeleteFile(path, /*recursive=*/true);
}
bool DeleteFile(const FilePath& path, bool recursive) {
return DoDeleteFile(path, recursive);
}
bool ReplaceFile(const FilePath& from_path,
const FilePath& to_path,
File::Error* error) {
......
......@@ -390,10 +390,6 @@ bool DeletePathRecursively(const FilePath& path) {
return DeleteFileAndRecordMetrics(path, /*recursive=*/true);
}
bool DeleteFile(const FilePath& path, bool recursive) {
return DeleteFileAndRecordMetrics(path, recursive);
}
bool DeleteFileAfterReboot(const FilePath& path) {
ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK);
......
......@@ -77,7 +77,9 @@ bool RestorePermissionInfo(const FilePath& path, void* info, size_t length) {
bool DieFileDie(const FilePath& file, bool recurse) {
// There is no need to workaround Windows problems on POSIX.
// Just pass-through.
return DeleteFile(file, recurse);
if (recurse)
return DeletePathRecursively(file);
return DeleteFile(file);
}
void SyncPageCacheToDisk() {
......
......@@ -98,7 +98,12 @@ bool DieFileDie(const FilePath& file, bool recurse) {
// into short chunks, so that if a try succeeds, we won't delay the test
// for too long.
for (int i = 0; i < kIterations; ++i) {
if (DeleteFile(file, recurse))
bool success;
if (recurse)
success = DeletePathRecursively(file);
else
success = DeleteFile(file);
if (success)
return true;
PlatformThread::Sleep(kTimeout);
}
......
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