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 11 matching lines...) Expand all Loading... |
22 #include "base/callback.h" | 22 #include "base/callback.h" |
23 #include "base/command_line.h" | 23 #include "base/command_line.h" |
24 #include "base/compiler_specific.h" | 24 #include "base/compiler_specific.h" |
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/prefs/pref_service.h" | 28 #include "base/prefs/pref_service.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 "chrome/browser/browser_process.h" | |
33 #include "chrome/browser/history/history_backend.h" | 32 #include "chrome/browser/history/history_backend.h" |
34 #include "chrome/browser/history/in_memory_history_backend.h" | 33 #include "chrome/browser/history/in_memory_history_backend.h" |
35 #include "chrome/browser/history/in_memory_url_index.h" | 34 #include "chrome/browser/history/in_memory_url_index.h" |
36 #include "chrome/browser/history/web_history_service.h" | 35 #include "chrome/browser/history/web_history_service.h" |
37 #include "chrome/browser/history/web_history_service_factory.h" | 36 #include "chrome/browser/history/web_history_service_factory.h" |
38 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
39 #include "chrome/common/chrome_constants.h" | 38 #include "chrome/common/chrome_constants.h" |
40 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
41 #include "chrome/common/importer/imported_favicon_usage.h" | 40 #include "chrome/common/importer/imported_favicon_usage.h" |
42 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 Cleanup(); | 975 Cleanup(); |
977 return false; | 976 return false; |
978 } | 977 } |
979 | 978 |
980 history_dir_ = history_database_params.history_dir; | 979 history_dir_ = history_database_params.history_dir; |
981 no_db_ = no_db; | 980 no_db_ = no_db; |
982 | 981 |
983 if (profile_) { | 982 if (profile_) { |
984 std::string languages = | 983 std::string languages = |
985 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 984 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
986 in_memory_url_index_.reset(new history::InMemoryURLIndex( | 985 in_memory_url_index_.reset( |
987 this, history_dir_, languages, history_client_)); | 986 new history::InMemoryURLIndex(this, history_dir_, languages)); |
988 in_memory_url_index_->Init(); | 987 in_memory_url_index_->Init(); |
989 } | 988 } |
990 | 989 |
991 // Create the history backend. | 990 // Create the history backend. |
992 scoped_refptr<HistoryBackend> backend(new HistoryBackend( | 991 scoped_refptr<HistoryBackend> backend(new HistoryBackend( |
993 history_dir_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), | 992 history_dir_, new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), |
994 base::ThreadTaskRunnerHandle::Get()), | 993 base::ThreadTaskRunnerHandle::Get()), |
995 history_client_)); | 994 history_client_)); |
996 history_backend_.swap(backend); | 995 history_backend_.swap(backend); |
997 | 996 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 const HistoryService::OnFaviconChangedCallback& callback) { | 1291 const HistoryService::OnFaviconChangedCallback& callback) { |
1293 DCHECK(thread_checker_.CalledOnValidThread()); | 1292 DCHECK(thread_checker_.CalledOnValidThread()); |
1294 return favicon_changed_callback_list_.Add(callback); | 1293 return favicon_changed_callback_list_.Add(callback); |
1295 } | 1294 } |
1296 | 1295 |
1297 void HistoryService::NotifyFaviconChanged( | 1296 void HistoryService::NotifyFaviconChanged( |
1298 const std::set<GURL>& changed_favicons) { | 1297 const std::set<GURL>& changed_favicons) { |
1299 DCHECK(thread_checker_.CalledOnValidThread()); | 1298 DCHECK(thread_checker_.CalledOnValidThread()); |
1300 favicon_changed_callback_list_.Notify(changed_favicons); | 1299 favicon_changed_callback_list_.Notify(changed_favicons); |
1301 } | 1300 } |
OLD | NEW |