Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/history/history_service.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 int desired_size_in_dip, 622 int desired_size_in_dip,
623 const std::vector<ui::ScaleFactor>& desired_scale_factors, 623 const std::vector<ui::ScaleFactor>& desired_scale_factors,
624 const FaviconService::FaviconResultsCallback& callback, 624 const FaviconService::FaviconResultsCallback& callback,
625 CancelableTaskTracker* tracker) { 625 CancelableTaskTracker* tracker) {
626 DCHECK(thread_checker_.CalledOnValidThread()); 626 DCHECK(thread_checker_.CalledOnValidThread());
627 LoadBackendIfNecessary(); 627 LoadBackendIfNecessary();
628 628
629 std::vector<chrome::FaviconBitmapResult>* results = 629 std::vector<chrome::FaviconBitmapResult>* results =
630 new std::vector<chrome::FaviconBitmapResult>(); 630 new std::vector<chrome::FaviconBitmapResult>();
631 return tracker->PostTaskAndReply( 631 return tracker->PostTaskAndReply(
632 thread_->message_loop_proxy(), 632 thread_->message_loop_proxy().get(),
633 FROM_HERE, 633 FROM_HERE,
634 base::Bind(&HistoryBackend::GetFavicons, 634 base::Bind(&HistoryBackend::GetFavicons,
635 history_backend_.get(), icon_urls, icon_types, 635 history_backend_.get(),
636 desired_size_in_dip, desired_scale_factors, results), 636 icon_urls,
637 icon_types,
638 desired_size_in_dip,
639 desired_scale_factors,
640 results),
637 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 641 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
638 } 642 }
639 643
640 CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL( 644 CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL(
641 const GURL& page_url, 645 const GURL& page_url,
642 int icon_types, 646 int icon_types,
643 int desired_size_in_dip, 647 int desired_size_in_dip,
644 const std::vector<ui::ScaleFactor>& desired_scale_factors, 648 const std::vector<ui::ScaleFactor>& desired_scale_factors,
645 const FaviconService::FaviconResultsCallback& callback, 649 const FaviconService::FaviconResultsCallback& callback,
646 CancelableTaskTracker* tracker) { 650 CancelableTaskTracker* tracker) {
647 DCHECK(thread_checker_.CalledOnValidThread()); 651 DCHECK(thread_checker_.CalledOnValidThread());
648 LoadBackendIfNecessary(); 652 LoadBackendIfNecessary();
649 653
650 std::vector<chrome::FaviconBitmapResult>* results = 654 std::vector<chrome::FaviconBitmapResult>* results =
651 new std::vector<chrome::FaviconBitmapResult>(); 655 new std::vector<chrome::FaviconBitmapResult>();
652 return tracker->PostTaskAndReply( 656 return tracker->PostTaskAndReply(
653 thread_->message_loop_proxy(), 657 thread_->message_loop_proxy().get(),
654 FROM_HERE, 658 FROM_HERE,
655 base::Bind(&HistoryBackend::GetFaviconsForURL, 659 base::Bind(&HistoryBackend::GetFaviconsForURL,
656 history_backend_.get(), page_url, icon_types, 660 history_backend_.get(),
657 desired_size_in_dip, desired_scale_factors, results), 661 page_url,
662 icon_types,
663 desired_size_in_dip,
664 desired_scale_factors,
665 results),
658 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 666 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
659 } 667 }
660 668
661 CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( 669 CancelableTaskTracker::TaskId HistoryService::GetFaviconForID(
662 chrome::FaviconID favicon_id, 670 chrome::FaviconID favicon_id,
663 int desired_size_in_dip, 671 int desired_size_in_dip,
664 ui::ScaleFactor desired_scale_factor, 672 ui::ScaleFactor desired_scale_factor,
665 const FaviconService::FaviconResultsCallback& callback, 673 const FaviconService::FaviconResultsCallback& callback,
666 CancelableTaskTracker* tracker) { 674 CancelableTaskTracker* tracker) {
667 DCHECK(thread_checker_.CalledOnValidThread()); 675 DCHECK(thread_checker_.CalledOnValidThread());
668 LoadBackendIfNecessary(); 676 LoadBackendIfNecessary();
669 677
670 std::vector<chrome::FaviconBitmapResult>* results = 678 std::vector<chrome::FaviconBitmapResult>* results =
671 new std::vector<chrome::FaviconBitmapResult>(); 679 new std::vector<chrome::FaviconBitmapResult>();
672 return tracker->PostTaskAndReply( 680 return tracker->PostTaskAndReply(
673 thread_->message_loop_proxy(), 681 thread_->message_loop_proxy().get(),
674 FROM_HERE, 682 FROM_HERE,
675 base::Bind(&HistoryBackend::GetFaviconForID, 683 base::Bind(&HistoryBackend::GetFaviconForID,
676 history_backend_.get(), favicon_id, 684 history_backend_.get(),
677 desired_size_in_dip, desired_scale_factor, results), 685 favicon_id,
686 desired_size_in_dip,
687 desired_scale_factor,
688 results),
678 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 689 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
679 } 690 }
680 691
681 CancelableTaskTracker::TaskId HistoryService::UpdateFaviconMappingsAndFetch( 692 CancelableTaskTracker::TaskId HistoryService::UpdateFaviconMappingsAndFetch(
682 const GURL& page_url, 693 const GURL& page_url,
683 const std::vector<GURL>& icon_urls, 694 const std::vector<GURL>& icon_urls,
684 int icon_types, 695 int icon_types,
685 int desired_size_in_dip, 696 int desired_size_in_dip,
686 const std::vector<ui::ScaleFactor>& desired_scale_factors, 697 const std::vector<ui::ScaleFactor>& desired_scale_factors,
687 const FaviconService::FaviconResultsCallback& callback, 698 const FaviconService::FaviconResultsCallback& callback,
688 CancelableTaskTracker* tracker) { 699 CancelableTaskTracker* tracker) {
689 DCHECK(thread_checker_.CalledOnValidThread()); 700 DCHECK(thread_checker_.CalledOnValidThread());
690 LoadBackendIfNecessary(); 701 LoadBackendIfNecessary();
691 702
692 std::vector<chrome::FaviconBitmapResult>* results = 703 std::vector<chrome::FaviconBitmapResult>* results =
693 new std::vector<chrome::FaviconBitmapResult>(); 704 new std::vector<chrome::FaviconBitmapResult>();
694 return tracker->PostTaskAndReply( 705 return tracker->PostTaskAndReply(
695 thread_->message_loop_proxy(), 706 thread_->message_loop_proxy().get(),
696 FROM_HERE, 707 FROM_HERE,
697 base::Bind(&HistoryBackend::UpdateFaviconMappingsAndFetch, 708 base::Bind(&HistoryBackend::UpdateFaviconMappingsAndFetch,
698 history_backend_.get(), page_url, icon_urls, icon_types, 709 history_backend_.get(),
699 desired_size_in_dip, desired_scale_factors, results), 710 page_url,
711 icon_urls,
712 icon_types,
713 desired_size_in_dip,
714 desired_scale_factors,
715 results),
700 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); 716 base::Bind(&RunWithFaviconResults, callback, base::Owned(results)));
701 } 717 }
702 718
703 void HistoryService::MergeFavicon( 719 void HistoryService::MergeFavicon(
704 const GURL& page_url, 720 const GURL& page_url,
705 const GURL& icon_url, 721 const GURL& icon_url,
706 chrome::IconType icon_type, 722 chrome::IconType icon_type,
707 scoped_refptr<base::RefCountedMemory> bitmap_data, 723 scoped_refptr<base::RefCountedMemory> bitmap_data,
708 const gfx::Size& pixel_size) { 724 const gfx::Size& pixel_size) {
709 DCHECK(thread_checker_.CalledOnValidThread()); 725 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1119
1104 void HistoryService::ExpireHistoryBetween( 1120 void HistoryService::ExpireHistoryBetween(
1105 const std::set<GURL>& restrict_urls, 1121 const std::set<GURL>& restrict_urls,
1106 Time begin_time, 1122 Time begin_time,
1107 Time end_time, 1123 Time end_time,
1108 const base::Closure& callback, 1124 const base::Closure& callback,
1109 CancelableTaskTracker* tracker) { 1125 CancelableTaskTracker* tracker) {
1110 DCHECK(thread_); 1126 DCHECK(thread_);
1111 DCHECK(thread_checker_.CalledOnValidThread()); 1127 DCHECK(thread_checker_.CalledOnValidThread());
1112 DCHECK(history_backend_.get()); 1128 DCHECK(history_backend_.get());
1113 tracker->PostTaskAndReply(thread_->message_loop_proxy(), 1129 tracker->PostTaskAndReply(thread_->message_loop_proxy().get(),
1114 FROM_HERE, 1130 FROM_HERE,
1115 base::Bind(&HistoryBackend::ExpireHistoryBetween, 1131 base::Bind(&HistoryBackend::ExpireHistoryBetween,
1116 history_backend_, 1132 history_backend_,
1117 restrict_urls, 1133 restrict_urls,
1118 begin_time, 1134 begin_time,
1119 end_time), 1135 end_time),
1120 callback); 1136 callback);
1121 } 1137 }
1122 1138
1123 void HistoryService::ExpireHistory( 1139 void HistoryService::ExpireHistory(
1124 const std::vector<history::ExpireHistoryArgs>& expire_list, 1140 const std::vector<history::ExpireHistoryArgs>& expire_list,
1125 const base::Closure& callback, 1141 const base::Closure& callback,
1126 CancelableTaskTracker* tracker) { 1142 CancelableTaskTracker* tracker) {
1127 DCHECK(thread_); 1143 DCHECK(thread_);
1128 DCHECK(thread_checker_.CalledOnValidThread()); 1144 DCHECK(thread_checker_.CalledOnValidThread());
1129 DCHECK(history_backend_.get()); 1145 DCHECK(history_backend_.get());
1130 tracker->PostTaskAndReply( 1146 tracker->PostTaskAndReply(
1131 thread_->message_loop_proxy(), 1147 thread_->message_loop_proxy().get(),
1132 FROM_HERE, 1148 FROM_HERE,
1133 base::Bind(&HistoryBackend::ExpireHistory, history_backend_, expire_list), 1149 base::Bind(&HistoryBackend::ExpireHistory, history_backend_, expire_list),
1134 callback); 1150 callback);
1135 } 1151 }
1136 1152
1137 void HistoryService::ExpireLocalAndRemoteHistoryBetween( 1153 void HistoryService::ExpireLocalAndRemoteHistoryBetween(
1138 const std::set<GURL>& restrict_urls, 1154 const std::set<GURL>& restrict_urls,
1139 Time begin_time, 1155 Time begin_time,
1140 Time end_time, 1156 Time end_time,
1141 const base::Closure& callback, 1157 const base::Closure& callback,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 DCHECK(thread_checker_.CalledOnValidThread()); 1289 DCHECK(thread_checker_.CalledOnValidThread());
1274 visit_database_observers_.RemoveObserver(observer); 1290 visit_database_observers_.RemoveObserver(observer);
1275 } 1291 }
1276 1292
1277 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1293 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1278 const history::BriefVisitInfo& info) { 1294 const history::BriefVisitInfo& info) {
1279 DCHECK(thread_checker_.CalledOnValidThread()); 1295 DCHECK(thread_checker_.CalledOnValidThread());
1280 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1296 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1281 OnAddVisit(info)); 1297 OnAddVisit(info));
1282 } 1298 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/shortcuts_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698