Chromium Code Reviews| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword, | 369 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword, |
| 370 keyword_id, term); | 370 keyword_id, term); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) { | 373 void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) { |
| 374 DCHECK(thread_checker_.CalledOnValidThread()); | 374 DCHECK(thread_checker_.CalledOnValidThread()); |
| 375 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::URLsNoLongerBookmarked, | 375 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::URLsNoLongerBookmarked, |
| 376 urls); | 376 urls); |
| 377 } | 377 } |
| 378 | 378 |
| 379 void HistoryService::ScheduleDBTask(history::HistoryDBTask* task, | 379 void HistoryService::ScheduleDBTask(scoped_refptr<history::HistoryDBTask> task, |
| 380 CancelableRequestConsumerBase* consumer) { | 380 base::CancelableTaskTracker* tracker) { |
| 381 DCHECK(thread_checker_.CalledOnValidThread()); | 381 DCHECK(thread_checker_.CalledOnValidThread()); |
| 382 history::HistoryDBTaskRequest* request = new history::HistoryDBTaskRequest( | 382 base::CancelableTaskTracker::IsCanceledCallback is_canceled; |
| 383 base::Bind(&history::HistoryDBTask::DoneRunOnMainThread, task)); | 383 tracker->NewTrackedTaskId(&is_canceled); |
| 384 request->value = task; // The value is the task to execute. | 384 thread_->message_loop_proxy()->PostTask( |
| 385 Schedule(PRIORITY_UI, &HistoryBackend::ProcessDBTask, consumer, request); | 385 FROM_HERE, |
| 386 base::Bind(&HistoryBackend::ProcessDBTask, | |
| 387 history_backend_.get(), | |
| 388 task, | |
| 389 base::ThreadTaskRunnerHandle::Get(), | |
|
blundell
2014/06/26 09:55:39
Could you explain this parameter?
sdefresne
2014/06/28 08:14:26
Done.
| |
| 390 is_canceled)); | |
| 386 } | 391 } |
| 387 | 392 |
| 388 void HistoryService::FlushForTest(const base::Closure& flushed) { | 393 void HistoryService::FlushForTest(const base::Closure& flushed) { |
| 389 thread_->message_loop_proxy()->PostTaskAndReply( | 394 thread_->message_loop_proxy()->PostTaskAndReply( |
| 390 FROM_HERE, base::Bind(&base::DoNothing), flushed); | 395 FROM_HERE, base::Bind(&base::DoNothing), flushed); |
| 391 } | 396 } |
| 392 | 397 |
| 393 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { | 398 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { |
| 394 DCHECK(thread_checker_.CalledOnValidThread()); | 399 DCHECK(thread_checker_.CalledOnValidThread()); |
| 395 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetOnBackendDestroyTask, | 400 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetOnBackendDestroyTask, |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1187 DCHECK(thread_checker_.CalledOnValidThread()); | 1192 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1188 visit_database_observers_.RemoveObserver(observer); | 1193 visit_database_observers_.RemoveObserver(observer); |
| 1189 } | 1194 } |
| 1190 | 1195 |
| 1191 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1196 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1192 const history::BriefVisitInfo& info) { | 1197 const history::BriefVisitInfo& info) { |
| 1193 DCHECK(thread_checker_.CalledOnValidThread()); | 1198 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1194 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1199 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1195 OnAddVisit(info)); | 1200 OnAddVisit(info)); |
| 1196 } | 1201 } |
| OLD | NEW |