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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword, | 371 ScheduleAndForget(PRIORITY_UI, &HistoryBackend::DeleteMatchingURLsForKeyword, |
372 keyword_id, term); | 372 keyword_id, term); |
373 } | 373 } |
374 | 374 |
375 void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) { | 375 void HistoryService::URLsNoLongerBookmarked(const std::set<GURL>& urls) { |
376 DCHECK(thread_checker_.CalledOnValidThread()); | 376 DCHECK(thread_checker_.CalledOnValidThread()); |
377 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::URLsNoLongerBookmarked, | 377 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::URLsNoLongerBookmarked, |
378 urls); | 378 urls); |
379 } | 379 } |
380 | 380 |
381 void HistoryService::ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task, | 381 void HistoryService::ScheduleDBTask(scoped_refptr<history::HistoryDBTask> task, |
382 base::CancelableTaskTracker* tracker) { | 382 base::CancelableTaskTracker* tracker) { |
383 DCHECK(thread_checker_.CalledOnValidThread()); | 383 DCHECK(thread_checker_.CalledOnValidThread()); |
384 base::CancelableTaskTracker::IsCanceledCallback is_canceled; | 384 base::CancelableTaskTracker::IsCanceledCallback is_canceled; |
385 tracker->NewTrackedTaskId(&is_canceled); | 385 tracker->NewTrackedTaskId(&is_canceled); |
386 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to | 386 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to |
387 // the current message loop so that we can forward the call to the method | 387 // the current message loop so that we can forward the call to the method |
388 // HistoryDBTask::DoneRunOnMainThread in the correct thread. | 388 // HistoryDBTask::DoneRunOnMainThread in the correct thread. |
389 thread_->message_loop_proxy()->PostTask( | 389 thread_->message_loop_proxy()->PostTask( |
390 FROM_HERE, | 390 FROM_HERE, |
391 base::Bind(&HistoryBackend::ProcessDBTask, | 391 base::Bind(&HistoryBackend::ProcessDBTask, |
392 history_backend_.get(), | 392 history_backend_.get(), |
393 base::Passed(&task), | 393 task, |
394 base::ThreadTaskRunnerHandle::Get(), | 394 base::ThreadTaskRunnerHandle::Get(), |
395 is_canceled)); | 395 is_canceled)); |
396 } | 396 } |
397 | 397 |
398 void HistoryService::FlushForTest(const base::Closure& flushed) { | 398 void HistoryService::FlushForTest(const base::Closure& flushed) { |
399 thread_->message_loop_proxy()->PostTaskAndReply( | 399 thread_->message_loop_proxy()->PostTaskAndReply( |
400 FROM_HERE, base::Bind(&base::DoNothing), flushed); | 400 FROM_HERE, base::Bind(&base::DoNothing), flushed); |
401 } | 401 } |
402 | 402 |
403 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { | 403 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 DCHECK(thread_checker_.CalledOnValidThread()); | 1194 DCHECK(thread_checker_.CalledOnValidThread()); |
1195 visit_database_observers_.RemoveObserver(observer); | 1195 visit_database_observers_.RemoveObserver(observer); |
1196 } | 1196 } |
1197 | 1197 |
1198 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1198 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
1199 const history::BriefVisitInfo& info) { | 1199 const history::BriefVisitInfo& info) { |
1200 DCHECK(thread_checker_.CalledOnValidThread()); | 1200 DCHECK(thread_checker_.CalledOnValidThread()); |
1201 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1201 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
1202 OnAddVisit(info)); | 1202 OnAddVisit(info)); |
1203 } | 1203 } |
OLD | NEW |