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

Unified Diff: chrome/browser/chromeos/gdata/gdata_cache_metadata.cc

Issue 10765020: gdata: Simplify semantics of sub_dir_type in CacheEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
Index: chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
index 75118fa1c74b8f84daf1e64ab04547521123ab06..e0bee924d8dbb1dc222748eb7001b66441f7b403 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
@@ -294,6 +294,8 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
util::kWildCard);
for (FilePath current = enumerator.Next(); !current.empty();
current = enumerator.Next()) {
+ GDataCache::CacheSubDirectoryType real_sub_dir_type =
+ sub_dir_type;
// Extract resource_id and md5 from filename.
std::string resource_id;
std::string md5;
@@ -325,6 +327,9 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
// /dev/null; follow through to create an entry with the PINNED but not
// PRESENT state.
cache_state = GDataCache::SetCachePinned(cache_state);
+ // Change the real sub directory type to TMP, as the downloaded file
+ // will be stored in 'tmp' directory first.
+ real_sub_dir_type = GDataCache::CACHE_TYPE_TMP;
} else if (sub_dir_type == GDataCache::CACHE_TYPE_OUTGOING) {
std::string reason;
if (!IsValidSymbolicLink(current, sub_dir_type, cache_paths, &reason)) {
@@ -384,7 +389,8 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
// Create and insert new entry into cache map.
cache_map->insert(std::make_pair(
- resource_id, GDataCache::CacheEntry(md5, sub_dir_type, cache_state)));
+ resource_id, GDataCache::CacheEntry(
+ md5, real_sub_dir_type, cache_state)));
processed_file_map->insert(std::make_pair(resource_id, current));
}
}

Powered by Google App Engine
This is Rietveld 408576698