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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autocomplete/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/location.h"
12 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
16 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 19 #include "base/time/time.h"
18 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 20 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
19 #include "chrome/browser/autocomplete/scored_history_match.h" 21 #include "chrome/browser/autocomplete/scored_history_match.h"
20 #include "chrome/browser/history/history_service_factory.h" 22 #include "chrome/browser/history/history_service_factory.h"
21 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/search_engines/template_url_service_factory.h" 24 #include "chrome/browser/search_engines/template_url_service_factory.h"
23 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 25 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
24 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } else if (!params->cancel_flag.IsSet()) { 662 } else if (!params->cancel_flag.IsSet()) {
661 base::TimeTicks beginning_time = base::TimeTicks::Now(); 663 base::TimeTicks beginning_time = base::TimeTicks::Now();
662 664
663 DoAutocomplete(backend, db, params); 665 DoAutocomplete(backend, db, params);
664 666
665 UMA_HISTOGRAM_TIMES("Autocomplete.HistoryAsyncQueryTime", 667 UMA_HISTOGRAM_TIMES("Autocomplete.HistoryAsyncQueryTime",
666 base::TimeTicks::Now() - beginning_time); 668 base::TimeTicks::Now() - beginning_time);
667 } 669 }
668 670
669 // Return the results (if any) to the main thread. 671 // Return the results (if any) to the main thread.
670 params->message_loop->PostTask(FROM_HERE, base::Bind( 672 params->message_loop->task_runner()->PostTask(
671 &HistoryURLProvider::QueryComplete, this, params)); 673 FROM_HERE, base::Bind(&HistoryURLProvider::QueryComplete, this, params));
672 } 674 }
673 675
674 HistoryURLProvider::~HistoryURLProvider() { 676 HistoryURLProvider::~HistoryURLProvider() {
675 // Note: This object can get leaked on shutdown if there are pending 677 // Note: This object can get leaked on shutdown if there are pending
676 // requests on the database (which hold a reference to us). Normally, these 678 // requests on the database (which hold a reference to us). Normally, these
677 // messages get flushed for each thread. We do a round trip from main, to 679 // messages get flushed for each thread. We do a round trip from main, to
678 // history, back to main while holding a reference. If the main thread 680 // history, back to main while holding a reference. If the main thread
679 // completes before the history thread, the message to delegate back to the 681 // completes before the history thread, the message to delegate back to the
680 // main thread will not run and the reference will leak. Therefore, don't do 682 // main thread will not run and the reference will leak. Therefore, don't do
681 // anything on destruction. 683 // anything on destruction.
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1181 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1180 match.contents.length(), ACMatchClassification::URL, 1182 match.contents.length(), ACMatchClassification::URL,
1181 &match.contents_class); 1183 &match.contents_class);
1182 } 1184 }
1183 match.description = info.title(); 1185 match.description = info.title();
1184 match.description_class = 1186 match.description_class =
1185 ClassifyDescription(params.input.text(), match.description); 1187 ClassifyDescription(params.input.text(), match.description);
1186 RecordAdditionalInfoFromUrlRow(info, &match); 1188 RecordAdditionalInfoFromUrlRow(info, &match);
1187 return match; 1189 return match;
1188 } 1190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698