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

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

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: . Created 3 years, 9 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 908 }
909 909
910 void HistoryService::ScheduleAutocomplete( 910 void HistoryService::ScheduleAutocomplete(
911 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback) { 911 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback) {
912 DCHECK(thread_checker_.CalledOnValidThread()); 912 DCHECK(thread_checker_.CalledOnValidThread());
913 ScheduleTask(PRIORITY_UI, base::Bind(&HistoryBackend::ScheduleAutocomplete, 913 ScheduleTask(PRIORITY_UI, base::Bind(&HistoryBackend::ScheduleAutocomplete,
914 history_backend_, callback)); 914 history_backend_, callback));
915 } 915 }
916 916
917 void HistoryService::ScheduleTask(SchedulePriority priority, 917 void HistoryService::ScheduleTask(SchedulePriority priority,
918 const base::Closure& task) { 918 base::Closure task) {
919 DCHECK(thread_checker_.CalledOnValidThread()); 919 DCHECK(thread_checker_.CalledOnValidThread());
920 CHECK(backend_task_runner_); 920 CHECK(backend_task_runner_);
921 // TODO(brettw): Do prioritization. 921 // TODO(brettw): Do prioritization.
922 backend_task_runner_->PostTask(FROM_HERE, task); 922 backend_task_runner_->PostTask(FROM_HERE, std::move(task));
923 } 923 }
924 924
925 base::WeakPtr<HistoryService> HistoryService::AsWeakPtr() { 925 base::WeakPtr<HistoryService> HistoryService::AsWeakPtr() {
926 DCHECK(thread_checker_.CalledOnValidThread()); 926 DCHECK(thread_checker_.CalledOnValidThread());
927 return weak_ptr_factory_.GetWeakPtr(); 927 return weak_ptr_factory_.GetWeakPtr();
928 } 928 }
929 929
930 syncer::SyncMergeResult HistoryService::MergeDataAndStartSyncing( 930 syncer::SyncMergeResult HistoryService::MergeDataAndStartSyncing(
931 syncer::ModelType type, 931 syncer::ModelType type,
932 const syncer::SyncDataList& initial_sync_data, 932 const syncer::SyncDataList& initial_sync_data,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 return favicon_changed_callback_list_.Add(callback); 1145 return favicon_changed_callback_list_.Add(callback);
1146 } 1146 }
1147 1147
1148 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1148 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1149 const GURL& icon_url) { 1149 const GURL& icon_url) {
1150 DCHECK(thread_checker_.CalledOnValidThread()); 1150 DCHECK(thread_checker_.CalledOnValidThread());
1151 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1151 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1152 } 1152 }
1153 1153
1154 } // namespace history 1154 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698