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

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: rebase and review fix 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 ffc8b98c005281cb86ad4daf70df3be49596f045..d3dc4ea5efac85ce9bdf0f91f691d341a72c08f8 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
@@ -214,32 +214,33 @@ 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) {
+ DCHECK(entry);
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));
+ const GDataCache::CacheEntry& cache_entry = iter->second;
- 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