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 14 matching lines...) Expand all Loading... |
25 #include "base/location.h" | 25 #include "base/location.h" |
26 #include "base/memory/ref_counted.h" | 26 #include "base/memory/ref_counted.h" |
27 #include "base/metrics/histogram_macros.h" | 27 #include "base/metrics/histogram_macros.h" |
28 #include "base/single_thread_task_runner.h" | 28 #include "base/single_thread_task_runner.h" |
29 #include "base/thread_task_runner_handle.h" | 29 #include "base/thread_task_runner_handle.h" |
30 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
31 #include "base/time/time.h" | 31 #include "base/time/time.h" |
32 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
33 #include "components/history/core/browser/download_row.h" | 33 #include "components/history/core/browser/download_row.h" |
34 #include "components/history/core/browser/history_backend.h" | 34 #include "components/history/core/browser/history_backend.h" |
| 35 #include "components/history/core/browser/history_backend_client.h" |
35 #include "components/history/core/browser/history_client.h" | 36 #include "components/history/core/browser/history_client.h" |
36 #include "components/history/core/browser/history_database_params.h" | 37 #include "components/history/core/browser/history_database_params.h" |
37 #include "components/history/core/browser/history_db_task.h" | 38 #include "components/history/core/browser/history_db_task.h" |
38 #include "components/history/core/browser/history_service_observer.h" | 39 #include "components/history/core/browser/history_service_observer.h" |
39 #include "components/history/core/browser/history_types.h" | 40 #include "components/history/core/browser/history_types.h" |
40 #include "components/history/core/browser/in_memory_database.h" | 41 #include "components/history/core/browser/in_memory_database.h" |
41 #include "components/history/core/browser/in_memory_history_backend.h" | 42 #include "components/history/core/browser/in_memory_history_backend.h" |
42 #include "components/history/core/browser/keyword_search_term.h" | 43 #include "components/history/core/browser/keyword_search_term.h" |
43 #include "components/history/core/browser/visit_database.h" | 44 #include "components/history/core/browser/visit_database.h" |
44 #include "components/history/core/browser/visit_delegate.h" | 45 #include "components/history/core/browser/visit_delegate.h" |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 871 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
871 if (!thread_->StartWithOptions(options)) { | 872 if (!thread_->StartWithOptions(options)) { |
872 Cleanup(); | 873 Cleanup(); |
873 return false; | 874 return false; |
874 } | 875 } |
875 | 876 |
876 // Create the history backend. | 877 // Create the history backend. |
877 scoped_refptr<HistoryBackend> backend(new HistoryBackend( | 878 scoped_refptr<HistoryBackend> backend(new HistoryBackend( |
878 new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), | 879 new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), |
879 base::ThreadTaskRunnerHandle::Get()), | 880 base::ThreadTaskRunnerHandle::Get()), |
880 history_client_.get(), thread_->task_runner())); | 881 history_client_ ? history_client_->CreateBackendClient() : nullptr, |
| 882 thread_->task_runner())); |
881 history_backend_.swap(backend); | 883 history_backend_.swap(backend); |
882 | 884 |
883 ScheduleTask(PRIORITY_UI, | 885 ScheduleTask(PRIORITY_UI, |
884 base::Bind(&HistoryBackend::Init, history_backend_.get(), | 886 base::Bind(&HistoryBackend::Init, history_backend_.get(), |
885 languages, no_db, history_database_params)); | 887 languages, no_db, history_database_params)); |
886 | 888 |
887 if (visit_delegate_ && !visit_delegate_->Init(this)) | 889 if (visit_delegate_ && !visit_delegate_->Init(this)) |
888 return false; | 890 return false; |
889 | 891 |
890 return true; | 892 return true; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 return favicon_changed_callback_list_.Add(callback); | 1134 return favicon_changed_callback_list_.Add(callback); |
1133 } | 1135 } |
1134 | 1136 |
1135 void HistoryService::NotifyFaviconChanged( | 1137 void HistoryService::NotifyFaviconChanged( |
1136 const std::set<GURL>& changed_favicons) { | 1138 const std::set<GURL>& changed_favicons) { |
1137 DCHECK(thread_checker_.CalledOnValidThread()); | 1139 DCHECK(thread_checker_.CalledOnValidThread()); |
1138 favicon_changed_callback_list_.Notify(changed_favicons); | 1140 favicon_changed_callback_list_.Notify(changed_favicons); |
1139 } | 1141 } |
1140 | 1142 |
1141 } // namespace history | 1143 } // namespace history |
OLD | NEW |