| 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 // Beware! The first Bind() does not simply |scoped_rows.get()| because | 797 // Beware! The first Bind() does not simply |scoped_rows.get()| because |
| 798 // base::Passed(&scoped_rows) nullifies |scoped_rows|, and compilers do not | 798 // base::Passed(&scoped_rows) nullifies |scoped_rows|, and compilers do not |
| 799 // guarantee that the first Bind's arguments are evaluated before the second | 799 // guarantee that the first Bind's arguments are evaluated before the second |
| 800 // Bind's arguments. | 800 // Bind's arguments. |
| 801 thread_->message_loop_proxy()->PostTaskAndReply( | 801 thread_->message_loop_proxy()->PostTaskAndReply( |
| 802 FROM_HERE, | 802 FROM_HERE, |
| 803 base::Bind(&HistoryBackend::QueryDownloads, history_backend_.get(), rows), | 803 base::Bind(&HistoryBackend::QueryDownloads, history_backend_.get(), rows), |
| 804 base::Bind(callback, base::Passed(&scoped_rows))); | 804 base::Bind(callback, base::Passed(&scoped_rows))); |
| 805 } | 805 } |
| 806 | 806 |
| 807 // Changes all IN_PROGRESS in the database entries to CANCELED. | |
| 808 // IN_PROGRESS entries are the corrupted entries, not updated by next function | |
| 809 // because of the crash or some other extremal exit. | |
| 810 void HistoryService::CleanUpInProgressEntries() { | |
| 811 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 812 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CleanUpInProgressEntries); | |
| 813 } | |
| 814 | |
| 815 // Handle updates for a particular download. This is a 'fire and forget' | 807 // Handle updates for a particular download. This is a 'fire and forget' |
| 816 // operation, so we don't need to be called back. | 808 // operation, so we don't need to be called back. |
| 817 void HistoryService::UpdateDownload(const history::DownloadRow& data) { | 809 void HistoryService::UpdateDownload(const history::DownloadRow& data) { |
| 818 DCHECK(thread_checker_.CalledOnValidThread()); | 810 DCHECK(thread_checker_.CalledOnValidThread()); |
| 819 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::UpdateDownload, data); | 811 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::UpdateDownload, data); |
| 820 } | 812 } |
| 821 | 813 |
| 822 void HistoryService::RemoveDownloads(const std::set<int64>& db_handles) { | 814 void HistoryService::RemoveDownloads(const std::set<int64>& db_handles) { |
| 823 DCHECK(thread_checker_.CalledOnValidThread()); | 815 DCHECK(thread_checker_.CalledOnValidThread()); |
| 824 ScheduleAndForget(PRIORITY_NORMAL, | 816 ScheduleAndForget(PRIORITY_NORMAL, |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 DCHECK(thread_checker_.CalledOnValidThread()); | 1265 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1274 visit_database_observers_.RemoveObserver(observer); | 1266 visit_database_observers_.RemoveObserver(observer); |
| 1275 } | 1267 } |
| 1276 | 1268 |
| 1277 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1269 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1278 const history::BriefVisitInfo& info) { | 1270 const history::BriefVisitInfo& info) { |
| 1279 DCHECK(thread_checker_.CalledOnValidThread()); | 1271 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1280 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1272 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1281 OnAddVisit(info)); | 1273 OnAddVisit(info)); |
| 1282 } | 1274 } |
| OLD | NEW |