| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 private: | 199 private: |
| 200 const base::WeakPtr<HistoryService> history_service_; | 200 const base::WeakPtr<HistoryService> history_service_; |
| 201 const scoped_refptr<base::SequencedTaskRunner> service_task_runner_; | 201 const scoped_refptr<base::SequencedTaskRunner> service_task_runner_; |
| 202 Profile* const profile_; | 202 Profile* const profile_; |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 // The history thread is intentionally not a BrowserThread because the | 205 // The history thread is intentionally not a BrowserThread because the |
| 206 // sync integration unit tests depend on being able to create more than one | 206 // sync integration unit tests depend on being able to create more than one |
| 207 // history thread. | 207 // history thread. |
| 208 HistoryService::HistoryService() | 208 HistoryService::HistoryService() |
| 209 : weak_ptr_factory_(this), | 209 : thread_(new base::Thread(kHistoryThreadName)), |
| 210 thread_(new base::Thread(kHistoryThreadName)), | |
| 211 history_client_(NULL), | 210 history_client_(NULL), |
| 212 profile_(NULL), | 211 profile_(NULL), |
| 213 backend_loaded_(false), | 212 backend_loaded_(false), |
| 214 no_db_(false) { | 213 no_db_(false), |
| 214 weak_ptr_factory_(this) { |
| 215 } | 215 } |
| 216 | 216 |
| 217 HistoryService::HistoryService(history::HistoryClient* client, Profile* profile) | 217 HistoryService::HistoryService(history::HistoryClient* client, Profile* profile) |
| 218 : weak_ptr_factory_(this), | 218 : thread_(new base::Thread(kHistoryThreadName)), |
| 219 thread_(new base::Thread(kHistoryThreadName)), | |
| 220 history_client_(client), | 219 history_client_(client), |
| 221 profile_(profile), | 220 profile_(profile), |
| 222 visitedlink_master_(new visitedlink::VisitedLinkMaster( | 221 visitedlink_master_(new visitedlink::VisitedLinkMaster( |
| 223 profile, this, true)), | 222 profile, this, true)), |
| 224 backend_loaded_(false), | 223 backend_loaded_(false), |
| 225 no_db_(false) { | 224 no_db_(false), |
| 225 weak_ptr_factory_(this) { |
| 226 DCHECK(profile_); | 226 DCHECK(profile_); |
| 227 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 227 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
| 228 content::Source<Profile>(profile_)); | 228 content::Source<Profile>(profile_)); |
| 229 } | 229 } |
| 230 | 230 |
| 231 HistoryService::~HistoryService() { | 231 HistoryService::~HistoryService() { |
| 232 DCHECK(thread_checker_.CalledOnValidThread()); | 232 DCHECK(thread_checker_.CalledOnValidThread()); |
| 233 // Shutdown the backend. This does nothing if Cleanup was already invoked. | 233 // Shutdown the backend. This does nothing if Cleanup was already invoked. |
| 234 Cleanup(); | 234 Cleanup(); |
| 235 } | 235 } |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 const HistoryService::OnFaviconChangedCallback& callback) { | 1245 const HistoryService::OnFaviconChangedCallback& callback) { |
| 1246 DCHECK(thread_checker_.CalledOnValidThread()); | 1246 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1247 return favicon_changed_callback_list_.Add(callback); | 1247 return favicon_changed_callback_list_.Add(callback); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 void HistoryService::NotifyFaviconChanged( | 1250 void HistoryService::NotifyFaviconChanged( |
| 1251 const std::set<GURL>& changed_favicons) { | 1251 const std::set<GURL>& changed_favicons) { |
| 1252 DCHECK(thread_checker_.CalledOnValidThread()); | 1252 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1253 favicon_changed_callback_list_.Notify(changed_favicons); | 1253 favicon_changed_callback_list_.Notify(changed_favicons); |
| 1254 } | 1254 } |
| OLD | NEW |