| Index: content/browser/storage_partition_impl_map.cc
|
| diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
|
| index 74a212f2d1b9b1581e49fda4df51c578caeec3be..fdfb34e3ebd5ba873d25fecaabf910ad208cc174 100644
|
| --- a/content/browser/storage_partition_impl_map.cc
|
| +++ b/content/browser/storage_partition_impl_map.cc
|
| @@ -266,6 +266,27 @@ void BlockingObliteratePath(
|
| }
|
| }
|
|
|
| +// Ensures each path in |active_paths| is a direct child of storage_root.
|
| +void NormalizeActivePaths(const base::FilePath& storage_root,
|
| + base::hash_set<base::FilePath>* active_paths) {
|
| + base::hash_set<base::FilePath> normalized_active_paths;
|
| +
|
| + for (base::hash_set<base::FilePath>::iterator iter = active_paths->begin();
|
| + iter != active_paths->end(); ++iter) {
|
| + base::FilePath relative_path;
|
| + if (!storage_root.AppendRelativePath(*iter, &relative_path))
|
| + continue;
|
| +
|
| + std::vector<base::FilePath::StringType> components;
|
| + relative_path.GetComponents(&components);
|
| +
|
| + DCHECK(!relative_path.empty());
|
| + normalized_active_paths.insert(storage_root.Append(components.front()));
|
| + }
|
| +
|
| + active_paths->swap(normalized_active_paths);
|
| +}
|
| +
|
| // Deletes all entries inside the |storage_root| that are not in the
|
| // |active_paths|. Deletion is done in 2 steps:
|
| //
|
| @@ -289,6 +310,8 @@ void BlockingGarbageCollect(
|
| scoped_ptr<base::hash_set<base::FilePath> > active_paths) {
|
| CHECK(storage_root.IsAbsolute());
|
|
|
| + NormalizeActivePaths(storage_root, active_paths.get());
|
| +
|
| base::FileEnumerator enumerator(storage_root, false, kAllFileTypes);
|
| base::FilePath trash_directory;
|
| if (!base::CreateTemporaryDirInDir(storage_root, kTrashDirname,
|
|
|