| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 void HistoryService::TopHosts(size_t num_hosts, | 361 void HistoryService::TopHosts(size_t num_hosts, |
| 362 const TopHostsCallback& callback) const { | 362 const TopHostsCallback& callback) const { |
| 363 DCHECK(thread_) << "History service being called after cleanup"; | 363 DCHECK(thread_) << "History service being called after cleanup"; |
| 364 DCHECK(thread_checker_.CalledOnValidThread()); | 364 DCHECK(thread_checker_.CalledOnValidThread()); |
| 365 PostTaskAndReplyWithResult( | 365 PostTaskAndReplyWithResult( |
| 366 thread_->task_runner().get(), FROM_HERE, | 366 thread_->task_runner().get(), FROM_HERE, |
| 367 base::Bind(&HistoryBackend::TopHosts, history_backend_.get(), num_hosts), | 367 base::Bind(&HistoryBackend::TopHosts, history_backend_.get(), num_hosts), |
| 368 callback); | 368 callback); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void HistoryService::GetCountsForOrigins( | 371 void HistoryService::GetCountsAndLastVisitForOrigins( |
| 372 const std::set<GURL>& origins, | 372 const std::set<GURL>& origins, |
| 373 const GetCountsForOriginsCallback& callback) const { | 373 const GetCountsAndLastVisitForOriginsCallback& callback) const { |
| 374 DCHECK(thread_) << "History service being called after cleanup"; | 374 DCHECK(thread_) << "History service being called after cleanup"; |
| 375 DCHECK(thread_checker_.CalledOnValidThread()); | 375 DCHECK(thread_checker_.CalledOnValidThread()); |
| 376 PostTaskAndReplyWithResult(thread_->task_runner().get(), FROM_HERE, | 376 PostTaskAndReplyWithResult( |
| 377 base::Bind(&HistoryBackend::GetCountsForOrigins, | 377 thread_->task_runner().get(), FROM_HERE, |
| 378 history_backend_.get(), origins), | 378 base::Bind(&HistoryBackend::GetCountsAndLastVisitForOrigins, |
| 379 callback); | 379 history_backend_.get(), origins), |
| 380 callback); |
| 380 } | 381 } |
| 381 | 382 |
| 382 void HistoryService::HostRankIfAvailable( | 383 void HistoryService::HostRankIfAvailable( |
| 383 const GURL& url, | 384 const GURL& url, |
| 384 const base::Callback<void(int)>& callback) const { | 385 const base::Callback<void(int)>& callback) const { |
| 385 DCHECK(thread_) << "History service being called after cleanup"; | 386 DCHECK(thread_) << "History service being called after cleanup"; |
| 386 DCHECK(thread_checker_.CalledOnValidThread()); | 387 DCHECK(thread_checker_.CalledOnValidThread()); |
| 387 PostTaskAndReplyWithResult(thread_->task_runner().get(), FROM_HERE, | 388 PostTaskAndReplyWithResult(thread_->task_runner().get(), FROM_HERE, |
| 388 base::Bind(&HistoryBackend::HostRankIfAvailable, | 389 base::Bind(&HistoryBackend::HostRankIfAvailable, |
| 389 history_backend_.get(), url), | 390 history_backend_.get(), url), |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 return favicon_changed_callback_list_.Add(callback); | 1165 return favicon_changed_callback_list_.Add(callback); |
| 1165 } | 1166 } |
| 1166 | 1167 |
| 1167 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1168 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1168 const GURL& icon_url) { | 1169 const GURL& icon_url) { |
| 1169 DCHECK(thread_checker_.CalledOnValidThread()); | 1170 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1170 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1171 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1171 } | 1172 } |
| 1172 | 1173 |
| 1173 } // namespace history | 1174 } // namespace history |
| OLD | NEW |