Rename base::Delete to base::DeleteFile
Also renames DeleteAfterReboot to DeleteFileAfterReboot, and removes FileUtilProxy::RecursiveDelete which was never called.
BUG=
R=shess@chromium.org
Review URL: https://codereview.chromium.org/18584011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211822 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: dd3aa79b68b6752e89a6be0af51506674925337a
diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc
index 7820182..da95909 100644
--- a/base/files/file_path_watcher_browsertest.cc
+++ b/base/files/file_path_watcher_browsertest.cc
@@ -274,7 +274,7 @@
ASSERT_TRUE(SetupWatch(test_file(), &watcher, delegate.get(), false));
// Now make sure we get notified if the file is deleted.
- base::Delete(test_file(), false);
+ base::DeleteFile(test_file(), false);
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
}
@@ -363,7 +363,7 @@
VLOG(1) << "Waiting for file change";
ASSERT_TRUE(WaitForEvents());
- ASSERT_TRUE(base::Delete(file, false));
+ ASSERT_TRUE(base::DeleteFile(file, false));
VLOG(1) << "Waiting for file deletion";
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
@@ -415,7 +415,7 @@
scoped_ptr<TestDelegate> delegate(new TestDelegate(collector()));
ASSERT_TRUE(SetupWatch(file, &watcher, delegate.get(), false));
- ASSERT_TRUE(base::Delete(dir, true));
+ ASSERT_TRUE(base::DeleteFile(dir, true));
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
}
@@ -427,7 +427,7 @@
scoped_ptr<TestDelegate> delegate(new TestDelegate(collector()));
ASSERT_TRUE(SetupWatch(test_file(), &watcher, delegate.get(), false));
- ASSERT_TRUE(base::Delete(test_file(), false));
+ ASSERT_TRUE(base::DeleteFile(test_file(), false));
VLOG(1) << "Waiting for file deletion";
ASSERT_TRUE(WaitForEvents());
@@ -460,7 +460,7 @@
ASSERT_TRUE(WaitForEvents());
#endif // !OS_MACOSX
- ASSERT_TRUE(base::Delete(file1, false));
+ ASSERT_TRUE(base::DeleteFile(file1, false));
VLOG(1) << "Waiting for file1 deletion";
ASSERT_TRUE(WaitForEvents());
@@ -542,11 +542,11 @@
ASSERT_TRUE(WaitForEvents());
// Delete "$dir/subdir/subdir_file1".
- ASSERT_TRUE(base::Delete(subdir_file1, false));
+ ASSERT_TRUE(base::DeleteFile(subdir_file1, false));
ASSERT_TRUE(WaitForEvents());
// Delete "$dir/subdir/subdir_child_dir/child_dir_file1".
- ASSERT_TRUE(base::Delete(child_dir_file1, false));
+ ASSERT_TRUE(base::DeleteFile(child_dir_file1, false));
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
}
@@ -634,7 +634,7 @@
ASSERT_TRUE(SetupWatch(test_link(), &watcher, delegate.get(), false));
// Now make sure we get notified if the link is deleted.
- ASSERT_TRUE(base::Delete(test_link(), false));
+ ASSERT_TRUE(base::DeleteFile(test_link(), false));
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
}
@@ -681,7 +681,7 @@
ASSERT_TRUE(SetupWatch(test_link(), &watcher, delegate.get(), false));
// Now make sure we get notified if the target file is deleted.
- ASSERT_TRUE(base::Delete(test_file(), false));
+ ASSERT_TRUE(base::DeleteFile(test_file(), false));
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
}
@@ -709,7 +709,7 @@
VLOG(1) << "Waiting for file change";
ASSERT_TRUE(WaitForEvents());
- ASSERT_TRUE(base::Delete(file, false));
+ ASSERT_TRUE(base::DeleteFile(file, false));
VLOG(1) << "Waiting for file deletion";
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
@@ -739,7 +739,7 @@
VLOG(1) << "Waiting for file change";
ASSERT_TRUE(WaitForEvents());
- ASSERT_TRUE(base::Delete(file, false));
+ ASSERT_TRUE(base::DeleteFile(file, false));
VLOG(1) << "Waiting for file deletion";
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
@@ -767,7 +767,7 @@
VLOG(1) << "Waiting for file change";
ASSERT_TRUE(WaitForEvents());
- ASSERT_TRUE(base::Delete(file, false));
+ ASSERT_TRUE(base::DeleteFile(file, false));
VLOG(1) << "Waiting for file deletion";
ASSERT_TRUE(WaitForEvents());
DeleteDelegateOnFileThread(delegate.release());
diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc
index fee97fb..2075975 100644
--- a/base/files/file_util_proxy.cc
+++ b/base/files/file_util_proxy.cc
@@ -219,7 +219,7 @@
if (!PathExists(file_path)) {
return PLATFORM_FILE_ERROR_NOT_FOUND;
}
- if (!base::Delete(file_path, recursive)) {
+ if (!base::DeleteFile(file_path, recursive)) {
if (!recursive && !file_util::IsDirectoryEmpty(file_path)) {
return PLATFORM_FILE_ERROR_NOT_EMPTY;
}
@@ -300,26 +300,15 @@
#if !defined(OS_NACL)
// static
-bool FileUtilProxy::Delete(TaskRunner* task_runner,
- const FilePath& file_path,
- bool recursive,
- const StatusCallback& callback) {
+bool FileUtilProxy::DeleteFile(TaskRunner* task_runner,
+ const FilePath& file_path,
+ bool recursive,
+ const StatusCallback& callback) {
return base::PostTaskAndReplyWithResult(
task_runner, FROM_HERE,
Bind(&DeleteAdapter, file_path, recursive),
callback);
}
-
-// static
-bool FileUtilProxy::RecursiveDelete(
- TaskRunner* task_runner,
- const FilePath& file_path,
- const StatusCallback& callback) {
- return base::PostTaskAndReplyWithResult(
- task_runner, FROM_HERE,
- Bind(&DeleteAdapter, file_path, true /* recursive */),
- callback);
-}
#endif // !defined(OS_NACL)
// static
diff --git a/base/files/file_util_proxy.h b/base/files/file_util_proxy.h
index 56d1f77..bded161 100644
--- a/base/files/file_util_proxy.h
+++ b/base/files/file_util_proxy.h
@@ -96,17 +96,10 @@
// Deletes a file or a directory.
// It is an error to delete a non-empty directory with recursive=false.
// This returns false if task posting to |task_runner| has failed.
- static bool Delete(TaskRunner* task_runner,
- const FilePath& file_path,
- bool recursive,
- const StatusCallback& callback);
-
- // Deletes a directory and all of its contents.
- // This returns false if task posting to |task_runner| has failed.
- static bool RecursiveDelete(
- TaskRunner* task_runner,
- const FilePath& file_path,
- const StatusCallback& callback);
+ static bool DeleteFile(TaskRunner* task_runner,
+ const FilePath& file_path,
+ bool recursive,
+ const StatusCallback& callback);
// Reads from a file. On success, the file pointer is moved to position
// |offset + bytes_to_read| in the file. The callback can be null.
diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc
index e8680bb..a454c57 100644
--- a/base/files/file_util_proxy_unittest.cc
+++ b/base/files/file_util_proxy_unittest.cc
@@ -219,7 +219,7 @@
EXPECT_EQ("test", data);
// Make sure we can & do delete the created file to prevent leaks on the bots.
- EXPECT_TRUE(base::Delete(path_, false));
+ EXPECT_TRUE(base::DeleteFile(path_, false));
}
TEST_F(FileUtilProxyTest, GetFileInfo_File) {
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc
index b3564ef..d884985 100644
--- a/base/files/important_file_writer.cc
+++ b/base/files/important_file_writer.cc
@@ -73,20 +73,20 @@
if (!ClosePlatformFile(tmp_file)) {
LogFailure(path, FAILED_CLOSING, "failed to close temporary file");
- base::Delete(tmp_file_path, false);
+ base::DeleteFile(tmp_file_path, false);
return false;
}
if (bytes_written < static_cast<int>(data.length())) {
LogFailure(path, FAILED_WRITING, "error writing, bytes_written=" +
IntToString(bytes_written));
- base::Delete(tmp_file_path, false);
+ base::DeleteFile(tmp_file_path, false);
return false;
}
if (!base::ReplaceFile(tmp_file_path, path, NULL)) {
LogFailure(path, FAILED_RENAMING, "could not rename temporary file");
- base::Delete(tmp_file_path, false);
+ base::DeleteFile(tmp_file_path, false);
return false;
}
diff --git a/base/files/scoped_temp_dir.cc b/base/files/scoped_temp_dir.cc
index 3e90349..497799e 100644
--- a/base/files/scoped_temp_dir.cc
+++ b/base/files/scoped_temp_dir.cc
@@ -63,7 +63,7 @@
if (path_.empty())
return false;
- bool ret = base::Delete(path_, true);
+ bool ret = base::DeleteFile(path_, true);
if (ret) {
// We only clear the path if deleted the directory.
path_.clear();
diff --git a/base/files/scoped_temp_dir_unittest.cc b/base/files/scoped_temp_dir_unittest.cc
index 75afa61..0c9131c 100644
--- a/base/files/scoped_temp_dir_unittest.cc
+++ b/base/files/scoped_temp_dir_unittest.cc
@@ -77,7 +77,7 @@
EXPECT_TRUE(test_path.value().find(base_path.value()) != std::string::npos);
}
EXPECT_FALSE(DirectoryExists(test_path));
- base::Delete(base_path, true);
+ base::DeleteFile(base_path, true);
}
TEST(ScopedTempDir, MultipleInvocations) {