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( ...@@ -1876,21 +1876,14 @@ void GetGDataFilePropertiesFunction::OnOperationComplete(
void GetGDataFilePropertiesFunction::CacheStateReceived( void GetGDataFilePropertiesFunction::CacheStateReceived(
base::DictionaryValue* property_dict, base::DictionaryValue* property_dict,
bool success, bool /* success */,
const gdata::GDataCache::CacheEntry& cache_entry) { const gdata::GDataCache::CacheEntry& cache_entry) {
const int cache_state = (success ? cache_entry.cache_state : // In case of an error (i.e. success is false), cache_entry.cache_state is
gdata::GDataCache::CACHE_STATE_NONE); // set to CACHE_STATE_NONE.
property_dict->SetBoolean( property_dict->SetBoolean("isPinned", cache_entry.IsPinned());
"isPinned", property_dict->SetBoolean("isPresent", cache_entry.IsPresent());
gdata::GDataCache::IsCachePinned(cache_state)); property_dict->SetBoolean("isDirty", cache_entry.IsDirty());
property_dict->SetBoolean(
"isPresent",
gdata::GDataCache::IsCachePresent(cache_state));
property_dict->SetBoolean(
"isDirty",
gdata::GDataCache::IsCacheDirty(cache_state));
CompleteGetFileProperties(); CompleteGetFileProperties();
} }
......
...@@ -337,13 +337,13 @@ void RunGetCacheEntryCallback( ...@@ -337,13 +337,13 @@ void RunGetCacheEntryCallback(
std::string GDataCache::CacheEntry::ToString() const { std::string GDataCache::CacheEntry::ToString() const {
std::vector<std::string> cache_states; std::vector<std::string> cache_states;
if (GDataCache::IsCachePresent(cache_state)) if (IsPresent())
cache_states.push_back("present"); cache_states.push_back("present");
if (GDataCache::IsCachePinned(cache_state)) if (IsPinned())
cache_states.push_back("pinned"); cache_states.push_back("pinned");
if (GDataCache::IsCacheDirty(cache_state)) if (IsDirty())
cache_states.push_back("dirty"); cache_states.push_back("dirty");
if (GDataCache::IsCachePersistent(cache_state)) if (IsPersistent())
cache_states.push_back("persistent"); cache_states.push_back("persistent");
return base::StringPrintf("md5=%s, cache_state=%s", return base::StringPrintf("md5=%s, cache_state=%s",
......
...@@ -121,7 +121,7 @@ class GDataCache { ...@@ -121,7 +121,7 @@ class GDataCache {
// Structure to store information of an existing cache file. // Structure to store information of an existing cache file.
struct CacheEntry { struct CacheEntry {
CacheEntry() : cache_state(0) {} CacheEntry() : cache_state(CACHE_STATE_NONE) {}
CacheEntry(const std::string& md5, CacheEntry(const std::string& md5,
int cache_state) int cache_state)
...@@ -149,7 +149,8 @@ class GDataCache { ...@@ -149,7 +149,8 @@ class GDataCache {
// Callback for GetCacheEntryOnUIThread. // Callback for GetCacheEntryOnUIThread.
// |success| indicates if the operation was successful. // |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 // TODO(satorux): Unlike other callback types, this has to be defined
// inside GDataCache as CacheEntry is inside GDataCache. We should get them // 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