| Index: components/sync/syncable/directory.cc
|
| diff --git a/components/sync/syncable/directory.cc b/components/sync/syncable/directory.cc
|
| index 42fd457bc24b81b35816b68cd3b36cb4f32882b1..d8f708ed8defdb504e69e9f886c3b6bc8e2fa265 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 child folders under
|
| + // |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 all sync directory files.";
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| void Directory::RemoveFromAttachmentIndex(
|
| const ScopedKernelLock& lock,
|
| const int64_t metahandle,
|
|
|