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/message_loop/message_loop.h" | 27 #include "base/message_loop/message_loop.h" |
28 #include "base/thread_task_runner_handle.h" | 28 #include "base/thread_task_runner_handle.h" |
29 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
32 #include "chrome/browser/history/history_backend.h" | 32 #include "chrome/browser/history/history_backend.h" |
33 #include "chrome/browser/history/in_memory_history_backend.h" | 33 #include "chrome/browser/history/in_memory_history_backend.h" |
34 #include "chrome/browser/history/in_memory_url_index.h" | 34 #include "chrome/browser/history/in_memory_url_index.h" |
| 35 #include "chrome/browser/history/scored_history_match.h" |
35 #include "chrome/browser/history/web_history_service.h" | 36 #include "chrome/browser/history/web_history_service.h" |
36 #include "chrome/browser/history/web_history_service_factory.h" | 37 #include "chrome/browser/history/web_history_service_factory.h" |
37 #include "chrome/browser/profiles/profile.h" | 38 #include "chrome/browser/profiles/profile.h" |
38 #include "chrome/common/chrome_constants.h" | |
39 #include "chrome/common/chrome_switches.h" | |
40 #include "chrome/common/importer/imported_favicon_usage.h" | 39 #include "chrome/common/importer/imported_favicon_usage.h" |
41 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
42 #include "components/dom_distiller/core/url_constants.h" | 41 #include "components/dom_distiller/core/url_constants.h" |
43 #include "components/history/core/browser/download_row.h" | 42 #include "components/history/core/browser/download_row.h" |
44 #include "components/history/core/browser/history_client.h" | 43 #include "components/history/core/browser/history_client.h" |
45 #include "components/history/core/browser/history_database_params.h" | 44 #include "components/history/core/browser/history_database_params.h" |
46 #include "components/history/core/browser/history_service_observer.h" | 45 #include "components/history/core/browser/history_service_observer.h" |
47 #include "components/history/core/browser/history_types.h" | 46 #include "components/history/core/browser/history_types.h" |
48 #include "components/history/core/browser/in_memory_database.h" | 47 #include "components/history/core/browser/in_memory_database.h" |
49 #include "components/history/core/browser/keyword_search_term.h" | 48 #include "components/history/core/browser/keyword_search_term.h" |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 return false; | 975 return false; |
977 } | 976 } |
978 | 977 |
979 history_dir_ = history_database_params.history_dir; | 978 history_dir_ = history_database_params.history_dir; |
980 no_db_ = no_db; | 979 no_db_ = no_db; |
981 | 980 |
982 if (!languages.empty()) { | 981 if (!languages.empty()) { |
983 // Do not create |in_memory_url_index_| when languages is empty (which | 982 // Do not create |in_memory_url_index_| when languages is empty (which |
984 // should only happens during testing). | 983 // should only happens during testing). |
985 in_memory_url_index_.reset(new history::InMemoryURLIndex( | 984 in_memory_url_index_.reset(new history::InMemoryURLIndex( |
986 this, history_dir_, languages, history_client_)); | 985 this, history_dir_, languages)); |
987 in_memory_url_index_->Init(); | 986 in_memory_url_index_->Init(); |
988 } | 987 } |
989 | 988 |
990 // Create the history backend. | 989 // Create the history backend. |
991 scoped_refptr<HistoryBackend> backend(new HistoryBackend( | 990 scoped_refptr<HistoryBackend> backend(new HistoryBackend( |
992 history_dir_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), | 991 history_dir_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), |
993 base::ThreadTaskRunnerHandle::Get()), | 992 base::ThreadTaskRunnerHandle::Get()), |
994 history_client_)); | 993 history_client_)); |
995 history_backend_.swap(backend); | 994 history_backend_.swap(backend); |
996 | 995 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 const HistoryService::OnFaviconChangedCallback& callback) { | 1283 const HistoryService::OnFaviconChangedCallback& callback) { |
1285 DCHECK(thread_checker_.CalledOnValidThread()); | 1284 DCHECK(thread_checker_.CalledOnValidThread()); |
1286 return favicon_changed_callback_list_.Add(callback); | 1285 return favicon_changed_callback_list_.Add(callback); |
1287 } | 1286 } |
1288 | 1287 |
1289 void HistoryService::NotifyFaviconChanged( | 1288 void HistoryService::NotifyFaviconChanged( |
1290 const std::set<GURL>& changed_favicons) { | 1289 const std::set<GURL>& changed_favicons) { |
1291 DCHECK(thread_checker_.CalledOnValidThread()); | 1290 DCHECK(thread_checker_.CalledOnValidThread()); |
1292 favicon_changed_callback_list_.Notify(changed_favicons); | 1291 favicon_changed_callback_list_.Notify(changed_favicons); |
1293 } | 1292 } |
OLD | NEW |