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

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

Issue 1345473003: Added HistoryService::GetHistoryCount() and helper functions in components/history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 DCHECK(thread_checker_.CalledOnValidThread()); 660 DCHECK(thread_checker_.CalledOnValidThread());
661 QueryURLResult* query_url_result = new QueryURLResult(); 661 QueryURLResult* query_url_result = new QueryURLResult();
662 return tracker->PostTaskAndReply( 662 return tracker->PostTaskAndReply(
663 after_startup_task_runner_.get(), FROM_HERE, 663 after_startup_task_runner_.get(), FROM_HERE,
664 base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url, 664 base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url,
665 want_visits, base::Unretained(query_url_result)), 665 want_visits, base::Unretained(query_url_result)),
666 base::Bind(&RunWithQueryURLResult, callback, 666 base::Bind(&RunWithQueryURLResult, callback,
667 base::Owned(query_url_result))); 667 base::Owned(query_url_result)));
668 } 668 }
669 669
670 // Statistics ------------------------------------------------------------------
msramek 2015/09/14 17:28:16 nit: Empty line after "---" comment.
lwchkg 2015/09/15 14:27:08 Acknowledged.
671 base::CancelableTaskTracker::TaskId HistoryService::GetHistoryCount(
672 const GetHistoryCountCallback& callback,
673 base::CancelableTaskTracker* tracker) {
674 DCHECK(thread_) << "History service being called after cleanup";
675 DCHECK(thread_checker_.CalledOnValidThread());
676
677 return tracker->PostTaskAndReplyWithResult(
678 thread_->task_runner().get(), FROM_HERE,
679 base::Bind(&HistoryBackend::GetHistoryCount, history_backend_.get()),
680 callback);
681 }
682
670 // Downloads ------------------------------------------------------------------- 683 // Downloads -------------------------------------------------------------------
671 684
672 // Handle creation of a download by creating an entry in the history service's 685 // Handle creation of a download by creating an entry in the history service's
673 // 'downloads' table. 686 // 'downloads' table.
674 void HistoryService::CreateDownload( 687 void HistoryService::CreateDownload(
675 const DownloadRow& create_info, 688 const DownloadRow& create_info,
676 const HistoryService::DownloadCreateCallback& callback) { 689 const HistoryService::DownloadCreateCallback& callback) {
677 DCHECK(thread_) << "History service being called after cleanup"; 690 DCHECK(thread_) << "History service being called after cleanup";
678 DCHECK(thread_checker_.CalledOnValidThread()); 691 DCHECK(thread_checker_.CalledOnValidThread());
679 PostTaskAndReplyWithResult(after_startup_task_runner_.get(), FROM_HERE, 692 PostTaskAndReplyWithResult(after_startup_task_runner_.get(), FROM_HERE,
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 return favicon_changed_callback_list_.Add(callback); 1185 return favicon_changed_callback_list_.Add(callback);
1173 } 1186 }
1174 1187
1175 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1188 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1176 const GURL& icon_url) { 1189 const GURL& icon_url) {
1177 DCHECK(thread_checker_.CalledOnValidThread()); 1190 DCHECK(thread_checker_.CalledOnValidThread());
1178 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1191 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1179 } 1192 }
1180 1193
1181 } // namespace history 1194 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698