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

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 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 fe0fb5e45a78324c0839b78936b8cca24d1eeb99..16c61cb98df298dcf667a27c0d4d9080ead5ae58 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache_metadata.cc
@@ -201,32 +201,33 @@ void GDataCacheMetadataMap::RemoveCacheEntry(const std::string& resource_id) {
}
}
-scoped_ptr<GDataCacheEntry> GDataCacheMetadataMap::GetCacheEntry(
- const std::string& resource_id,
- const std::string& md5) {
+bool GDataCacheMetadataMap::GetCacheEntry(const std::string& resource_id,
+ const std::string& md5,
+ GDataCacheEntry* 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<GDataCacheEntry>();
+ return false;
}
- scoped_ptr<GDataCacheEntry> cache_entry(
- new GDataCacheEntry(iter->second));
+ const GDataCacheEntry& 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<GDataCacheEntry>();
+ 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() {
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache_metadata.h ('k') | chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698