diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 19:10:23 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 19:10:23 +0000 |
commit | dd3aa79b68b6752e89a6be0af51506674925337a (patch) | |
tree | f70f4d0f405009fea8b53ad907d62184b45eaba0 /base | |
parent | 13816d3fcfe2e4e109752cf03fe15ebbaf23e85e (diff) | |
download | chromium_src-dd3aa79b68b6752e89a6be0af51506674925337a.zip chromium_src-dd3aa79b68b6752e89a6be0af51506674925337a.tar.gz chromium_src-dd3aa79b68b6752e89a6be0af51506674925337a.tar.bz2 |
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
Diffstat (limited to 'base')
-rw-r--r-- | base/debug/trace_event_win_unittest.cc | 2 | ||||
-rw-r--r-- | base/file_util.h | 4 | ||||
-rw-r--r-- | base/file_util_posix.cc | 6 | ||||
-rw-r--r-- | base/file_util_unittest.cc | 54 | ||||
-rw-r--r-- | base/file_util_win.cc | 8 | ||||
-rw-r--r-- | base/files/file_path_watcher_browsertest.cc | 24 | ||||
-rw-r--r-- | base/files/file_util_proxy.cc | 21 | ||||
-rw-r--r-- | base/files/file_util_proxy.h | 15 | ||||
-rw-r--r-- | base/files/file_util_proxy_unittest.cc | 2 | ||||
-rw-r--r-- | base/files/important_file_writer.cc | 6 | ||||
-rw-r--r-- | base/files/scoped_temp_dir.cc | 2 | ||||
-rw-r--r-- | base/files/scoped_temp_dir_unittest.cc | 2 | ||||
-rw-r--r-- | base/json/json_value_serializer_unittest.cc | 4 | ||||
-rw-r--r-- | base/memory/shared_memory_posix.cc | 2 | ||||
-rw-r--r-- | base/prefs/json_pref_store_unittest.cc | 2 | ||||
-rw-r--r-- | base/test/test_file_util_posix.cc | 2 | ||||
-rw-r--r-- | base/test/test_file_util_win.cc | 2 | ||||
-rw-r--r-- | base/win/event_trace_consumer_unittest.cc | 4 | ||||
-rw-r--r-- | base/win/event_trace_controller_unittest.cc | 4 |
19 files changed, 74 insertions, 92 deletions
diff --git a/base/debug/trace_event_win_unittest.cc b/base/debug/trace_event_win_unittest.cc index d84fea0..531c5f7 100644 --- a/base/debug/trace_event_win_unittest.cc +++ b/base/debug/trace_event_win_unittest.cc @@ -157,7 +157,7 @@ class TraceEventWinTest: public testing::Test { EXPECT_HRESULT_SUCCEEDED(controller_.Stop(&prop)); if (!log_file_.value().empty()) - base::Delete(log_file_, false); + base::DeleteFile(log_file_, false); // We want our singleton torn down after each test. TraceLog::DeleteForTesting(); diff --git a/base/file_util.h b/base/file_util.h index e6d7ac8..ed2f3ca 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -69,7 +69,7 @@ BASE_EXPORT int64 ComputeDirectorySize(const FilePath& root_path); // // WARNING: USING THIS WITH recursive==true IS EQUIVALENT // TO "rm -rf", SO USE WITH CAUTION. -BASE_EXPORT bool Delete(const FilePath& path, bool recursive); +BASE_EXPORT bool DeleteFile(const FilePath& path, bool recursive); #if defined(OS_WIN) // Schedules to delete the given path, whether it's a file or a directory, until @@ -77,7 +77,7 @@ BASE_EXPORT bool Delete(const FilePath& path, bool recursive); // Note: // 1) The file/directory to be deleted should exist in a temp folder. // 2) The directory to be deleted must be empty. -BASE_EXPORT bool DeleteAfterReboot(const FilePath& path); +BASE_EXPORT bool DeleteFileAfterReboot(const FilePath& path); #endif // Moves the given path, whether it's a file or a directory. diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index c368534..762700a 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -160,7 +160,7 @@ FilePath MakeAbsoluteFilePath(const FilePath& input) { // which works both with and without the recursive flag. I'm not sure we need // that functionality. If not, remove from file_util_win.cc, otherwise add it // here. -bool Delete(const FilePath& path, bool recursive) { +bool DeleteFile(const FilePath& path, bool recursive) { ThreadRestrictions::AssertIOAllowed(); const char* path_str = path.value().c_str(); stat_wrapper_t file_info; @@ -735,7 +735,7 @@ bool DetermineDevShmExecutable() { int fd = CreateAndOpenFdForTemporaryFile(FilePath("/dev/shm"), &path); if (fd >= 0) { ScopedFD shm_fd_closer(&fd); - Delete(path, false); + DeleteFile(path, false); long sysconf_result = sysconf(_SC_PAGESIZE); CHECK_GE(sysconf_result, 0); size_t pagesize = static_cast<size_t>(sysconf_result); @@ -900,7 +900,7 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { if (!CopyDirectory(from_path, to_path, true)) return false; - Delete(from_path, true); + DeleteFile(from_path, true); return true; } diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index e0007d5..e523920 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -738,9 +738,9 @@ TEST_F(FileUtilTest, DeleteNonExistent) { FilePath non_existent = temp_dir_.path().AppendASCII("bogus_file_dne.foobar"); ASSERT_FALSE(base::PathExists(non_existent)); - EXPECT_TRUE(base::Delete(non_existent, false)); + EXPECT_TRUE(base::DeleteFile(non_existent, false)); ASSERT_FALSE(base::PathExists(non_existent)); - EXPECT_TRUE(base::Delete(non_existent, true)); + EXPECT_TRUE(base::DeleteFile(non_existent, true)); ASSERT_FALSE(base::PathExists(non_existent)); } @@ -751,7 +751,7 @@ TEST_F(FileUtilTest, DeleteFile) { ASSERT_TRUE(base::PathExists(file_name)); // Make sure it's deleted - EXPECT_TRUE(base::Delete(file_name, false)); + EXPECT_TRUE(base::DeleteFile(file_name, false)); EXPECT_FALSE(base::PathExists(file_name)); // Test recursive case, create a new file @@ -760,7 +760,7 @@ TEST_F(FileUtilTest, DeleteFile) { ASSERT_TRUE(base::PathExists(file_name)); // Make sure it's deleted - EXPECT_TRUE(base::Delete(file_name, true)); + EXPECT_TRUE(base::DeleteFile(file_name, true)); EXPECT_FALSE(base::PathExists(file_name)); } @@ -777,7 +777,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToExistentFile) { << "Failed to create symlink."; // Delete the symbolic link. - EXPECT_TRUE(base::Delete(file_link, false)); + EXPECT_TRUE(base::DeleteFile(file_link, false)); // Make sure original file is not deleted. EXPECT_FALSE(base::PathExists(file_link)); @@ -799,7 +799,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) { EXPECT_FALSE(base::PathExists(file_link)); // Delete the symbolic link. - EXPECT_TRUE(base::Delete(file_link, false)); + EXPECT_TRUE(base::DeleteFile(file_link, false)); // Make sure the symbolic link is deleted. EXPECT_FALSE(file_util::IsLink(file_link)); @@ -843,7 +843,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) { file_util::ReadFile(file_name, buffer, buffer_size)); // Delete the file. - EXPECT_TRUE(base::Delete(file_name, false)); + EXPECT_TRUE(base::DeleteFile(file_name, false)); EXPECT_FALSE(base::PathExists(file_name)); delete[] buffer; @@ -888,7 +888,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) { EXPECT_TRUE(PathIsWritable(file_name)); // Delete the file. - EXPECT_TRUE(base::Delete(file_name, false)); + EXPECT_TRUE(base::DeleteFile(file_name, false)); EXPECT_FALSE(base::PathExists(file_name)); } @@ -940,7 +940,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { EXPECT_EQ(c2.size(), 1); // Delete the file. - EXPECT_TRUE(base::Delete(subdir_path, true)); + EXPECT_TRUE(base::DeleteFile(subdir_path, true)); EXPECT_FALSE(base::PathExists(subdir_path)); } @@ -965,12 +965,12 @@ TEST_F(FileUtilTest, DeleteWildCard) { directory_contents = directory_contents.Append(FPL("*")); // Delete non-recursively and check that only the file is deleted - EXPECT_TRUE(base::Delete(directory_contents, false)); + EXPECT_TRUE(base::DeleteFile(directory_contents, false)); EXPECT_FALSE(base::PathExists(file_name)); EXPECT_TRUE(base::PathExists(subdir_path)); // Delete recursively and make sure all contents are deleted - EXPECT_TRUE(base::Delete(directory_contents, true)); + EXPECT_TRUE(base::DeleteFile(directory_contents, true)); EXPECT_FALSE(base::PathExists(file_name)); EXPECT_FALSE(base::PathExists(subdir_path)); } @@ -988,11 +988,11 @@ TEST_F(FileUtilTest, DeleteNonExistantWildCard) { directory_contents = directory_contents.Append(FPL("*")); // Delete non-recursively and check nothing got deleted - EXPECT_TRUE(base::Delete(directory_contents, false)); + EXPECT_TRUE(base::DeleteFile(directory_contents, false)); EXPECT_TRUE(base::PathExists(subdir_path)); // Delete recursively and check nothing got deleted - EXPECT_TRUE(base::Delete(directory_contents, true)); + EXPECT_TRUE(base::DeleteFile(directory_contents, true)); EXPECT_TRUE(base::PathExists(subdir_path)); } #endif @@ -1017,11 +1017,11 @@ TEST_F(FileUtilTest, DeleteDirNonRecursive) { ASSERT_TRUE(base::PathExists(subdir_path2)); // Delete non-recursively and check that the empty dir got deleted - EXPECT_TRUE(base::Delete(subdir_path2, false)); + EXPECT_TRUE(base::DeleteFile(subdir_path2, false)); EXPECT_FALSE(base::PathExists(subdir_path2)); // Delete non-recursively and check that nothing got deleted - EXPECT_FALSE(base::Delete(test_subdir, false)); + EXPECT_FALSE(base::DeleteFile(test_subdir, false)); EXPECT_TRUE(base::PathExists(test_subdir)); EXPECT_TRUE(base::PathExists(file_name)); EXPECT_TRUE(base::PathExists(subdir_path1)); @@ -1047,11 +1047,11 @@ TEST_F(FileUtilTest, DeleteDirRecursive) { ASSERT_TRUE(base::PathExists(subdir_path2)); // Delete recursively and check that the empty dir got deleted - EXPECT_TRUE(base::Delete(subdir_path2, true)); + EXPECT_TRUE(base::DeleteFile(subdir_path2, true)); EXPECT_FALSE(base::PathExists(subdir_path2)); // Delete recursively and check that everything got deleted - EXPECT_TRUE(base::Delete(test_subdir, true)); + EXPECT_TRUE(base::DeleteFile(test_subdir, true)); EXPECT_FALSE(base::PathExists(file_name)); EXPECT_FALSE(base::PathExists(subdir_path1)); EXPECT_FALSE(base::PathExists(test_subdir)); @@ -1692,7 +1692,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileTest) { for (int i = 0; i < 3; i++) EXPECT_FALSE(temp_files[i] == temp_files[(i+1)%3]); for (int i = 0; i < 3; i++) - EXPECT_TRUE(base::Delete(temp_files[i], false)); + EXPECT_TRUE(base::DeleteFile(temp_files[i], false)); } TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) { @@ -1715,7 +1715,7 @@ TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) { // Close and delete. for (i = 0; i < 3; ++i) { EXPECT_TRUE(file_util::CloseFile(fps[i])); - EXPECT_TRUE(base::Delete(names[i], false)); + EXPECT_TRUE(base::DeleteFile(names[i], false)); } } @@ -1724,7 +1724,7 @@ TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { ASSERT_TRUE(file_util::CreateNewTempDirectory(FilePath::StringType(), &temp_dir)); EXPECT_TRUE(base::PathExists(temp_dir)); - EXPECT_TRUE(base::Delete(temp_dir, false)); + EXPECT_TRUE(base::DeleteFile(temp_dir, false)); } TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) { @@ -1735,7 +1735,7 @@ TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) { &new_dir)); EXPECT_TRUE(base::PathExists(new_dir)); EXPECT_TRUE(temp_dir_.path().IsParent(new_dir)); - EXPECT_TRUE(base::Delete(new_dir, false)); + EXPECT_TRUE(base::DeleteFile(new_dir, false)); } TEST_F(FileUtilTest, GetShmemTempDirTest) { @@ -1768,7 +1768,7 @@ TEST_F(FileUtilTest, CreateDirectoryTest) { EXPECT_TRUE(base::PathExists(test_path)); EXPECT_FALSE(file_util::CreateDirectory(test_path)); - EXPECT_TRUE(base::Delete(test_root, true)); + EXPECT_TRUE(base::DeleteFile(test_root, true)); EXPECT_FALSE(base::PathExists(test_root)); EXPECT_FALSE(base::PathExists(test_path)); @@ -1813,9 +1813,9 @@ TEST_F(FileUtilTest, DetectDirectoryTest) { CreateTextFile(test_path, L"test file"); EXPECT_TRUE(base::PathExists(test_path)); EXPECT_FALSE(DirectoryExists(test_path)); - EXPECT_TRUE(base::Delete(test_path, false)); + EXPECT_TRUE(base::DeleteFile(test_path, false)); - EXPECT_TRUE(base::Delete(test_root, true)); + EXPECT_TRUE(base::DeleteFile(test_root, true)); } TEST_F(FileUtilTest, FileEnumeratorTest) { @@ -1933,13 +1933,13 @@ TEST_F(FileUtilTest, AppendToFile) { // Create a fresh, empty copy of this directory. if (base::PathExists(data_dir)) { - ASSERT_TRUE(base::Delete(data_dir, true)); + ASSERT_TRUE(base::DeleteFile(data_dir, true)); } ASSERT_TRUE(file_util::CreateDirectory(data_dir)); // Create a fresh, empty copy of this directory. if (base::PathExists(data_dir)) { - ASSERT_TRUE(base::Delete(data_dir, true)); + ASSERT_TRUE(base::DeleteFile(data_dir, true)); } ASSERT_TRUE(file_util::CreateDirectory(data_dir)); FilePath foobar(data_dir.Append(FILE_PATH_LITERAL("foobar.txt"))); @@ -1961,7 +1961,7 @@ TEST_F(FileUtilTest, TouchFile) { // Create a fresh, empty copy of this directory. if (base::PathExists(data_dir)) { - ASSERT_TRUE(base::Delete(data_dir, true)); + ASSERT_TRUE(base::DeleteFile(data_dir, true)); } ASSERT_TRUE(file_util::CreateDirectory(data_dir)); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 95843d9..c29e2e0 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -82,7 +82,7 @@ FilePath MakeAbsoluteFilePath(const FilePath& input) { return FilePath(file_path); } -bool Delete(const FilePath& path, bool recursive) { +bool DeleteFile(const FilePath& path, bool recursive) { ThreadRestrictions::AssertIOAllowed(); if (path.value().length() >= MAX_PATH) @@ -98,7 +98,7 @@ bool Delete(const FilePath& path, bool recursive) { // Otherwise, it's a file, wildcard or non-existant. Try DeleteFile first // because it should be faster. If DeleteFile fails, then we fall through // to SHFileOperation, which will do the right thing. - if (DeleteFile(path.value().c_str()) != 0) + if (::DeleteFile(path.value().c_str()) != 0) return true; } @@ -136,7 +136,7 @@ bool Delete(const FilePath& path, bool recursive) { return (err == 0 || err == ERROR_FILE_NOT_FOUND || err == 0x402); } -bool DeleteAfterReboot(const FilePath& path) { +bool DeleteFileAfterReboot(const FilePath& path) { ThreadRestrictions::AssertIOAllowed(); if (path.value().length() >= MAX_PATH) @@ -744,7 +744,7 @@ bool CopyAndDeleteDirectory(const FilePath& from_path, const FilePath& to_path) { ThreadRestrictions::AssertIOAllowed(); if (CopyDirectory(from_path, to_path, true)) { - if (Delete(from_path, true)) + if (DeleteFile(from_path, true)) return true; // Like Move, this function is not transactional, so we just 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 @@ TEST_F(FilePathWatcherTest, DeletedFile) { 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 @@ TEST_F(FilePathWatcherTest, NonExistentDirectory) { 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 @@ TEST_F(FilePathWatcherTest, DisappearingDirectory) { 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 @@ TEST_F(FilePathWatcherTest, DeleteAndRecreate) { 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 @@ TEST_F(FilePathWatcherTest, WatchDirectory) { 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 @@ TEST_F(FilePathWatcherTest, RecursiveWatch) { 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 @@ TEST_F(FilePathWatcherTest, DeleteLink) { 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 @@ TEST_F(FilePathWatcherTest, DeleteTargetLinkedFile) { 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 @@ TEST_F(FilePathWatcherTest, LinkedDirectoryPart1) { 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 @@ TEST_F(FilePathWatcherTest, LinkedDirectoryPart2) { 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 @@ TEST_F(FilePathWatcherTest, LinkedDirectoryPart3) { 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 @@ PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) { 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 @@ bool FileUtilProxy::GetFileInfoFromPlatformFile( #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 @@ class BASE_EXPORT FileUtilProxy { // 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 @@ TEST_F(FileUtilProxyTest, CreateTemporary) { 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 @@ bool ImportantFileWriter::WriteFileAtomically(const FilePath& path, 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 @@ bool ScopedTempDir::Delete() { 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 @@ TEST(ScopedTempDir, UniqueTempDirUnderPath) { 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) { diff --git a/base/json/json_value_serializer_unittest.cc b/base/json/json_value_serializer_unittest.cc index 519af84..314cd07 100644 --- a/base/json/json_value_serializer_unittest.cc +++ b/base/json/json_value_serializer_unittest.cc @@ -424,7 +424,7 @@ TEST_F(JSONFileValueSerializerTest, Roundtrip) { // Now compare file contents. EXPECT_TRUE(TextContentsEqual(original_file_path, written_file_path)); - EXPECT_TRUE(base::Delete(written_file_path, false)); + EXPECT_TRUE(base::DeleteFile(written_file_path, false)); } TEST_F(JSONFileValueSerializerTest, RoundtripNested) { @@ -451,7 +451,7 @@ TEST_F(JSONFileValueSerializerTest, RoundtripNested) { // Now compare file contents. EXPECT_TRUE(TextContentsEqual(original_file_path, written_file_path)); - EXPECT_TRUE(base::Delete(written_file_path, false)); + EXPECT_TRUE(base::DeleteFile(written_file_path, false)); } TEST_F(JSONFileValueSerializerTest, NoWhitespace) { diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc index 93e0b76..a52e73a 100644 --- a/base/memory/shared_memory_posix.cc +++ b/base/memory/shared_memory_posix.cc @@ -237,7 +237,7 @@ bool SharedMemory::Delete(const std::string& name) { return false; if (PathExists(path)) - return base::Delete(path, false); + return base::DeleteFile(path, false); // Doesn't exist, so success. return true; diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc index dcfea71..34e1b8a 100644 --- a/base/prefs/json_pref_store_unittest.cc +++ b/base/prefs/json_pref_store_unittest.cc @@ -147,7 +147,7 @@ void RunBasicJsonPrefStoreTest(JsonPrefStore* pref_store, pref_store->CommitPendingWrite(); RunLoop().RunUntilIdle(); EXPECT_TRUE(TextContentsEqual(golden_output_file, output_file)); - ASSERT_TRUE(base::Delete(output_file, false)); + ASSERT_TRUE(base::DeleteFile(output_file, false)); } TEST_F(JsonPrefStoreTest, Basic) { diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc index 10701be..3e1b9eb 100644 --- a/base/test/test_file_util_posix.cc +++ b/base/test/test_file_util_posix.cc @@ -77,7 +77,7 @@ bool RestorePermissionInfo(const base::FilePath& path, bool DieFileDie(const base::FilePath& file, bool recurse) { // There is no need to workaround Windows problems on POSIX. // Just pass-through. - return base::Delete(file, recurse); + return base::DeleteFile(file, recurse); } #if !defined(OS_LINUX) && !defined(OS_MACOSX) diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc index 3cfd233..2a5a4d0 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc @@ -126,7 +126,7 @@ bool DieFileDie(const base::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 (base::Delete(file, recurse)) + if (base::DeleteFile(file, recurse)) return true; base::PlatformThread::Sleep(kTimeout); } diff --git a/base/win/event_trace_consumer_unittest.cc b/base/win/event_trace_consumer_unittest.cc index b92bdc0..ce5262e 100644 --- a/base/win/event_trace_consumer_unittest.cc +++ b/base/win/event_trace_consumer_unittest.cc @@ -291,7 +291,7 @@ class EtwTraceConsumerDataTest: public EtwTraceConsumerBaseTest { } virtual void TearDown() { - EXPECT_TRUE(base::Delete(temp_file_, false)); + EXPECT_TRUE(base::DeleteFile(temp_file_, false)); EtwTraceConsumerBaseTest::TearDown(); } @@ -335,7 +335,7 @@ class EtwTraceConsumerDataTest: public EtwTraceConsumerBaseTest { } HRESULT RoundTripEvent(PEVENT_TRACE_HEADER header, PEVENT_TRACE* trace) { - base::Delete(temp_file_, false); + base::DeleteFile(temp_file_, false); HRESULT hr = LogEventToTempSession(header); if (SUCCEEDED(hr)) diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc index 4fe32c3..079a04b 100644 --- a/base/win/event_trace_controller_unittest.cc +++ b/base/win/event_trace_controller_unittest.cc @@ -171,7 +171,7 @@ TEST_F(EtwTraceControllerTest, StartFileSession) { temp.value().c_str()); if (hr == E_ACCESSDENIED) { VLOG(1) << "You must be an administrator to run this test on Vista"; - base::Delete(temp, false); + base::DeleteFile(temp, false); return; } @@ -181,7 +181,7 @@ TEST_F(EtwTraceControllerTest, StartFileSession) { EXPECT_HRESULT_SUCCEEDED(controller.Stop(NULL)); EXPECT_EQ(NULL, controller.session()); EXPECT_STREQ(L"", controller.session_name()); - base::Delete(temp, false); + base::DeleteFile(temp, false); } TEST_F(EtwTraceControllerTest, EnableDisable) { |