| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 CancelableRequestConsumerBase* consumer, | 436 CancelableRequestConsumerBase* consumer, |
| 437 const Time from_time, | 437 const Time from_time, |
| 438 int max_result_count, | 438 int max_result_count, |
| 439 const SegmentQueryCallback& callback) { | 439 const SegmentQueryCallback& callback) { |
| 440 DCHECK(thread_checker_.CalledOnValidThread()); | 440 DCHECK(thread_checker_.CalledOnValidThread()); |
| 441 return Schedule(PRIORITY_UI, &HistoryBackend::QuerySegmentUsage, | 441 return Schedule(PRIORITY_UI, &HistoryBackend::QuerySegmentUsage, |
| 442 consumer, new history::QuerySegmentUsageRequest(callback), | 442 consumer, new history::QuerySegmentUsageRequest(callback), |
| 443 from_time, max_result_count); | 443 from_time, max_result_count); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void HistoryService::IncreaseSegmentDuration(const GURL& url, | |
| 447 Time time, | |
| 448 base::TimeDelta delta) { | |
| 449 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 450 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::IncreaseSegmentDuration, | |
| 451 url, time, delta); | |
| 452 } | |
| 453 | |
| 454 HistoryService::Handle HistoryService::QuerySegmentDurationSince( | |
| 455 CancelableRequestConsumerBase* consumer, | |
| 456 base::Time from_time, | |
| 457 int max_result_count, | |
| 458 const SegmentQueryCallback& callback) { | |
| 459 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 460 return Schedule(PRIORITY_UI, &HistoryBackend::QuerySegmentDuration, | |
| 461 consumer, new history::QuerySegmentUsageRequest(callback), | |
| 462 from_time, max_result_count); | |
| 463 } | |
| 464 | |
| 465 void HistoryService::FlushForTest(const base::Closure& flushed) { | 446 void HistoryService::FlushForTest(const base::Closure& flushed) { |
| 466 thread_->message_loop_proxy()->PostTaskAndReply( | 447 thread_->message_loop_proxy()->PostTaskAndReply( |
| 467 FROM_HERE, base::Bind(&base::DoNothing), flushed); | 448 FROM_HERE, base::Bind(&base::DoNothing), flushed); |
| 468 } | 449 } |
| 469 | 450 |
| 470 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { | 451 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { |
| 471 DCHECK(thread_checker_.CalledOnValidThread()); | 452 DCHECK(thread_checker_.CalledOnValidThread()); |
| 472 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetOnBackendDestroyTask, | 453 ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetOnBackendDestroyTask, |
| 473 base::MessageLoop::current(), task); | 454 base::MessageLoop::current(), task); |
| 474 } | 455 } |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 DCHECK(thread_checker_.CalledOnValidThread()); | 1253 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1273 visit_database_observers_.RemoveObserver(observer); | 1254 visit_database_observers_.RemoveObserver(observer); |
| 1274 } | 1255 } |
| 1275 | 1256 |
| 1276 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1257 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1277 const history::BriefVisitInfo& info) { | 1258 const history::BriefVisitInfo& info) { |
| 1278 DCHECK(thread_checker_.CalledOnValidThread()); | 1259 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1279 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1260 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1280 OnAddVisit(info)); | 1261 OnAddVisit(info)); |
| 1281 } | 1262 } |
| OLD | NEW |