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

Unified Diff: ui/app_list/search_controller.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
« no previous file with comments | « ui/app_list/search_controller.h ('k') | ui/app_list/search_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/search_controller.cc
diff --git a/ui/app_list/search_controller.cc b/ui/app_list/search_controller.cc
index 64ea6b355d9bd4afb6b8b45954330ee1269c8602..83cca8d94661d2c13fbe7f725dad73d82454f0d1 100644
--- a/ui/app_list/search_controller.cc
+++ b/ui/app_list/search_controller.cc
@@ -23,7 +23,7 @@
namespace {
// Maximum time (in milliseconds) to wait to the search providers to finish.
-const int kStopTimeMS = 1500;
+constexpr int kStopTimeMS = 1500;
}
namespace app_list {
@@ -43,11 +43,9 @@ void SearchController::Start(bool is_voice_query) {
base::TrimWhitespace(search_box_->text(), base::TRIM_ALL, &query);
dispatching_query_ = true;
- for (Providers::iterator it = providers_.begin();
- it != providers_.end();
- ++it) {
- (*it)->Start(is_voice_query, query);
- }
+ for (const auto& provider : providers_)
+ provider->Start(is_voice_query, query);
+
dispatching_query_ = false;
query_for_recommendation_ = query.empty() ? true : false;
@@ -64,11 +62,8 @@ void SearchController::Start(bool is_voice_query) {
void SearchController::Stop() {
stop_timer_.Stop();
- for (Providers::iterator it = providers_.begin();
- it != providers_.end();
- ++it) {
- (*it)->Stop();
- }
+ for (const auto& provider : providers_)
+ provider->Stop();
}
void SearchController::OpenResult(SearchResult* result, int event_flags) {
@@ -117,7 +112,7 @@ void SearchController::AddProvider(size_t group_id,
provider->set_result_changed_callback(
base::Bind(&SearchController::OnResultsChanged, base::Unretained(this)));
mixer_->AddProviderToGroup(group_id, provider.get());
- providers_.push_back(std::move(provider));
+ providers_.emplace_back(std::move(provider));
}
void SearchController::OnResultsChanged() {
« no previous file with comments | « ui/app_list/search_controller.h ('k') | ui/app_list/search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698