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

Side by Side Diff: components/history/core/browser/history_service.cc

Issue 2856873002: [Thumbnails DB] Allow setting last_requested time when accessing favicons. (Closed)
Patch Set: Peter's comments Created 3 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
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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 618 DCHECK(backend_task_runner_) << "History service being called after cleanup";
619 DCHECK(thread_checker_.CalledOnValidThread()); 619 DCHECK(thread_checker_.CalledOnValidThread());
620 if (history_client_ && !history_client_->CanAddURL(page_url)) 620 if (history_client_ && !history_client_->CanAddURL(page_url))
621 return; 621 return;
622 622
623 ScheduleTask(PRIORITY_NORMAL, 623 ScheduleTask(PRIORITY_NORMAL,
624 base::Bind(&HistoryBackend::SetFavicons, history_backend_, 624 base::Bind(&HistoryBackend::SetFavicons, history_backend_,
625 page_url, icon_type, icon_url, bitmaps)); 625 page_url, icon_type, icon_url, bitmaps));
626 } 626 }
627 627
628 void HistoryService::SetLastResortFavicons( 628 void HistoryService::SetOnDemandFavicons(const GURL& page_url,
629 const GURL& page_url, 629 favicon_base::IconType icon_type,
630 favicon_base::IconType icon_type, 630 const GURL& icon_url,
631 const GURL& icon_url, 631 const std::vector<SkBitmap>& bitmaps,
632 const std::vector<SkBitmap>& bitmaps, 632 base::Callback<void(bool)> callback) {
633 base::Callback<void(bool)> callback) {
634 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 633 DCHECK(backend_task_runner_) << "History service being called after cleanup";
635 DCHECK(thread_checker_.CalledOnValidThread()); 634 DCHECK(thread_checker_.CalledOnValidThread());
636 if (history_client_ && !history_client_->CanAddURL(page_url)) 635 if (history_client_ && !history_client_->CanAddURL(page_url))
637 return; 636 return;
638 637
639 PostTaskAndReplyWithResult( 638 PostTaskAndReplyWithResult(
640 backend_task_runner_.get(), FROM_HERE, 639 backend_task_runner_.get(), FROM_HERE,
641 base::Bind(&HistoryBackend::SetLastResortFavicons, history_backend_, 640 base::Bind(&HistoryBackend::SetOnDemandFavicons, history_backend_,
642 page_url, icon_type, icon_url, bitmaps), 641 page_url, icon_type, icon_url, bitmaps),
643 callback); 642 callback);
644 } 643 }
645 644
646 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) { 645 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) {
647 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 646 DCHECK(backend_task_runner_) << "History service being called after cleanup";
648 DCHECK(thread_checker_.CalledOnValidThread()); 647 DCHECK(thread_checker_.CalledOnValidThread());
649 ScheduleTask(PRIORITY_NORMAL, 648 ScheduleTask(PRIORITY_NORMAL,
650 base::Bind(&HistoryBackend::SetFaviconsOutOfDateForPage, 649 base::Bind(&HistoryBackend::SetFaviconsOutOfDateForPage,
651 history_backend_, page_url)); 650 history_backend_, page_url));
652 } 651 }
653 652
653 void HistoryService::TouchOnDemandFavicon(const GURL& icon_url) {
654 DCHECK(backend_task_runner_) << "History service being called after cleanup";
655 DCHECK(thread_checker_.CalledOnValidThread());
656 ScheduleTask(PRIORITY_NORMAL,
657 base::Bind(&HistoryBackend::TouchOnDemandFavicon,
658 history_backend_, icon_url));
659 }
660
654 void HistoryService::SetImportedFavicons( 661 void HistoryService::SetImportedFavicons(
655 const favicon_base::FaviconUsageDataList& favicon_usage) { 662 const favicon_base::FaviconUsageDataList& favicon_usage) {
656 DCHECK(backend_task_runner_) << "History service being called after cleanup"; 663 DCHECK(backend_task_runner_) << "History service being called after cleanup";
657 DCHECK(thread_checker_.CalledOnValidThread()); 664 DCHECK(thread_checker_.CalledOnValidThread());
658 ScheduleTask(PRIORITY_NORMAL, 665 ScheduleTask(PRIORITY_NORMAL,
659 base::Bind(&HistoryBackend::SetImportedFavicons, 666 base::Bind(&HistoryBackend::SetImportedFavicons,
660 history_backend_, favicon_usage)); 667 history_backend_, favicon_usage));
661 } 668 }
662 669
663 base::CancelableTaskTracker::TaskId HistoryService::QueryURL( 670 base::CancelableTaskTracker::TaskId HistoryService::QueryURL(
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 return favicon_changed_callback_list_.Add(callback); 1197 return favicon_changed_callback_list_.Add(callback);
1191 } 1198 }
1192 1199
1193 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1200 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1194 const GURL& icon_url) { 1201 const GURL& icon_url) {
1195 DCHECK(thread_checker_.CalledOnValidThread()); 1202 DCHECK(thread_checker_.CalledOnValidThread());
1196 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1203 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1197 } 1204 }
1198 1205
1199 } // namespace history 1206 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | components/history/core/browser/history_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698