| OLD | NEW |
| 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 Loading... |
| 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_database.h" | 39 #include "chrome/browser/history/in_memory_database.h" |
| 41 #include "chrome/browser/history/in_memory_history_backend.h" | 40 #include "chrome/browser/history/in_memory_history_backend.h" |
| 42 #include "chrome/browser/history/in_memory_url_index.h" | 41 #include "chrome/browser/history/in_memory_url_index.h" |
| 43 #include "chrome/browser/history/top_sites.h" | 42 #include "chrome/browser/history/top_sites.h" |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); | 931 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::Init, languages, no_db_); |
| 933 | 932 |
| 934 if (visitedlink_master_) { | 933 if (visitedlink_master_) { |
| 935 bool result = visitedlink_master_->Init(); | 934 bool result = visitedlink_master_->Init(); |
| 936 DCHECK(result); | 935 DCHECK(result); |
| 937 } | 936 } |
| 938 | 937 |
| 939 return true; | 938 return true; |
| 940 } | 939 } |
| 941 | 940 |
| 942 void HistoryService::ScheduleAutocomplete(HistoryURLProvider* provider, | 941 void HistoryService::ScheduleAutocomplete(const base::Callback< |
| 943 HistoryURLProviderParams* params) { | 942 void(history::HistoryBackend*, history::URLDatabase*)>& callback) { |
| 944 DCHECK(thread_checker_.CalledOnValidThread()); | 943 DCHECK(thread_checker_.CalledOnValidThread()); |
| 945 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::ScheduleAutocomplete, | 944 ScheduleAndForget( |
| 946 scoped_refptr<HistoryURLProvider>(provider), params); | 945 PRIORITY_UI, &HistoryBackend::ScheduleAutocomplete, callback); |
| 947 } | 946 } |
| 948 | 947 |
| 949 void HistoryService::ScheduleTask(SchedulePriority priority, | 948 void HistoryService::ScheduleTask(SchedulePriority priority, |
| 950 const base::Closure& task) { | 949 const base::Closure& task) { |
| 951 DCHECK(thread_checker_.CalledOnValidThread()); | 950 DCHECK(thread_checker_.CalledOnValidThread()); |
| 952 CHECK(thread_); | 951 CHECK(thread_); |
| 953 CHECK(thread_->message_loop()); | 952 CHECK(thread_->message_loop()); |
| 954 // TODO(brettw): Do prioritization. | 953 // TODO(brettw): Do prioritization. |
| 955 thread_->message_loop()->PostTask(FROM_HERE, task); | 954 thread_->message_loop()->PostTask(FROM_HERE, task); |
| 956 } | 955 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 DCHECK(thread_checker_.CalledOnValidThread()); | 1167 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1169 visit_database_observers_.RemoveObserver(observer); | 1168 visit_database_observers_.RemoveObserver(observer); |
| 1170 } | 1169 } |
| 1171 | 1170 |
| 1172 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1171 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1173 const history::BriefVisitInfo& info) { | 1172 const history::BriefVisitInfo& info) { |
| 1174 DCHECK(thread_checker_.CalledOnValidThread()); | 1173 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1175 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1174 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1176 OnAddVisit(info)); | 1175 OnAddVisit(info)); |
| 1177 } | 1176 } |
| OLD | NEW |