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

Unified Diff: chrome/browser/ui/app_list/search/search_controller_factory.cc

Issue 2701123002: AppList Performance Optimization 2 (Closed)
Patch Set: Cache the tokenized name Created 3 years, 10 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/search_controller_factory.cc
diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.cc b/chrome/browser/ui/app_list/search/search_controller_factory.cc
index 1239302b4a7e7968e5e8496a266a171463949a5a..3506a1f9b3000ccf2e9a024731bcf206d1cf89b0 100644
--- a/chrome/browser/ui/app_list/search/search_controller_factory.cc
+++ b/chrome/browser/ui/app_list/search/search_controller_factory.cc
@@ -33,18 +33,19 @@ namespace app_list {
namespace {
// Maximum number of results to show in each mixer group.
-const size_t kMaxAppsGroupResults = 8;
-const size_t kMaxOmniboxResults = 4;
-const size_t kMaxWebstoreResults = 2;
-const size_t kMaxSuggestionsResults = 6;
+constexpr size_t kMaxAppsGroupResults = 8;
+constexpr size_t kMaxOmniboxResults = 4;
+constexpr size_t kMaxWebstoreResults = 2;
+constexpr size_t kMaxSuggestionsResults = 6;
#if defined(OS_CHROMEOS)
-const size_t kMaxLauncherSearchResults = 2;
+constexpr size_t kMaxLauncherSearchResults = 2;
#endif
// Constants related to the SuggestionsService in AppList field trial.
-const char kSuggestionsProviderFieldTrialName[] = "SuggestionsAppListProvider";
-const char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled";
+constexpr char kSuggestionsProviderFieldTrialName[] =
+ "SuggestionsAppListProvider";
+constexpr char kSuggestionsProviderFieldTrialEnabledPrefix[] = "Enabled";
// Returns whether the user is part of a group where the Suggestions provider is
// enabled.
@@ -61,9 +62,10 @@ std::unique_ptr<SearchController> CreateSearchController(
Profile* profile,
AppListModel* model,
AppListControllerDelegate* list_controller) {
- std::unique_ptr<SearchController> controller(
- new SearchController(model->search_box(), model->results(),
- HistoryFactory::GetForBrowserContext(profile)));
+ std::unique_ptr<SearchController> controller =
+ base::MakeUnique<SearchController>(
+ model->search_box(), model->results(),
+ HistoryFactory::GetForBrowserContext(profile));
// Add mixer groups. There are three main groups: apps, webstore and
// omnibox. Each group has a "soft" maximum number of results. However, if
@@ -76,22 +78,21 @@ std::unique_ptr<SearchController> CreateSearchController(
// Add search providers.
controller->AddProvider(
apps_group_id,
- std::unique_ptr<SearchProvider>(new AppSearchProvider(
+ base::MakeUnique<AppSearchProvider>(
profile, list_controller, base::MakeUnique<base::DefaultClock>(),
- model->top_level_item_list())));
- controller->AddProvider(omnibox_group_id,
- std::unique_ptr<SearchProvider>(
- new OmniboxProvider(profile, list_controller)));
- controller->AddProvider(webstore_group_id,
- std::unique_ptr<SearchProvider>(
- new WebstoreProvider(profile, list_controller)));
+ model->top_level_item_list()));
+ controller->AddProvider(
+ omnibox_group_id,
+ base::MakeUnique<OmniboxProvider>(profile, list_controller));
+ controller->AddProvider(
+ webstore_group_id,
+ base::MakeUnique<WebstoreProvider>(profile, list_controller));
if (IsSuggestionsSearchProviderEnabled()) {
size_t suggestions_group_id =
controller->AddGroup(kMaxSuggestionsResults, 1.0);
controller->AddProvider(
suggestions_group_id,
- std::unique_ptr<SearchProvider>(
- new SuggestionsSearchProvider(profile, list_controller)));
+ base::MakeUnique<SuggestionsSearchProvider>(profile, list_controller));
}
// LauncherSearchProvider is added only when flag is enabled, not in guest
@@ -101,9 +102,8 @@ std::unique_ptr<SearchController> CreateSearchController(
!profile->IsGuestSession()) {
size_t search_api_group_id =
controller->AddGroup(kMaxLauncherSearchResults, 1.0);
- controller->AddProvider(
- search_api_group_id,
- std::unique_ptr<SearchProvider>(new LauncherSearchProvider(profile)));
+ controller->AddProvider(search_api_group_id,
+ base::MakeUnique<LauncherSearchProvider>(profile));
}
#endif

Powered by Google App Engine
This is Rietveld 408576698