Index: components/history/core/browser/history_service.cc |
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc |
index 23fdad993c2f1737c65631162535565c7346ae7d..cbec5852142ee9a8a3b90e9ed6d192303193781b 100644 |
--- a/components/history/core/browser/history_service.cc |
+++ b/components/history/core/browser/history_service.cc |
@@ -24,8 +24,8 @@ |
#include "base/compiler_specific.h" |
#include "base/location.h" |
#include "base/memory/ref_counted.h" |
-#include "base/message_loop/message_loop.h" |
#include "base/metrics/histogram_macros.h" |
+#include "base/single_thread_task_runner.h" |
#include "base/thread_task_runner_handle.h" |
#include "base/threading/thread.h" |
#include "base/time/time.h" |
@@ -334,7 +334,7 @@ base::CancelableTaskTracker::TaskId HistoryService::ScheduleDBTask( |
// Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to |
// the current message loop so that we can forward the call to the method |
// HistoryDBTask::DoneRunOnMainThread() in the correct thread. |
- thread_->message_loop_proxy()->PostTask( |
+ thread_->task_runner()->PostTask( |
FROM_HERE, base::Bind(&HistoryBackend::ProcessDBTask, |
history_backend_.get(), base::Passed(&task), |
base::ThreadTaskRunnerHandle::Get(), is_canceled)); |
@@ -342,7 +342,7 @@ base::CancelableTaskTracker::TaskId HistoryService::ScheduleDBTask( |
} |
void HistoryService::FlushForTest(const base::Closure& flushed) { |
- thread_->message_loop_proxy()->PostTaskAndReply( |
+ thread_->task_runner()->PostTaskAndReply( |
FROM_HERE, base::Bind(&base::DoNothing), flushed); |
} |
@@ -502,7 +502,7 @@ base::CancelableTaskTracker::TaskId HistoryService::GetFavicons( |
std::vector<favicon_base::FaviconRawBitmapResult>* results = |
new std::vector<favicon_base::FaviconRawBitmapResult>(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::GetFavicons, history_backend_.get(), |
icon_urls, icon_types, desired_sizes, results), |
base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); |
@@ -519,7 +519,7 @@ base::CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL( |
std::vector<favicon_base::FaviconRawBitmapResult>* results = |
new std::vector<favicon_base::FaviconRawBitmapResult>(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::GetFaviconsForURL, history_backend_.get(), |
page_url, icon_types, desired_sizes, results), |
base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); |
@@ -536,7 +536,7 @@ base::CancelableTaskTracker::TaskId HistoryService::GetLargestFaviconForURL( |
favicon_base::FaviconRawBitmapResult* result = |
new favicon_base::FaviconRawBitmapResult(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::GetLargestFaviconForURL, |
history_backend_.get(), page_url, icon_types, |
minimum_size_in_pixels, result), |
@@ -553,7 +553,7 @@ base::CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( |
std::vector<favicon_base::FaviconRawBitmapResult>* results = |
new std::vector<favicon_base::FaviconRawBitmapResult>(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::GetFaviconForID, history_backend_.get(), |
favicon_id, desired_size, results), |
base::Bind(&RunWithFaviconResults, callback, base::Owned(results))); |
@@ -572,7 +572,7 @@ HistoryService::UpdateFaviconMappingsAndFetch( |
std::vector<favicon_base::FaviconRawBitmapResult>* results = |
new std::vector<favicon_base::FaviconRawBitmapResult>(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::UpdateFaviconMappingsAndFetch, |
history_backend_.get(), page_url, icon_urls, icon_types, |
desired_sizes, results), |
@@ -636,7 +636,7 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryURL( |
DCHECK(thread_checker_.CalledOnValidThread()); |
QueryURLResult* query_url_result = new QueryURLResult(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url, |
want_visits, base::Unretained(query_url_result)), |
base::Bind(&RunWithQueryURLResult, callback, |
@@ -652,7 +652,7 @@ void HistoryService::CreateDownload( |
const HistoryService::DownloadCreateCallback& callback) { |
DCHECK(thread_) << "History service being called after cleanup"; |
DCHECK(thread_checker_.CalledOnValidThread()); |
- PostTaskAndReplyWithResult(thread_->message_loop_proxy().get(), FROM_HERE, |
+ PostTaskAndReplyWithResult(thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::CreateDownload, |
history_backend_.get(), create_info), |
callback); |
@@ -662,7 +662,7 @@ void HistoryService::GetNextDownloadId(const DownloadIdCallback& callback) { |
DCHECK(thread_) << "History service being called after cleanup"; |
DCHECK(thread_checker_.CalledOnValidThread()); |
PostTaskAndReplyWithResult( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::GetNextDownloadId, history_backend_.get()), |
callback); |
} |
@@ -678,7 +678,7 @@ void HistoryService::QueryDownloads(const DownloadQueryCallback& callback) { |
// base::Passed(&scoped_rows) nullifies |scoped_rows|, and compilers do not |
// guarantee that the first Bind's arguments are evaluated before the second |
// Bind's arguments. |
- thread_->message_loop_proxy()->PostTaskAndReply( |
+ thread_->task_runner()->PostTaskAndReply( |
FROM_HERE, |
base::Bind(&HistoryBackend::QueryDownloads, history_backend_.get(), rows), |
base::Bind(callback, base::Passed(&scoped_rows))); |
@@ -709,7 +709,7 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryHistory( |
DCHECK(thread_checker_.CalledOnValidThread()); |
QueryResults* query_results = new QueryResults(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::QueryHistory, history_backend_.get(), |
text_query, options, base::Unretained(query_results)), |
base::Bind(callback, base::Owned(query_results))); |
@@ -723,7 +723,7 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryRedirectsFrom( |
DCHECK(thread_checker_.CalledOnValidThread()); |
RedirectList* result = new RedirectList(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::QueryRedirectsFrom, history_backend_.get(), |
from_url, base::Unretained(result)), |
base::Bind(callback, base::Owned(result))); |
@@ -737,7 +737,7 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryRedirectsTo( |
DCHECK(thread_checker_.CalledOnValidThread()); |
RedirectList* result = new RedirectList(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::QueryRedirectsTo, history_backend_.get(), |
to_url, base::Unretained(result)), |
base::Bind(callback, base::Owned(result))); |
@@ -751,7 +751,7 @@ base::CancelableTaskTracker::TaskId HistoryService::GetVisibleVisitCountToHost( |
DCHECK(thread_checker_.CalledOnValidThread()); |
VisibleVisitCountToHostResult* result = new VisibleVisitCountToHostResult(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::GetVisibleVisitCountToHost, |
history_backend_.get(), url, base::Unretained(result)), |
base::Bind(&RunWithVisibleVisitCountToHostResult, callback, |
@@ -767,7 +767,7 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryMostVisitedURLs( |
DCHECK(thread_checker_.CalledOnValidThread()); |
MostVisitedURLList* result = new MostVisitedURLList(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::QueryMostVisitedURLs, history_backend_.get(), |
result_count, days_back, base::Unretained(result)), |
base::Bind(callback, base::Owned(result))); |
@@ -783,7 +783,7 @@ base::CancelableTaskTracker::TaskId HistoryService::QueryFilteredURLs( |
DCHECK(thread_checker_.CalledOnValidThread()); |
FilteredURLList* result = new FilteredURLList(); |
return tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::QueryFilteredURLs, history_backend_.get(), |
result_count, filter, extended_info, base::Unretained(result)), |
base::Bind(callback, base::Owned(result))); |
@@ -890,7 +890,7 @@ void HistoryService::ScheduleTask(SchedulePriority priority, |
CHECK(thread_); |
CHECK(thread_->message_loop()); |
// TODO(brettw): Do prioritization. |
- thread_->message_loop()->PostTask(FROM_HERE, task); |
+ thread_->task_runner()->PostTask(FROM_HERE, task); |
} |
base::WeakPtr<HistoryService> HistoryService::AsWeakPtr() { |
@@ -980,7 +980,7 @@ void HistoryService::ExpireHistoryBetween( |
DCHECK(thread_) << "History service being called after cleanup"; |
DCHECK(thread_checker_.CalledOnValidThread()); |
tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::ExpireHistoryBetween, history_backend_, |
restrict_urls, begin_time, end_time), |
callback); |
@@ -993,7 +993,7 @@ void HistoryService::ExpireHistory( |
DCHECK(thread_) << "History service being called after cleanup"; |
DCHECK(thread_checker_.CalledOnValidThread()); |
tracker->PostTaskAndReply( |
- thread_->message_loop_proxy().get(), FROM_HERE, |
+ thread_->task_runner().get(), FROM_HERE, |
base::Bind(&HistoryBackend::ExpireHistory, history_backend_, expire_list), |
callback); |
} |