| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 bool HistoryService::GetVisitCountForURL(const GURL& url, int* visit_count) { | 356 bool HistoryService::GetVisitCountForURL(const GURL& url, int* visit_count) { |
| 357 DCHECK(thread_checker_.CalledOnValidThread()); | 357 DCHECK(thread_checker_.CalledOnValidThread()); |
| 358 history::URLRow url_row; | 358 history::URLRow url_row; |
| 359 if (!GetRowForURL(url, &url_row)) | 359 if (!GetRowForURL(url, &url_row)) |
| 360 return false; | 360 return false; |
| 361 *visit_count = url_row.visit_count(); | 361 *visit_count = url_row.visit_count(); |
| 362 return true; | 362 return true; |
| 363 } | 363 } |
| 364 | 364 |
| 365 history::TypedUrlSyncableService* HistoryService::GetTypedUrlSyncableService() |
| 366 const { |
| 367 return history_backend_->GetTypedUrlSyncableService(); |
| 368 } |
| 369 |
| 365 void HistoryService::Shutdown() { | 370 void HistoryService::Shutdown() { |
| 366 DCHECK(thread_checker_.CalledOnValidThread()); | 371 DCHECK(thread_checker_.CalledOnValidThread()); |
| 367 // It's possible that bookmarks haven't loaded and history is waiting for | 372 // It's possible that bookmarks haven't loaded and history is waiting for |
| 368 // bookmarks to complete loading. In such a situation history can't shutdown | 373 // bookmarks to complete loading. In such a situation history can't shutdown |
| 369 // (meaning if we invoked history_service_->Cleanup now, we would | 374 // (meaning if we invoked history_service_->Cleanup now, we would |
| 370 // deadlock). To break the deadlock we tell BookmarkModel it's about to be | 375 // deadlock). To break the deadlock we tell BookmarkModel it's about to be |
| 371 // deleted so that it can release the signal history is waiting on, allowing | 376 // deleted so that it can release the signal history is waiting on, allowing |
| 372 // history to shutdown (history_service_->Cleanup to complete). In such a | 377 // history to shutdown (history_service_->Cleanup to complete). In such a |
| 373 // scenario history sees an incorrect view of bookmarks, but it's better | 378 // scenario history sees an incorrect view of bookmarks, but it's better |
| 374 // than a deadlock. | 379 // than a deadlock. |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 DCHECK(thread_checker_.CalledOnValidThread()); | 1270 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1266 visit_database_observers_.RemoveObserver(observer); | 1271 visit_database_observers_.RemoveObserver(observer); |
| 1267 } | 1272 } |
| 1268 | 1273 |
| 1269 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1274 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1270 const history::BriefVisitInfo& info) { | 1275 const history::BriefVisitInfo& info) { |
| 1271 DCHECK(thread_checker_.CalledOnValidThread()); | 1276 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1272 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1277 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1273 OnAddVisit(info)); | 1278 OnAddVisit(info)); |
| 1274 } | 1279 } |
| OLD | NEW |