| 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 |
| 11 // ----------- -------------- | 11 // ----------- -------------- |
| 12 // HistoryService <----------------> HistoryBackend | 12 // HistoryService <----------------> HistoryBackend |
| 13 // -> HistoryDatabase | 13 // -> HistoryDatabase |
| 14 // -> SQLite connection to History | 14 // -> SQLite connection to History |
| 15 // -> ThumbnailDatabase | 15 // -> ThumbnailDatabase |
| 16 // -> SQLite connection to Thumbnails | 16 // -> SQLite connection to Thumbnails |
| 17 // (and favicons) | 17 // (and favicons) |
| 18 | 18 |
| 19 #include "components/history/core/browser/history_service.h" | 19 #include "components/history/core/browser/history_service.h" |
| 20 | 20 |
| 21 #include "base/bind.h" |
| 21 #include "base/bind_helpers.h" | 22 #include "base/bind_helpers.h" |
| 22 #include "base/callback.h" | 23 #include "base/callback.h" |
| 23 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 24 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
| 25 #include "base/location.h" | 26 #include "base/location.h" |
| 26 #include "base/memory/ref_counted.h" | 27 #include "base/memory/ref_counted.h" |
| 27 #include "base/metrics/histogram_macros.h" | 28 #include "base/metrics/histogram_macros.h" |
| 28 #include "base/single_thread_task_runner.h" | 29 #include "base/single_thread_task_runner.h" |
| 29 #include "base/thread_task_runner_handle.h" | 30 #include "base/thread_task_runner_handle.h" |
| 30 #include "base/threading/thread.h" | 31 #include "base/threading/thread.h" |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 thread_->task_runner())); | 883 thread_->task_runner())); |
| 883 history_backend_.swap(backend); | 884 history_backend_.swap(backend); |
| 884 | 885 |
| 885 ScheduleTask(PRIORITY_UI, | 886 ScheduleTask(PRIORITY_UI, |
| 886 base::Bind(&HistoryBackend::Init, history_backend_.get(), | 887 base::Bind(&HistoryBackend::Init, history_backend_.get(), |
| 887 languages, no_db, history_database_params)); | 888 languages, no_db, history_database_params)); |
| 888 | 889 |
| 889 if (visit_delegate_ && !visit_delegate_->Init(this)) | 890 if (visit_delegate_ && !visit_delegate_->Init(this)) |
| 890 return false; | 891 return false; |
| 891 | 892 |
| 893 if (history_client_) |
| 894 history_client_->Init(this); |
| 895 |
| 892 return true; | 896 return true; |
| 893 } | 897 } |
| 894 | 898 |
| 895 void HistoryService::ScheduleAutocomplete( | 899 void HistoryService::ScheduleAutocomplete( |
| 896 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback) { | 900 const base::Callback<void(HistoryBackend*, URLDatabase*)>& callback) { |
| 897 DCHECK(thread_checker_.CalledOnValidThread()); | 901 DCHECK(thread_checker_.CalledOnValidThread()); |
| 898 ScheduleTask(PRIORITY_UI, base::Bind(&HistoryBackend::ScheduleAutocomplete, | 902 ScheduleTask(PRIORITY_UI, base::Bind(&HistoryBackend::ScheduleAutocomplete, |
| 899 history_backend_.get(), callback)); | 903 history_backend_.get(), callback)); |
| 900 } | 904 } |
| 901 | 905 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 return favicon_changed_callback_list_.Add(callback); | 1138 return favicon_changed_callback_list_.Add(callback); |
| 1135 } | 1139 } |
| 1136 | 1140 |
| 1137 void HistoryService::NotifyFaviconChanged( | 1141 void HistoryService::NotifyFaviconChanged( |
| 1138 const std::set<GURL>& changed_favicons) { | 1142 const std::set<GURL>& changed_favicons) { |
| 1139 DCHECK(thread_checker_.CalledOnValidThread()); | 1143 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1140 favicon_changed_callback_list_.Notify(changed_favicons); | 1144 favicon_changed_callback_list_.Notify(changed_favicons); |
| 1141 } | 1145 } |
| 1142 | 1146 |
| 1143 } // namespace history | 1147 } // namespace history |
| OLD | NEW |