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

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: erase Closure* Created 3 years, 8 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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 } 926 }
927 927
928 void HistoryService::ScheduleAutocomplete( 928 void HistoryService::ScheduleAutocomplete(
929 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback) { 929 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback) {
930 DCHECK(thread_checker_.CalledOnValidThread()); 930 DCHECK(thread_checker_.CalledOnValidThread());
931 ScheduleTask(PRIORITY_UI, base::Bind(&HistoryBackend::ScheduleAutocomplete, 931 ScheduleTask(PRIORITY_UI, base::Bind(&HistoryBackend::ScheduleAutocomplete,
932 history_backend_, callback)); 932 history_backend_, callback));
933 } 933 }
934 934
935 void HistoryService::ScheduleTask(SchedulePriority priority, 935 void HistoryService::ScheduleTask(SchedulePriority priority,
936 const base::Closure& task) { 936 base::Closure task) {
937 DCHECK(thread_checker_.CalledOnValidThread()); 937 DCHECK(thread_checker_.CalledOnValidThread());
938 CHECK(backend_task_runner_); 938 CHECK(backend_task_runner_);
939 // TODO(brettw): Do prioritization. 939 // TODO(brettw): Do prioritization.
940 backend_task_runner_->PostTask(FROM_HERE, task); 940 backend_task_runner_->PostTask(FROM_HERE, std::move(task));
941 } 941 }
942 942
943 base::WeakPtr<HistoryService> HistoryService::AsWeakPtr() { 943 base::WeakPtr<HistoryService> HistoryService::AsWeakPtr() {
944 DCHECK(thread_checker_.CalledOnValidThread()); 944 DCHECK(thread_checker_.CalledOnValidThread());
945 return weak_ptr_factory_.GetWeakPtr(); 945 return weak_ptr_factory_.GetWeakPtr();
946 } 946 }
947 947
948 syncer::SyncMergeResult HistoryService::MergeDataAndStartSyncing( 948 syncer::SyncMergeResult HistoryService::MergeDataAndStartSyncing(
949 syncer::ModelType type, 949 syncer::ModelType type,
950 const syncer::SyncDataList& initial_sync_data, 950 const syncer::SyncDataList& initial_sync_data,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 return favicon_changed_callback_list_.Add(callback); 1163 return favicon_changed_callback_list_.Add(callback);
1164 } 1164 }
1165 1165
1166 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1166 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1167 const GURL& icon_url) { 1167 const GURL& icon_url) {
1168 DCHECK(thread_checker_.CalledOnValidThread()); 1168 DCHECK(thread_checker_.CalledOnValidThread());
1169 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1169 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1170 } 1170 }
1171 1171
1172 } // namespace history 1172 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | components/memory_pressure/memory_pressure_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698