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

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

Issue 10736045: gdata: Remove GDataCacheEntry::set_cache_entry() (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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_cache_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_cache.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc
index 9f247ef36f5d3da753f12ec8d36ad7783a82b1d8..5bb2c09c6684093e8549c4943a05f4d835ccf478 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache.cc
@@ -812,7 +812,6 @@ void GDataCache::Store(const std::string& resource_id,
FilePath dest_path;
FilePath symlink_path;
- GDataCacheEntry new_cache_entry(md5, CACHE_STATE_NONE);
CacheSubDirectoryType sub_dir_type = CACHE_TYPE_TMP;
scoped_ptr<GDataCacheEntry> cache_entry = GetCacheEntry(resource_id, md5);
@@ -830,8 +829,6 @@ void GDataCache::Store(const std::string& resource_id,
return;
}
- new_cache_entry.set_cache_state(cache_entry->cache_state());
-
// If file is pinned, determines destination path.
if (cache_entry->IsPinned()) {
sub_dir_type = CACHE_TYPE_PERSISTENT;
@@ -841,6 +838,9 @@ void GDataCache::Store(const std::string& resource_id,
resource_id, std::string(), CACHE_TYPE_PINNED,
CACHED_FILE_FROM_SERVER);
}
+ } else {
+ // The file does not exist in the cache. Create a new entry.
+ cache_entry.reset(new GDataCacheEntry);
}
// File wasn't pinned or doesn't exist in cache, store in tmp dir.
@@ -880,9 +880,10 @@ void GDataCache::Store(const std::string& resource_id,
if (*error == base::PLATFORM_FILE_OK) {
// Now that file operations have completed, update cache map.
- new_cache_entry.SetPresent(true);
- new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
- metadata_->AddOrUpdateCacheEntry(resource_id, new_cache_entry);
+ cache_entry->set_md5(md5);
+ cache_entry->SetPresent(true);
+ cache_entry->SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+ metadata_->AddOrUpdateCacheEntry(resource_id, *cache_entry);
}
}
@@ -897,7 +898,6 @@ void GDataCache::Pin(const std::string& resource_id,
FilePath dest_path;
FilePath symlink_path;
bool create_symlink = true;
- GDataCacheEntry new_cache_entry(md5, CACHE_STATE_NONE);
CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT;
scoped_ptr<GDataCacheEntry> cache_entry = GetCacheEntry(resource_id, md5);
@@ -914,9 +914,10 @@ void GDataCache::Pin(const std::string& resource_id,
// Set sub_dir_type to TMP. The file will be first downloaded in 'tmp',
// then moved to 'persistent'.
sub_dir_type = CACHE_TYPE_TMP;
- } else { // File exists in cache, determines destination path.
- new_cache_entry.set_cache_state(cache_entry->cache_state());
+ // We'll add a new cache entry.
+ cache_entry.reset(new GDataCacheEntry);
+ } else { // File exists in cache, determines destination path.
// Determine source and destination paths.
// If file is dirty or mounted, don't move it, so determine |dest_path| and
@@ -969,9 +970,10 @@ void GDataCache::Pin(const std::string& resource_id,
if (*error == base::PLATFORM_FILE_OK) {
// Now that file operations have completed, update cache map.
- new_cache_entry.SetPinned(true);
- new_cache_entry.SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
- metadata_->AddOrUpdateCacheEntry(resource_id, new_cache_entry);
+ cache_entry->set_md5(md5);
+ cache_entry->SetPinned(true);
+ cache_entry->SetPersistent(sub_dir_type == CACHE_TYPE_PERSISTENT);
+ metadata_->AddOrUpdateCacheEntry(resource_id, *cache_entry);
}
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_cache_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698