Commit bbb101b9 authored by satorux@chromium.org's avatar satorux@chromium.org

gdata: Use member functions of CacheEntry where it can

BUG=136625
TEST=out/Release/unit_tests --gtest_filter=GData*

Review URL: https://chromiumcodereview.appspot.com/10690126

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146059 0039d316-1c4b-4281-b951-d872f2087c98
parent 9fc572a7
......@@ -1876,21 +1876,14 @@ void GetGDataFilePropertiesFunction::OnOperationComplete(
void GetGDataFilePropertiesFunction::CacheStateReceived(
base::DictionaryValue* property_dict,
bool success,
bool /* success */,
const gdata::GDataCache::CacheEntry& cache_entry) {
const int cache_state = (success ? cache_entry.cache_state :
gdata::GDataCache::CACHE_STATE_NONE);
property_dict->SetBoolean(
"isPinned",
gdata::GDataCache::IsCachePinned(cache_state));
property_dict->SetBoolean(
"isPresent",
gdata::GDataCache::IsCachePresent(cache_state));
property_dict->SetBoolean(
"isDirty",
gdata::GDataCache::IsCacheDirty(cache_state));
// In case of an error (i.e. success is false), cache_entry.cache_state is
// set to CACHE_STATE_NONE.
property_dict->SetBoolean("isPinned", cache_entry.IsPinned());
property_dict->SetBoolean("isPresent", cache_entry.IsPresent());
property_dict->SetBoolean("isDirty", cache_entry.IsDirty());
CompleteGetFileProperties();
}
......
......@@ -337,13 +337,13 @@ void RunGetCacheEntryCallback(
std::string GDataCache::CacheEntry::ToString() const {
std::vector<std::string> cache_states;
if (GDataCache::IsCachePresent(cache_state))
if (IsPresent())
cache_states.push_back("present");
if (GDataCache::IsCachePinned(cache_state))
if (IsPinned())
cache_states.push_back("pinned");
if (GDataCache::IsCacheDirty(cache_state))
if (IsDirty())
cache_states.push_back("dirty");
if (GDataCache::IsCachePersistent(cache_state))
if (IsPersistent())
cache_states.push_back("persistent");
return base::StringPrintf("md5=%s, cache_state=%s",
......
......@@ -121,7 +121,7 @@ class GDataCache {
// Structure to store information of an existing cache file.
struct CacheEntry {
CacheEntry() : cache_state(0) {}
CacheEntry() : cache_state(CACHE_STATE_NONE) {}
CacheEntry(const std::string& md5,
int cache_state)
......@@ -149,7 +149,8 @@ class GDataCache {
// Callback for GetCacheEntryOnUIThread.
// |success| indicates if the operation was successful.
// |cache_entry| is the obtained cache entry.
// |cache_entry| is the obtained cache entry. On failure, |cache_state| is
// set to CACHE_STATE_NONE.
//
// TODO(satorux): Unlike other callback types, this has to be defined
// inside GDataCache as CacheEntry is inside GDataCache. We should get them
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment