diff options
author | skyostil <skyostil@chromium.org> | 2015-06-02 12:03:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-02 19:05:11 +0000 |
commit | b0daa011ba68aa9079f31925faa9a7ca88894770 (patch) | |
tree | 8fb2c57a520058df58dba9ba34906af098f715f3 /components/webdata | |
parent | 3f2a3abd4acdd336e4c76ce963663507bd05e7bd (diff) | |
download | chromium_src-b0daa011ba68aa9079f31925faa9a7ca88894770.zip chromium_src-b0daa011ba68aa9079f31925faa9a7ca88894770.tar.gz chromium_src-b0daa011ba68aa9079f31925faa9a7ca88894770.tar.bz2 |
components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with
https://codereview.chromium.org/1010073002/.
BUG=465354
Review URL: https://codereview.chromium.org/1144153004
Cr-Commit-Position: refs/heads/master@{#332440}
Diffstat (limited to 'components/webdata')
7 files changed, 28 insertions, 25 deletions
diff --git a/components/webdata/common/web_data_request_manager.cc b/components/webdata/common/web_data_request_manager.cc index 9a92855..701f8f6 100644 --- a/components/webdata/common/web_data_request_manager.cc +++ b/components/webdata/common/web_data_request_manager.cc @@ -5,8 +5,10 @@ #include "components/webdata/common/web_data_request_manager.h" #include "base/bind.h" +#include "base/location.h" #include "base/message_loop/message_loop.h" #include "base/profiler/scoped_tracker.h" +#include "base/single_thread_task_runner.h" #include "base/stl_util.h" //////////////////////////////////////////////////////////////////////////////// @@ -111,10 +113,9 @@ void WebDataRequestManager::CancelRequest(WebDataServiceBase::Handle h) { void WebDataRequestManager::RequestCompleted( scoped_ptr<WebDataRequest> request) { base::MessageLoop* loop = request->GetMessageLoop(); - loop->PostTask(FROM_HERE, - base::Bind(&WebDataRequestManager::RequestCompletedOnThread, - this, - base::Passed(&request))); + loop->task_runner()->PostTask( + FROM_HERE, base::Bind(&WebDataRequestManager::RequestCompletedOnThread, + this, base::Passed(&request))); } void WebDataRequestManager::RequestCompletedOnThread( diff --git a/components/webdata/common/web_data_service_base.cc b/components/webdata/common/web_data_service_base.cc index 6f7b776..3418eb4 100644 --- a/components/webdata/common/web_data_service_base.cc +++ b/components/webdata/common/web_data_service_base.cc @@ -5,7 +5,7 @@ #include "components/webdata/common/web_data_service_base.h" #include "base/bind.h" -#include "base/message_loop/message_loop.h" +#include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/threading/thread.h" #include "components/webdata/common/web_database_service.h" @@ -22,7 +22,7 @@ using base::Time; WebDataServiceBase::WebDataServiceBase( scoped_refptr<WebDatabaseService> wdbs, const ProfileErrorCallback& callback, - const scoped_refptr<base::MessageLoopProxy>& ui_thread) + const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread) : base::RefCountedDeleteOnMessageLoop<WebDataServiceBase>(ui_thread), wdbs_(wdbs), profile_error_callback_(callback) { diff --git a/components/webdata/common/web_data_service_base.h b/components/webdata/common/web_data_service_base.h index 2a0ead6..de5a3e9 100644 --- a/components/webdata/common/web_data_service_base.h +++ b/components/webdata/common/web_data_service_base.h @@ -19,7 +19,7 @@ class WebDatabaseTable; namespace base { // TODO(skyostil): Migrate to SingleThreadTaskRunner (crbug.com/465354). -class MessageLoopProxy; +class SingleThreadTaskRunner; class Thread; } @@ -49,9 +49,10 @@ class WEBDATA_EXPORT WebDataServiceBase // WebDataServiceWrapper handles the initializing and shutting down and of // the |wdbs| object. // WebDataServiceBase is destroyed on |ui_thread|. - WebDataServiceBase(scoped_refptr<WebDatabaseService> wdbs, - const ProfileErrorCallback& callback, - const scoped_refptr<base::MessageLoopProxy>& ui_thread); + WebDataServiceBase( + scoped_refptr<WebDatabaseService> wdbs, + const ProfileErrorCallback& callback, + const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread); // Cancel any pending request. You need to call this method if your // WebDataServiceConsumer is about to be deleted. diff --git a/components/webdata/common/web_database_backend.cc b/components/webdata/common/web_database_backend.cc index 6baa716..2ed1d87 100644 --- a/components/webdata/common/web_database_backend.cc +++ b/components/webdata/common/web_database_backend.cc @@ -16,7 +16,7 @@ using base::FilePath; WebDatabaseBackend::WebDatabaseBackend( const FilePath& path, Delegate* delegate, - const scoped_refptr<base::MessageLoopProxy>& db_thread) + const scoped_refptr<base::SingleThreadTaskRunner>& db_thread) : base::RefCountedDeleteOnMessageLoop<WebDatabaseBackend>(db_thread), db_path_(path), request_manager_(new WebDataRequestManager()), diff --git a/components/webdata/common/web_database_backend.h b/components/webdata/common/web_database_backend.h index 5d680bd..9dc918e 100644 --- a/components/webdata/common/web_database_backend.h +++ b/components/webdata/common/web_database_backend.h @@ -13,6 +13,7 @@ #include "base/memory/ref_counted_delete_on_message_loop.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" +#include "base/single_thread_task_runner.h" #include "components/webdata/common/web_database_service.h" #include "components/webdata/common/webdata_export.h" @@ -40,9 +41,10 @@ class WEBDATA_EXPORT WebDatabaseBackend virtual void DBLoaded(sql::InitStatus status) = 0; }; - WebDatabaseBackend(const base::FilePath& path, - Delegate* delegate, - const scoped_refptr<base::MessageLoopProxy>& db_thread); + WebDatabaseBackend( + const base::FilePath& path, + Delegate* delegate, + const scoped_refptr<base::SingleThreadTaskRunner>& db_thread); // Must call only before InitDatabaseWithCallback. void AddTable(scoped_ptr<WebDatabaseTable> table); diff --git a/components/webdata/common/web_database_service.cc b/components/webdata/common/web_database_service.cc index 1c12699..e56c7c3 100644 --- a/components/webdata/common/web_database_service.cc +++ b/components/webdata/common/web_database_service.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/location.h" +#include "base/thread_task_runner_handle.h" #include "components/webdata/common/web_data_request_manager.h" #include "components/webdata/common/web_data_results.h" #include "components/webdata/common/web_data_service_consumer.h" @@ -19,11 +20,9 @@ using base::FilePath; class WebDatabaseService::BackendDelegate : public WebDatabaseBackend::Delegate { public: - BackendDelegate( - const base::WeakPtr<WebDatabaseService>& web_database_service) + BackendDelegate(const base::WeakPtr<WebDatabaseService>& web_database_service) : web_database_service_(web_database_service), - callback_thread_(base::MessageLoopProxy::current()) { - } + callback_thread_(base::ThreadTaskRunnerHandle::Get()) {} void DBLoaded(sql::InitStatus status) override { callback_thread_->PostTask( @@ -34,13 +33,13 @@ class WebDatabaseService::BackendDelegate } private: const base::WeakPtr<WebDatabaseService> web_database_service_; - scoped_refptr<base::MessageLoopProxy> callback_thread_; + scoped_refptr<base::SingleThreadTaskRunner> callback_thread_; }; WebDatabaseService::WebDatabaseService( const base::FilePath& path, - const scoped_refptr<base::MessageLoopProxy>& ui_thread, - const scoped_refptr<base::MessageLoopProxy>& db_thread) + scoped_refptr<base::SingleThreadTaskRunner> ui_thread, + scoped_refptr<base::SingleThreadTaskRunner> db_thread) : base::RefCountedDeleteOnMessageLoop<WebDatabaseService>(ui_thread), path_(path), db_loaded_(false), diff --git a/components/webdata/common/web_database_service.h b/components/webdata/common/web_database_service.h index dffbfa1..7f5d1bc 100644 --- a/components/webdata/common/web_database_service.h +++ b/components/webdata/common/web_database_service.h @@ -17,8 +17,8 @@ #include "base/memory/ref_counted_delete_on_message_loop.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "base/message_loop/message_loop_proxy.h" #include "base/observer_list.h" +#include "base/single_thread_task_runner.h" #include "components/webdata/common/web_data_service_base.h" #include "components/webdata/common/web_database.h" #include "components/webdata/common/webdata_export.h" @@ -59,8 +59,8 @@ class WEBDATA_EXPORT WebDatabaseService // Takes the path to the WebDatabase file. // WebDatabaseService lives on |ui_thread| and posts tasks to |db_thread|. WebDatabaseService(const base::FilePath& path, - const scoped_refptr<base::MessageLoopProxy>& ui_thread, - const scoped_refptr<base::MessageLoopProxy>& db_thread); + scoped_refptr<base::SingleThreadTaskRunner> ui_thread, + scoped_refptr<base::SingleThreadTaskRunner> db_thread); // Adds |table| as a WebDatabaseTable that will participate in // managing the database, transferring ownership. All calls to this @@ -140,7 +140,7 @@ class WEBDATA_EXPORT WebDatabaseService // True if the WebDatabase has loaded. bool db_loaded_; - scoped_refptr<base::MessageLoopProxy> db_thread_; + scoped_refptr<base::SingleThreadTaskRunner> db_thread_; // All vended weak pointers are invalidated in ShutdownDatabase(). base::WeakPtrFactory<WebDatabaseService> weak_ptr_factory_; |