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

Side by Side Diff: chrome/browser/ui/app_list/search/omnibox_provider.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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" 5 #include "chrome/browser/ui/app_list/search/omnibox_provider.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" 8 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 29 matching lines...) Expand all
40 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, 40 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false,
41 ChromeAutocompleteSchemeClassifier(profile_))); 41 ChromeAutocompleteSchemeClassifier(profile_)));
42 } 42 }
43 43
44 void OmniboxProvider::Stop() { 44 void OmniboxProvider::Stop() {
45 controller_->Stop(false); 45 controller_->Stop(false);
46 is_voice_query_ = false; 46 is_voice_query_ = false;
47 } 47 }
48 48
49 void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) { 49 void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) {
50 ClearResults(); 50 SearchProvider::Results new_results;
51 for (ACMatches::const_iterator it = result.begin(); 51 new_results.reserve(result.size());
52 it != result.end(); 52 for (const AutocompleteMatch& match : result) {
53 ++it) { 53 if (!match.destination_url.is_valid())
54 if (!it->destination_url.is_valid())
55 continue; 54 continue;
56 55
57 Add(std::unique_ptr<SearchResult>(new OmniboxResult( 56 new_results.emplace_back(base::MakeUnique<OmniboxResult>(
58 profile_, list_controller_, controller_.get(), is_voice_query_, *it))); 57 profile_, list_controller_, controller_.get(), is_voice_query_, match));
59 } 58 }
59 SwapResults(&new_results);
60 } 60 }
61 61
62 void OmniboxProvider::OnResultChanged(bool default_match_changed) { 62 void OmniboxProvider::OnResultChanged(bool default_match_changed) {
63 const AutocompleteResult& result = controller_->result(); 63 PopulateFromACResult(controller_->result());
64 PopulateFromACResult(result);
65 } 64 }
66 65
67 } // namespace app_list 66 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698