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

Unified Diff: chrome/browser/ui/app_list/search/common/webservice_cache.h

Issue 1763273002: base: Remove OwningMRUCache in favor of scoped_ptrs in MRUCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + fix Created 4 years, 9 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/ui/app_list/search/common/webservice_cache.h
diff --git a/chrome/browser/ui/app_list/search/common/webservice_cache.h b/chrome/browser/ui/app_list/search/common/webservice_cache.h
index b71c76b90a1a8b7e3372d7aaa3d26f28af6fa286..a5ac9104afc88c25de10e95fe37bc9fa3b96f294 100644
--- a/chrome/browser/ui/app_list/search/common/webservice_cache.h
+++ b/chrome/browser/ui/app_list/search/common/webservice_cache.h
@@ -64,22 +64,17 @@ class WebserviceCache : public KeyedService,
private:
struct Payload {
- Payload(const base::Time& time,
- const base::DictionaryValue* result)
- : time(time), result(result) {}
- Payload() {}
+ Payload(const base::Time& time, scoped_ptr<base::DictionaryValue> result);
+ Payload();
+ ~Payload();
+
+ Payload& operator=(Payload&& other);
base::Time time;
- const base::DictionaryValue* result;
+ scoped_ptr<base::DictionaryValue> result;
};
- class CacheDeletor {
- public:
- void operator()(const Payload& payload);
- };
- typedef base::
- MRUCacheBase<std::string, Payload, std::less<std::string>, CacheDeletor>
- Cache;
+ using Cache = base::MRUCache<std::string, scoped_ptr<Payload>>;
// Callback for when the cache is loaded from the dictionary data store.
void OnCacheLoaded(scoped_ptr<base::DictionaryValue>);
@@ -87,8 +82,7 @@ class WebserviceCache : public KeyedService,
// Populates the payload parameter with the corresponding payload stored
// in the given dictionary. If the dictionary is invalid for any reason,
// this method will return false.
- bool PayloadFromDict(const base::DictionaryValue* dict,
- Payload* payload);
+ bool PayloadFromDict(const base::DictionaryValue* dict, Payload* payload);
// Returns a dictionary value for a given payload. The returned dictionary
// will be owned by the data_store_ cached_dict, and freed on the destruction

Powered by Google App Engine
This is Rietveld 408576698