| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 new std::vector<favicon_base::FaviconRawBitmapResult>(); | 533 new std::vector<favicon_base::FaviconRawBitmapResult>(); |
| 534 return tracker->PostTaskAndReply( | 534 return tracker->PostTaskAndReply( |
| 535 backend_task_runner_.get(), FROM_HERE, | 535 backend_task_runner_.get(), FROM_HERE, |
| 536 base::Bind(&HistoryBackend::GetFaviconsForURL, history_backend_, page_url, | 536 base::Bind(&HistoryBackend::GetFaviconsForURL, history_backend_, page_url, |
| 537 icon_types, desired_sizes, results), | 537 icon_types, desired_sizes, results), |
| 538 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); | 538 base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); |
| 539 } | 539 } |
| 540 | 540 |
| 541 base::CancelableTaskTracker::TaskId HistoryService::GetLargestFaviconForURL( | 541 base::CancelableTaskTracker::TaskId HistoryService::GetLargestFaviconForURL( |
| 542 const GURL& page_url, | 542 const GURL& page_url, |
| 543 const std::vector<int>& icon_types, | |
| 544 int minimum_size_in_pixels, | |
| 545 const favicon_base::FaviconRawBitmapCallback& callback, | 543 const favicon_base::FaviconRawBitmapCallback& callback, |
| 546 base::CancelableTaskTracker* tracker) { | 544 base::CancelableTaskTracker* tracker) { |
| 547 DCHECK(backend_task_runner_) << "History service being called after cleanup"; | 545 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| 548 DCHECK(thread_checker_.CalledOnValidThread()); | 546 DCHECK(thread_checker_.CalledOnValidThread()); |
| 549 favicon_base::FaviconRawBitmapResult* result = | 547 favicon_base::FaviconRawBitmapResult* result = |
| 550 new favicon_base::FaviconRawBitmapResult(); | 548 new favicon_base::FaviconRawBitmapResult(); |
| 551 return tracker->PostTaskAndReply( | 549 return tracker->PostTaskAndReply( |
| 552 backend_task_runner_.get(), FROM_HERE, | 550 backend_task_runner_.get(), FROM_HERE, |
| 553 base::Bind(&HistoryBackend::GetLargestFaviconForURL, history_backend_, | 551 base::Bind(&HistoryBackend::GetLargestFaviconForURL, history_backend_, |
| 554 page_url, icon_types, minimum_size_in_pixels, result), | 552 page_url, result), |
| 555 base::Bind(&RunWithFaviconResult, callback, base::Owned(result))); | 553 base::Bind(&RunWithFaviconResult, callback, base::Owned(result))); |
| 556 } | 554 } |
| 557 | 555 |
| 558 base::CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( | 556 base::CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( |
| 559 favicon_base::FaviconID favicon_id, | 557 favicon_base::FaviconID favicon_id, |
| 560 int desired_size, | 558 int desired_size, |
| 561 const favicon_base::FaviconResultsCallback& callback, | 559 const favicon_base::FaviconResultsCallback& callback, |
| 562 base::CancelableTaskTracker* tracker) { | 560 base::CancelableTaskTracker* tracker) { |
| 563 TRACE_EVENT0("browser", "HistoryService::GetFaviconForID"); | 561 TRACE_EVENT0("browser", "HistoryService::GetFaviconForID"); |
| 564 DCHECK(backend_task_runner_) << "History service being called after cleanup"; | 562 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 return favicon_changed_callback_list_.Add(callback); | 1165 return favicon_changed_callback_list_.Add(callback); |
| 1168 } | 1166 } |
| 1169 | 1167 |
| 1170 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1168 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1171 const GURL& icon_url) { | 1169 const GURL& icon_url) { |
| 1172 DCHECK(thread_checker_.CalledOnValidThread()); | 1170 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1173 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1171 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1174 } | 1172 } |
| 1175 | 1173 |
| 1176 } // namespace history | 1174 } // namespace history |
| OLD | NEW |