| 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // Downloads ------------------------------------------------------------------- | 734 // Downloads ------------------------------------------------------------------- |
| 735 | 735 |
| 736 // Handle creation of a download by creating an entry in the history service's | 736 // Handle creation of a download by creating an entry in the history service's |
| 737 // 'downloads' table. | 737 // 'downloads' table. |
| 738 void HistoryService::CreateDownload( | 738 void HistoryService::CreateDownload( |
| 739 const history::DownloadRow& create_info, | 739 const history::DownloadRow& create_info, |
| 740 const HistoryService::DownloadCreateCallback& callback) { | 740 const HistoryService::DownloadCreateCallback& callback) { |
| 741 DCHECK(thread_) << "History service being called after cleanup"; | 741 DCHECK(thread_) << "History service being called after cleanup"; |
| 742 DCHECK(thread_checker_.CalledOnValidThread()); | 742 DCHECK(thread_checker_.CalledOnValidThread()); |
| 743 PostTaskAndReplyWithResult( | 743 PostTaskAndReplyWithResult( |
| 744 thread_->message_loop_proxy(), FROM_HERE, | 744 thread_->message_loop_proxy().get(), |
| 745 base::Bind(&HistoryBackend::CreateDownload, history_backend_.get(), | 745 FROM_HERE, |
| 746 create_info), | 746 base::Bind( |
| 747 &HistoryBackend::CreateDownload, history_backend_.get(), create_info), |
| 747 callback); | 748 callback); |
| 748 } | 749 } |
| 749 | 750 |
| 750 void HistoryService::GetNextDownloadId( | 751 void HistoryService::GetNextDownloadId( |
| 751 const content::DownloadIdCallback& callback) { | 752 const content::DownloadIdCallback& callback) { |
| 752 DCHECK(thread_) << "History service being called after cleanup"; | 753 DCHECK(thread_) << "History service being called after cleanup"; |
| 753 DCHECK(thread_checker_.CalledOnValidThread()); | 754 DCHECK(thread_checker_.CalledOnValidThread()); |
| 754 PostTaskAndReplyWithResult( | 755 PostTaskAndReplyWithResult( |
| 755 thread_->message_loop_proxy(), FROM_HERE, | 756 thread_->message_loop_proxy().get(), |
| 757 FROM_HERE, |
| 756 base::Bind(&HistoryBackend::GetNextDownloadId, history_backend_.get()), | 758 base::Bind(&HistoryBackend::GetNextDownloadId, history_backend_.get()), |
| 757 callback); | 759 callback); |
| 758 } | 760 } |
| 759 | 761 |
| 760 // Handle queries for a list of all downloads in the history database's | 762 // Handle queries for a list of all downloads in the history database's |
| 761 // 'downloads' table. | 763 // 'downloads' table. |
| 762 void HistoryService::QueryDownloads( | 764 void HistoryService::QueryDownloads( |
| 763 const DownloadQueryCallback& callback) { | 765 const DownloadQueryCallback& callback) { |
| 764 DCHECK(thread_) << "History service being called after cleanup"; | 766 DCHECK(thread_) << "History service being called after cleanup"; |
| 765 DCHECK(thread_checker_.CalledOnValidThread()); | 767 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 DCHECK(thread_checker_.CalledOnValidThread()); | 1224 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1223 visit_database_observers_.RemoveObserver(observer); | 1225 visit_database_observers_.RemoveObserver(observer); |
| 1224 } | 1226 } |
| 1225 | 1227 |
| 1226 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1228 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1227 const history::BriefVisitInfo& info) { | 1229 const history::BriefVisitInfo& info) { |
| 1228 DCHECK(thread_checker_.CalledOnValidThread()); | 1230 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1229 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1231 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1230 OnAddVisit(info)); | 1232 OnAddVisit(info)); |
| 1231 } | 1233 } |
| OLD | NEW |