Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: components/drive/file_cache.cc

Issue 1815053003: Revert of Reland: Create hard links in file migration if necessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/drive/file_cache.h ('k') | components/drive/file_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/drive/file_cache.cc
diff --git a/components/drive/file_cache.cc b/components/drive/file_cache.cc
index c9ceb105f7133c5eac0ad7f6863756be339c0ebe..73d28d41064dc77d66a82bd227994b750e96d1b0 100644
--- a/components/drive/file_cache.cc
+++ b/components/drive/file_cache.cc
@@ -3,8 +3,6 @@
// found in the LICENSE file.
#include "components/drive/file_cache.h"
-
-#include <unistd.h>
#include <queue>
#include <vector>
@@ -683,8 +681,7 @@
// static
bool FileCache::MigrateCacheFiles(const base::FilePath& from,
- const base::FilePath& to_files,
- const base::FilePath& to_links,
+ const base::FilePath& to,
ResourceMetadataStorage* metadata_storage) {
scoped_ptr<ResourceMetadataStorage::Iterator> it =
metadata_storage->GetIterator();
@@ -694,31 +691,17 @@
continue;
}
- // Ignore missing cache file case since it never succeeds.
- // TODO(yawano): handle this case at metadata validation in FileCache.
const base::FilePath move_from = GetPathForId(from, entry.local_id());
if (!base::PathExists(move_from)) {
continue;
}
- // Create hard link to cache file if it's pinned or dirty. cryptohome will
- // not delete a cache file if there is a hard link to it.
- const FileCacheEntry& file_cache_entry =
- entry.file_specific_info().cache_state();
- if (file_cache_entry.is_pinned() || file_cache_entry.is_dirty()) {
- const base::FilePath link_path = GetPathForId(to_links, entry.local_id());
- int link_result = link(move_from.AsUTF8Unsafe().c_str(),
- link_path.AsUTF8Unsafe().c_str());
- if (link_result != 0 && errno != EEXIST) {
- return false;
- }
- }
-
- // Move cache file.
- const base::FilePath move_to = GetPathForId(to_files, entry.local_id());
+ const base::FilePath move_to = GetPathForId(to, entry.local_id());
if (!base::Move(move_from, move_to)) {
return false;
}
+
+ // TODO(yawano): create hard link if entry is marked as pinned or dirty.
}
return true;
« no previous file with comments | « components/drive/file_cache.h ('k') | components/drive/file_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698