From 04504c246dd88763f14933199feb80cde09fd258 Mon Sep 17 00:00:00 2001 From: "bartn@chromium.org" Date: Tue, 22 Jan 2013 21:08:55 +0000 Subject: [PATCH] By moving the call to Load() up in SearchProvider::Start(), we are giving a chance to initialize TemplateURLService as early as possible. Before the change, Load would be called only if there was a non-empty input. During the startup, there is at least 1 call with empty input. There is a chance this CL may increase startup time, however I have not observed it while running performance UI tests. As discussed with pkasting@, I'm planning to submit this CL and watch performance graphs to make sure we don't regress. BUG=167381 TEST=Manually ran performance_ui_tests. Review URL: https://chromiumcodereview.appspot.com/11859042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178092 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/autocomplete/search_provider.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 713af35fd7e0..4d6e3477a266 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -209,6 +209,12 @@ void SearchProvider::FinalizeInstantQuery(const string16& input_text, void SearchProvider::Start(const AutocompleteInput& input, bool minimal_changes) { + // Do our best to load the model as early as possible. This will reduce + // odds of having the model not ready when really needed (a non-empty input). + TemplateURLService* model = providers_.template_url_service(); + DCHECK(model); + model->Load(); + matches_.clear(); field_trial_triggered_ = false; @@ -228,9 +234,6 @@ void SearchProvider::Start(const AutocompleteInput& input, if (keyword_input_text_.empty()) keyword_provider = NULL; - TemplateURLService* model = providers_.template_url_service(); - DCHECK(model); - model->Load(); const TemplateURL* default_provider = model->GetDefaultSearchProvider(); if (default_provider && !default_provider->SupportsReplacement()) default_provider = NULL; -- 2.11.4.GIT