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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 &HistoryBackend::SetFaviconsOutOfDateForPage, page_url); | 681 &HistoryBackend::SetFaviconsOutOfDateForPage, page_url); |
682 } | 682 } |
683 | 683 |
684 void HistoryService::CloneFavicons(const GURL& old_page_url, | 684 void HistoryService::CloneFavicons(const GURL& old_page_url, |
685 const GURL& new_page_url) { | 685 const GURL& new_page_url) { |
686 DCHECK(thread_checker_.CalledOnValidThread()); | 686 DCHECK(thread_checker_.CalledOnValidThread()); |
687 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicons, | 687 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::CloneFavicons, |
688 old_page_url, new_page_url); | 688 old_page_url, new_page_url); |
689 } | 689 } |
690 | 690 |
691 void HistoryService::SetImportedFavicons( | |
692 const std::vector<ImportedFaviconUsage>& favicon_usage) { | |
693 DCHECK(thread_checker_.CalledOnValidThread()); | |
694 ScheduleAndForget(PRIORITY_NORMAL, | |
695 &HistoryBackend::SetImportedFavicons, favicon_usage); | |
696 } | |
697 | |
698 base::CancelableTaskTracker::TaskId HistoryService::QueryURL( | 691 base::CancelableTaskTracker::TaskId HistoryService::QueryURL( |
699 const GURL& url, | 692 const GURL& url, |
700 bool want_visits, | 693 bool want_visits, |
701 const QueryURLCallback& callback, | 694 const QueryURLCallback& callback, |
702 base::CancelableTaskTracker* tracker) { | 695 base::CancelableTaskTracker* tracker) { |
703 DCHECK(thread_checker_.CalledOnValidThread()); | 696 DCHECK(thread_checker_.CalledOnValidThread()); |
704 history::QueryURLResult* query_url_result = new history::QueryURLResult(); | 697 history::QueryURLResult* query_url_result = new history::QueryURLResult(); |
705 return tracker->PostTaskAndReply( | 698 return tracker->PostTaskAndReply( |
706 thread_->message_loop_proxy().get(), | 699 thread_->message_loop_proxy().get(), |
707 FROM_HERE, | 700 FROM_HERE, |
708 base::Bind(&HistoryBackend::QueryURL, | 701 base::Bind(&HistoryBackend::QueryURL, |
709 history_backend_.get(), | 702 history_backend_.get(), |
710 url, | 703 url, |
711 want_visits, | 704 want_visits, |
712 base::Unretained(query_url_result)), | 705 base::Unretained(query_url_result)), |
713 base::Bind( | 706 base::Bind( |
714 &RunWithQueryURLResult, callback, base::Owned(query_url_result))); | 707 &RunWithQueryURLResult, callback, base::Owned(query_url_result))); |
715 } | 708 } |
716 | 709 |
| 710 // Importer -------------------------------------------------------------------- |
| 711 |
| 712 void HistoryService::SetImportedFavicons( |
| 713 const std::vector<ImportedFaviconUsage>& favicon_usage) { |
| 714 DCHECK(thread_checker_.CalledOnValidThread()); |
| 715 ScheduleAndForget( |
| 716 PRIORITY_NORMAL, &HistoryBackend::SetImportedFavicons, favicon_usage); |
| 717 } |
| 718 |
717 // Downloads ------------------------------------------------------------------- | 719 // Downloads ------------------------------------------------------------------- |
718 | 720 |
719 // Handle creation of a download by creating an entry in the history service's | 721 // Handle creation of a download by creating an entry in the history service's |
720 // 'downloads' table. | 722 // 'downloads' table. |
721 void HistoryService::CreateDownload( | 723 void HistoryService::CreateDownload( |
722 const history::DownloadRow& create_info, | 724 const history::DownloadRow& create_info, |
723 const HistoryService::DownloadCreateCallback& callback) { | 725 const HistoryService::DownloadCreateCallback& callback) { |
724 DCHECK(thread_) << "History service being called after cleanup"; | 726 DCHECK(thread_) << "History service being called after cleanup"; |
725 DCHECK(thread_checker_.CalledOnValidThread()); | 727 DCHECK(thread_checker_.CalledOnValidThread()); |
726 PostTaskAndReplyWithResult( | 728 PostTaskAndReplyWithResult( |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 DCHECK(thread_checker_.CalledOnValidThread()); | 1197 DCHECK(thread_checker_.CalledOnValidThread()); |
1196 visit_database_observers_.RemoveObserver(observer); | 1198 visit_database_observers_.RemoveObserver(observer); |
1197 } | 1199 } |
1198 | 1200 |
1199 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1201 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
1200 const history::BriefVisitInfo& info) { | 1202 const history::BriefVisitInfo& info) { |
1201 DCHECK(thread_checker_.CalledOnValidThread()); | 1203 DCHECK(thread_checker_.CalledOnValidThread()); |
1202 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1204 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
1203 OnAddVisit(info)); | 1205 OnAddVisit(info)); |
1204 } | 1206 } |
OLD | NEW |