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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 base::Bind(&HistoryBackend::GetFaviconsForURL, | 637 base::Bind(&HistoryBackend::GetFaviconsForURL, |
638 history_backend_.get(), | 638 history_backend_.get(), |
639 page_url, | 639 page_url, |
640 icon_types, | 640 icon_types, |
641 desired_size_in_dip, | 641 desired_size_in_dip, |
642 desired_scale_factors, | 642 desired_scale_factors, |
643 results), | 643 results), |
644 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); | 644 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); |
645 } | 645 } |
646 | 646 |
| 647 CancelableTaskTracker::TaskId HistoryService::GetLargestFaviconForURL( |
| 648 const GURL& page_url, |
| 649 const std::vector<int>& icon_types, |
| 650 int minimal_size_in_pixels, |
| 651 const FaviconService::FaviconResultsCallback& callback, |
| 652 CancelableTaskTracker* tracker) { |
| 653 DCHECK(thread_checker_.CalledOnValidThread()); |
| 654 LoadBackendIfNecessary(); |
| 655 |
| 656 std::vector<chrome::FaviconBitmapResult>* results = |
| 657 new std::vector<chrome::FaviconBitmapResult>(); |
| 658 return tracker->PostTaskAndReply( |
| 659 thread_->message_loop_proxy().get(), |
| 660 FROM_HERE, |
| 661 base::Bind(&HistoryBackend::GetLargestFaviconForURL, |
| 662 history_backend_.get(), |
| 663 page_url, |
| 664 icon_types, |
| 665 minimal_size_in_pixels, |
| 666 results), |
| 667 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); |
| 668 } |
| 669 |
647 CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( | 670 CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( |
648 chrome::FaviconID favicon_id, | 671 chrome::FaviconID favicon_id, |
649 int desired_size_in_dip, | 672 int desired_size_in_dip, |
650 ui::ScaleFactor desired_scale_factor, | 673 ui::ScaleFactor desired_scale_factor, |
651 const FaviconService::FaviconResultsCallback& callback, | 674 const FaviconService::FaviconResultsCallback& callback, |
652 CancelableTaskTracker* tracker) { | 675 CancelableTaskTracker* tracker) { |
653 DCHECK(thread_checker_.CalledOnValidThread()); | 676 DCHECK(thread_checker_.CalledOnValidThread()); |
654 LoadBackendIfNecessary(); | 677 LoadBackendIfNecessary(); |
655 | 678 |
656 std::vector<chrome::FaviconBitmapResult>* results = | 679 std::vector<chrome::FaviconBitmapResult>* results = |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 DCHECK(thread_checker_.CalledOnValidThread()); | 1264 DCHECK(thread_checker_.CalledOnValidThread()); |
1242 visit_database_observers_.RemoveObserver(observer); | 1265 visit_database_observers_.RemoveObserver(observer); |
1243 } | 1266 } |
1244 | 1267 |
1245 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1268 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
1246 const history::BriefVisitInfo& info) { | 1269 const history::BriefVisitInfo& info) { |
1247 DCHECK(thread_checker_.CalledOnValidThread()); | 1270 DCHECK(thread_checker_.CalledOnValidThread()); |
1248 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1271 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
1249 OnAddVisit(info)); | 1272 OnAddVisit(info)); |
1250 } | 1273 } |
OLD | NEW |