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

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

Issue 10692154: gdata: Remove IsCache/SetCache/ClearCache* functions from GDataCache (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 22023875aa721737ea00c864e21f8a1dc43198df..f30da50b4f9a3fb40f829b6b8f61fc3bdb318c7c 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
@@ -298,7 +298,7 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
util::ParseCacheFilePath(current, &resource_id, &md5, &extra_extension);
// Determine cache state.
- int cache_state = GDataCache::CACHE_STATE_NONE;
+ GDataCache::CacheEntry cache_entry(md5, GDataCache::CACHE_STATE_NONE);
// If we're scanning pinned directory and if entry already exists, just
// update its pinned state.
if (sub_dir_type == GDataCache::CACHE_TYPE_PINNED) {
@@ -312,8 +312,7 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
CacheMap::iterator iter = cache_map->find(resource_id);
if (iter != cache_map->end()) { // Entry exists, update pinned state.
- iter->second.cache_state =
- GDataCache::SetCachePinned(iter->second.cache_state);
+ iter->second.SetPinned(true);
processed_file_map->insert(std::make_pair(resource_id, current));
continue;
@@ -321,7 +320,7 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
// Entry doesn't exist, this is a special symlink that refers to
// /dev/null; follow through to create an entry with the PINNED but not
// PRESENT state.
- cache_state = GDataCache::SetCachePinned(cache_state);
+ cache_entry.SetPinned(true);
} else if (sub_dir_type == GDataCache::CACHE_TYPE_OUTGOING) {
std::string reason;
if (!IsValidSymbolicLink(current, sub_dir_type, cache_paths, &reason)) {
@@ -347,7 +346,7 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
} else if (sub_dir_type == GDataCache::CACHE_TYPE_PERSISTENT ||
sub_dir_type == GDataCache::CACHE_TYPE_TMP) {
if (sub_dir_type == GDataCache::CACHE_TYPE_PERSISTENT)
- cache_state = GDataCache::SetCachePersistent(cache_state);
+ cache_entry.SetPersistent(true);
if (file_util::IsLink(current)) {
LOG(WARNING) << "Removing a symlink in persistent/tmp directory"
@@ -363,13 +362,13 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
file_util::Delete(current, false);
} else {
// The cache file is present.
- cache_state = GDataCache::SetCachePresent(cache_state);
+ cache_entry.SetPresent(true);
// Adds the dirty bit if |md5| indicates that the file is dirty, and
// the file is in the persistent directory.
if (md5 == util::kLocallyModifiedFileExtension) {
if (sub_dir_type == GDataCache::CACHE_TYPE_PERSISTENT) {
- cache_state = GDataCache::SetCacheDirty(cache_state);
+ cache_entry.SetDirty(true);
} else {
LOG(WARNING) << "Removing a dirty file in tmp directory: "
<< current.value();
@@ -383,8 +382,7 @@ void GDataCacheMetadataMap::ScanCacheDirectory(
}
// Create and insert new entry into cache map.
- cache_map->insert(std::make_pair(
- resource_id, GDataCache::CacheEntry(md5, cache_state)));
+ cache_map->insert(std::make_pair(resource_id, cache_entry));
processed_file_map->insert(std::make_pair(resource_id, current));
}
}

Powered by Google App Engine
This is Rietveld 408576698