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

Unified Diff: components/enhanced_bookmarks/bookmark_server_search_service.h

Issue 688883002: Revert of Add Search Service in Enhanced Bookmark Bridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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: components/enhanced_bookmarks/bookmark_server_search_service.h
diff --git a/components/enhanced_bookmarks/bookmark_server_search_service.h b/components/enhanced_bookmarks/bookmark_server_search_service.h
index df59f940872646e9241ebab5333ff0f7b7cdf267..97713185418368ce34a427eb54a50588a96c7eee 100644
--- a/components/enhanced_bookmarks/bookmark_server_search_service.h
+++ b/components/enhanced_bookmarks/bookmark_server_search_service.h
@@ -8,7 +8,6 @@
#include <string>
#include <vector>
-#include "base/containers/mru_cache.h"
#include "components/enhanced_bookmarks/bookmark_server_service.h"
#include "net/url_request/url_fetcher.h"
@@ -28,20 +27,14 @@
~BookmarkServerSearchService() override;
// Triggers a search. The query must not be empty. A call to this method
- // cancels any previous searches. If there have been multiple queries in
- // between, onChange will only be called for the last query.
- // Note this method will be synchronous if query hits the cache.
+ // cancels any previous searches. OnChange() is garanteed to be called once
+ // per query.
void Search(const std::string& query);
- // Returns search results for a query. Results for a query are only available
- // after Search() is called and after then OnChange() observer methods has
- // been sent.This method might return an empty vector, meaning there are no
- // bookmarks matching the given query. Returning null means we are still
- // loading and no results have come to the client. Previously cancelled
- // queries will not trigger onChange(), and this method will also return null
- // for queries that have never been passed to Search() before.
- scoped_ptr<std::vector<const BookmarkNode*>> ResultForQuery(
- const std::string& query);
+ // Returns the search results. The results are only available after the
+ // OnChange() observer methods has been sent. This method will return an empty
+ // result otherwise. query should be a string passed to Search() previously.
+ std::vector<const BookmarkNode*> ResultForQuery(const std::string& query);
protected:
scoped_ptr<net::URLFetcher> CreateFetcher() override;
@@ -61,11 +54,8 @@
const std::string& remote_id) override;
private:
- // Cache for previous search result, a map from a query string to vector of
- // star_ids.
- base::MRUCache<std::string, std::vector<std::string>> cache_;
- // The query currently on the fly, and is cleared as soon as the result is
- // available.
+ // The search data, a map from query to a vector of stars.id.
+ std::map<std::string, std::vector<std::string> > searches_;
std::string current_query_;
DISALLOW_COPY_AND_ASSIGN(BookmarkServerSearchService);
};

Powered by Google App Engine
This is Rietveld 408576698