| 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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 // | 841 // |
| 842 // TODO(ajwong): Cleanup HistoryBackend lifetime issues. | 842 // TODO(ajwong): Cleanup HistoryBackend lifetime issues. |
| 843 // See http://crbug.com/99767. | 843 // See http://crbug.com/99767. |
| 844 history_backend_->AddRef(); | 844 history_backend_->AddRef(); |
| 845 base::Closure closing_task = | 845 base::Closure closing_task = |
| 846 base::Bind(&HistoryBackend::Closing, history_backend_.get()); | 846 base::Bind(&HistoryBackend::Closing, history_backend_.get()); |
| 847 ScheduleTask(PRIORITY_NORMAL, closing_task); | 847 ScheduleTask(PRIORITY_NORMAL, closing_task); |
| 848 closing_task.Reset(); | 848 closing_task.Reset(); |
| 849 HistoryBackend* raw_ptr = history_backend_.get(); | 849 HistoryBackend* raw_ptr = history_backend_.get(); |
| 850 history_backend_ = nullptr; | 850 history_backend_ = nullptr; |
| 851 thread_->message_loop()->ReleaseSoon(FROM_HERE, raw_ptr); | 851 thread_->task_runner()->ReleaseSoon(FROM_HERE, raw_ptr); |
| 852 } | 852 } |
| 853 | 853 |
| 854 // Delete the thread, which joins with the background thread. We defensively | 854 // Delete the thread, which joins with the background thread. We defensively |
| 855 // nullptr the pointer before deleting it in case somebody tries to use it | 855 // nullptr the pointer before deleting it in case somebody tries to use it |
| 856 // during shutdown, but this shouldn't happen. | 856 // during shutdown, but this shouldn't happen. |
| 857 base::Thread* thread = thread_; | 857 base::Thread* thread = thread_; |
| 858 thread_ = nullptr; | 858 thread_ = nullptr; |
| 859 delete thread; | 859 delete thread; |
| 860 } | 860 } |
| 861 | 861 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 return favicon_changed_callback_list_.Add(callback); | 1132 return favicon_changed_callback_list_.Add(callback); |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1135 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1136 const GURL& icon_url) { | 1136 const GURL& icon_url) { |
| 1137 DCHECK(thread_checker_.CalledOnValidThread()); | 1137 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1138 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1138 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 } // namespace history | 1141 } // namespace history |
| OLD | NEW |