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