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

Unified Diff: chrome/browser/ui/app_list/search/webstore/webstore_provider.cc

Issue 49353006: Add caching for apps list search results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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/webstore/webstore_provider.cc
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
index 973fc2e9a2b5fbb1250203c45be7596e9a3bbf06..41bba55a4a33f8f3161ad984b4dc1789877b0fc4 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
@@ -53,12 +53,13 @@ void WebstoreProvider::Start(const base::string16& query) {
}
query_ = UTF16ToUTF8(query);
- const base::DictionaryValue* cached_result = cache_.Get(query_);
- if (cached_result) {
- ProcessWebstoreSearchResults(cached_result);
+ const CacheResult result = cache_->Get(WEBSTORE, query_);
+ if (result.second) {
+ ProcessWebstoreSearchResults(result.second);
if (!webstore_search_fetched_callback_.is_null())
webstore_search_fetched_callback_.Run();
- return;
+ if (result.first == FRESH)
+ return;
}
if (UseWebstoreSearch()) {
@@ -96,7 +97,7 @@ void WebstoreProvider::StartQuery() {
void WebstoreProvider::OnWebstoreSearchFetched(
scoped_ptr<base::DictionaryValue> json) {
ProcessWebstoreSearchResults(json.get());
- cache_.Put(query_, json.Pass());
+ cache_->Put(WEBSTORE, query_, json.Pass());
if (!webstore_search_fetched_callback_.is_null())
webstore_search_fetched_callback_.Run();

Powered by Google App Engine
This is Rietveld 408576698