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

Side by Side Diff: chrome/browser/history/history_service.cc

Issue 376703007: Change HistoryService::ScheduleAutocomplete interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 5 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
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 12 matching lines...) Expand all
23 #include "base/command_line.h" 23 #include "base/command_line.h"
24 #include "base/compiler_specific.h" 24 #include "base/compiler_specific.h"
25 #include "base/location.h" 25 #include "base/location.h"
26 #include "base/memory/ref_counted.h" 26 #include "base/memory/ref_counted.h"
27 #include "base/message_loop/message_loop.h" 27 #include "base/message_loop/message_loop.h"
28 #include "base/path_service.h" 28 #include "base/path_service.h"
29 #include "base/prefs/pref_service.h" 29 #include "base/prefs/pref_service.h"
30 #include "base/thread_task_runner_handle.h" 30 #include "base/thread_task_runner_handle.h"
31 #include "base/threading/thread.h" 31 #include "base/threading/thread.h"
32 #include "base/time/time.h" 32 #include "base/time/time.h"
33 #include "chrome/browser/autocomplete/history_url_provider.h"
34 #include "chrome/browser/browser_process.h" 33 #include "chrome/browser/browser_process.h"
35 #include "chrome/browser/chrome_notification_types.h" 34 #include "chrome/browser/chrome_notification_types.h"
36 #include "chrome/browser/history/download_row.h" 35 #include "chrome/browser/history/download_row.h"
37 #include "chrome/browser/history/history_backend.h" 36 #include "chrome/browser/history/history_backend.h"
38 #include "chrome/browser/history/history_notifications.h" 37 #include "chrome/browser/history/history_notifications.h"
39 #include "chrome/browser/history/history_types.h" 38 #include "chrome/browser/history/history_types.h"
40 #include "chrome/browser/history/in_memory_history_backend.h" 39 #include "chrome/browser/history/in_memory_history_backend.h"
41 #include "chrome/browser/history/in_memory_url_index.h" 40 #include "chrome/browser/history/in_memory_url_index.h"
42 #include "chrome/browser/history/top_sites.h" 41 #include "chrome/browser/history/top_sites.h"
43 #include "chrome/browser/history/visit_database.h" 42 #include "chrome/browser/history/visit_database.h"
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); 958 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_);
960 959
961 if (visitedlink_master_) { 960 if (visitedlink_master_) {
962 bool result = visitedlink_master_->Init(); 961 bool result = visitedlink_master_->Init();
963 DCHECK(result); 962 DCHECK(result);
964 } 963 }
965 964
966 return true; 965 return true;
967 } 966 }
968 967
969 void HistoryService::ScheduleAutocomplete(HistoryURLProvider* provider, 968 void HistoryService::ScheduleAutocomplete(const base::Callback<
970 HistoryURLProviderParams* params) { 969 void(history::HistoryBackend*, history::URLDatabase*)>& callback) {
971 DCHECK(thread_checker_.CalledOnValidThread()); 970 DCHECK(thread_checker_.CalledOnValidThread());
972 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::ScheduleAutocomplete, 971 ScheduleAndForget(
973 scoped_refptr<HistoryURLProvider>(provider), params); 972 PRIORITY_UI, &HistoryBackend::ScheduleAutocomplete, callback);
974 } 973 }
975 974
976 void HistoryService::ScheduleTask(SchedulePriority priority, 975 void HistoryService::ScheduleTask(SchedulePriority priority,
977 const base::Closure& task) { 976 const base::Closure& task) {
978 DCHECK(thread_checker_.CalledOnValidThread()); 977 DCHECK(thread_checker_.CalledOnValidThread());
979 CHECK(thread_); 978 CHECK(thread_);
980 CHECK(thread_->message_loop()); 979 CHECK(thread_->message_loop());
981 // TODO(brettw): Do prioritization. 980 // TODO(brettw): Do prioritization.
982 thread_->message_loop()->PostTask(FROM_HERE, task); 981 thread_->message_loop()->PostTask(FROM_HERE, task);
983 } 982 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 DCHECK(thread_checker_.CalledOnValidThread()); 1194 DCHECK(thread_checker_.CalledOnValidThread());
1196 visit_database_observers_.RemoveObserver(observer); 1195 visit_database_observers_.RemoveObserver(observer);
1197 } 1196 }
1198 1197
1199 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1198 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1200 const history::BriefVisitInfo& info) { 1199 const history::BriefVisitInfo& info) {
1201 DCHECK(thread_checker_.CalledOnValidThread()); 1200 DCHECK(thread_checker_.CalledOnValidThread());
1202 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1201 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1203 OnAddVisit(info)); 1202 OnAddVisit(info));
1204 } 1203 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698