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

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

Issue 10581038: chromeos: Stop returning scoped_ptr from GDataCache::GetCacheEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 8 years, 6 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 89516ceb284e987db151243f9c2f8164e39da670..174d5278153741f04c935468de9d3d56cb1e957a 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
@@ -154,32 +154,32 @@ void GDataCacheMetadataMap::RemoveFromCache(const std::string& resource_id) {
}
}
-scoped_ptr<GDataCache::CacheEntry> GDataCacheMetadataMap::GetCacheEntry(
- const std::string& resource_id,
- const std::string& md5) {
+bool GDataCacheMetadataMap::GetCacheEntry(const std::string& resource_id,
+ const std::string& md5,
+ GDataCache::CacheEntry* entry) {
satorux1 2012/06/20 15:29:23 add DCHECK(entry); ?
hashimoto 2012/07/11 12:01:56 Done.
AssertOnSequencedWorkerPool();
CacheMap::iterator iter = cache_map_.find(resource_id);
if (iter == cache_map_.end()) {
DVLOG(1) << "Can't find " << resource_id << " in cache map";
- return scoped_ptr<GDataCache::CacheEntry>();
+ return false;
}
- scoped_ptr<GDataCache::CacheEntry> cache_entry(
- new GDataCache::CacheEntry(iter->second));
+ GDataCache::CacheEntry cache_entry(iter->second);
satorux1 2012/06/20 15:29:23 *entry = iter->second ? then, you don't have to co
hashimoto 2012/06/20 15:38:35 I'd like to keep this copying code since I think i
satorux1 2012/06/20 15:41:20 Good point. Then, you might want to make it a cons
hashimoto 2012/06/20 15:45:30 Oh, I thought CacheEntry(iter->second) was doing s
hashimoto 2012/07/11 12:01:56 Done.
- if (!CheckIfMd5Matches(md5, *cache_entry)) {
+ if (!CheckIfMd5Matches(md5, cache_entry)) {
DVLOG(1) << "Non-matching md5: want=" << md5
<< ", found=[res_id=" << resource_id
- << ", " << cache_entry->ToString()
+ << ", " << cache_entry.ToString()
<< "]";
- return scoped_ptr<GDataCache::CacheEntry>();
+ return false;
}
DVLOG(1) << "Found entry for res_id=" << resource_id
- << ", " << cache_entry->ToString();
+ << ", " << cache_entry.ToString();
- return cache_entry.Pass();
+ *entry = cache_entry;
+ return true;
}
void GDataCacheMetadataMap::RemoveTemporaryFiles() {

Powered by Google App Engine
This is Rietveld 408576698