| 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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 if (thread_) { | 894 if (thread_) { |
| 895 base::Thread::Options options; | 895 base::Thread::Options options; |
| 896 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 896 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 897 if (!thread_->StartWithOptions(options)) { | 897 if (!thread_->StartWithOptions(options)) { |
| 898 Cleanup(); | 898 Cleanup(); |
| 899 return false; | 899 return false; |
| 900 } | 900 } |
| 901 backend_task_runner_ = thread_->task_runner(); | 901 backend_task_runner_ = thread_->task_runner(); |
| 902 } else { | 902 } else { |
| 903 backend_task_runner_ = base::CreateSequencedTaskRunnerWithTraits( | 903 backend_task_runner_ = base::CreateSequencedTaskRunnerWithTraits( |
| 904 base::TaskTraits() | 904 {base::MayBlock(), base::WithBaseSyncPrimitives(), |
| 905 .WithPriority(base::TaskPriority::USER_BLOCKING) | 905 base::TaskPriority::USER_BLOCKING, |
| 906 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN) | 906 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); |
| 907 .MayBlock() | |
| 908 .WithBaseSyncPrimitives()); | |
| 909 } | 907 } |
| 910 | 908 |
| 911 // Create the history backend. | 909 // Create the history backend. |
| 912 scoped_refptr<HistoryBackend> backend(new HistoryBackend( | 910 scoped_refptr<HistoryBackend> backend(new HistoryBackend( |
| 913 new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), | 911 new BackendDelegate(weak_ptr_factory_.GetWeakPtr(), |
| 914 base::ThreadTaskRunnerHandle::Get()), | 912 base::ThreadTaskRunnerHandle::Get()), |
| 915 history_client_ ? history_client_->CreateBackendClient() : nullptr, | 913 history_client_ ? history_client_->CreateBackendClient() : nullptr, |
| 916 backend_task_runner_)); | 914 backend_task_runner_)); |
| 917 history_backend_.swap(backend); | 915 history_backend_.swap(backend); |
| 918 | 916 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 return favicon_changed_callback_list_.Add(callback); | 1165 return favicon_changed_callback_list_.Add(callback); |
| 1168 } | 1166 } |
| 1169 | 1167 |
| 1170 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1168 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1171 const GURL& icon_url) { | 1169 const GURL& icon_url) { |
| 1172 DCHECK(thread_checker_.CalledOnValidThread()); | 1170 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1173 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1171 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1174 } | 1172 } |
| 1175 | 1173 |
| 1176 } // namespace history | 1174 } // namespace history |
| OLD | NEW |