| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 DCHECK(backend_task_runner_) << "History service being called after cleanup"; | 614 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| 615 DCHECK(thread_checker_.CalledOnValidThread()); | 615 DCHECK(thread_checker_.CalledOnValidThread()); |
| 616 if (history_client_ && !history_client_->CanAddURL(page_url)) | 616 if (history_client_ && !history_client_->CanAddURL(page_url)) |
| 617 return; | 617 return; |
| 618 | 618 |
| 619 ScheduleTask(PRIORITY_NORMAL, | 619 ScheduleTask(PRIORITY_NORMAL, |
| 620 base::Bind(&HistoryBackend::SetFavicons, history_backend_, | 620 base::Bind(&HistoryBackend::SetFavicons, history_backend_, |
| 621 page_url, icon_type, icon_url, bitmaps)); | 621 page_url, icon_type, icon_url, bitmaps)); |
| 622 } | 622 } |
| 623 | 623 |
| 624 void HistoryService::SetLastResortFavicons( |
| 625 const GURL& page_url, |
| 626 favicon_base::IconType icon_type, |
| 627 const GURL& icon_url, |
| 628 const std::vector<SkBitmap>& bitmaps, |
| 629 base::Callback<void(bool)> callback) { |
| 630 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| 631 DCHECK(thread_checker_.CalledOnValidThread()); |
| 632 if (history_client_ && !history_client_->CanAddURL(page_url)) |
| 633 return; |
| 634 |
| 635 PostTaskAndReplyWithResult( |
| 636 FROM_HERE, |
| 637 base::Bind(&HistoryBackend::SetLastResortFavicons, history_backend_, |
| 638 page_url, icon_type, icon_url, bitmaps), |
| 639 callback); |
| 640 } |
| 641 |
| 624 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) { | 642 void HistoryService::SetFaviconsOutOfDateForPage(const GURL& page_url) { |
| 625 DCHECK(backend_task_runner_) << "History service being called after cleanup"; | 643 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| 626 DCHECK(thread_checker_.CalledOnValidThread()); | 644 DCHECK(thread_checker_.CalledOnValidThread()); |
| 627 ScheduleTask(PRIORITY_NORMAL, | 645 ScheduleTask(PRIORITY_NORMAL, |
| 628 base::Bind(&HistoryBackend::SetFaviconsOutOfDateForPage, | 646 base::Bind(&HistoryBackend::SetFaviconsOutOfDateForPage, |
| 629 history_backend_, page_url)); | 647 history_backend_, page_url)); |
| 630 } | 648 } |
| 631 | 649 |
| 632 void HistoryService::SetImportedFavicons( | 650 void HistoryService::SetImportedFavicons( |
| 633 const favicon_base::FaviconUsageDataList& favicon_usage) { | 651 const favicon_base::FaviconUsageDataList& favicon_usage) { |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 return favicon_changed_callback_list_.Add(callback); | 1163 return favicon_changed_callback_list_.Add(callback); |
| 1146 } | 1164 } |
| 1147 | 1165 |
| 1148 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1166 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1149 const GURL& icon_url) { | 1167 const GURL& icon_url) { |
| 1150 DCHECK(thread_checker_.CalledOnValidThread()); | 1168 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1151 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1169 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1152 } | 1170 } |
| 1153 | 1171 |
| 1154 } // namespace history | 1172 } // namespace history |
| OLD | NEW |