Chromium Code Reviews| Index: components/sync/syncable/directory.cc |
| diff --git a/components/sync/syncable/directory.cc b/components/sync/syncable/directory.cc |
| index 42fd457bc24b81b35816b68cd3b36cb4f32882b1..31bf29247656757a7638a032fc5fe0a5d4a79aa0 100644 |
| --- a/components/sync/syncable/directory.cc |
| +++ b/components/sync/syncable/directory.cc |
| @@ -11,7 +11,9 @@ |
| #include <utility> |
| #include "base/base64.h" |
| +#include "base/files/file_enumerator.h" |
| #include "base/guid.h" |
| +#include "base/logging.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/metrics/histogram_macros.h" |
| #include "base/strings/string_number_conversions.h" |
| @@ -432,6 +434,23 @@ bool Directory::ReindexParentId(BaseWriteTransaction* trans, |
| return true; |
| } |
| +// static |
| +void Directory::DeleteDirectoryFiles(const base::FilePath& directory_path) { |
| + // We assume that the directory database files are all top level files, and |
| + // use no folders. We also assume that there might be chuild folders under |
|
maxbogue
2016/12/20 00:54:06
child
skym
2016/12/20 16:12:45
Done.
|
| + // |directory_path| that are used for non-directory things, like storing |
| + // ModelTypeStore/LevelDB data, and we expressly do not want to delete those. |
| + if (base::DirectoryExists(directory_path)) { |
| + base::FileEnumerator fe(directory_path, false, base::FileEnumerator::FILES); |
| + for (base::FilePath current = fe.Next(); !current.empty(); |
| + current = fe.Next()) { |
| + if (!base::DeleteFile(current, false)) { |
| + LOG(DFATAL) << "Could not delete the Sync Data folder."; |
|
maxbogue
2016/12/20 00:54:06
Maybe "Could not delete all sync directory files."
skym
2016/12/20 16:12:45
Done.
|
| + } |
| + } |
| + } |
| +} |
| + |
| void Directory::RemoveFromAttachmentIndex( |
| const ScopedKernelLock& lock, |
| const int64_t metahandle, |