diff options
author | adamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 17:27:31 +0000 |
---|---|---|
committer | adamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 17:27:31 +0000 |
commit | 8a4fd81b913fd6c85c067991188c2caf406b10da (patch) | |
tree | 7b9ded6d61f7cfe677a994e934ab457a62bc6c87 /chrome/browser/extensions | |
parent | 71d6c2d930dad7233ae49c2f61e91790d70158a5 (diff) | |
download | chromium_src-8a4fd81b913fd6c85c067991188c2caf406b10da.zip chromium_src-8a4fd81b913fd6c85c067991188c2caf406b10da.tar.gz chromium_src-8a4fd81b913fd6c85c067991188c2caf406b10da.tar.bz2 |
NewRunnable* -> base::Bind for most of chrome/browser/extensions/.
R=aa@chromium.org
Review URL: http://codereview.chromium.org/8292005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
22 files changed, 164 insertions, 146 deletions
diff --git a/chrome/browser/extensions/autoupdate_interceptor.cc b/chrome/browser/extensions/autoupdate_interceptor.cc index 40b40c4..265959a 100644 --- a/chrome/browser/extensions/autoupdate_interceptor.cc +++ b/chrome/browser/extensions/autoupdate_interceptor.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/autoupdate_interceptor.h" +#include "base/bind.h" #include "base/file_util.h" #include "base/threading/thread_restrictions.h" #include "content/browser/browser_thread.h" @@ -86,5 +87,5 @@ void AutoUpdateInterceptor::SetResponseOnIOThread(const std::string url, const FilePath& path) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &AutoUpdateInterceptor::SetResponse, url, path)); + base::Bind(&AutoUpdateInterceptor::SetResponse, this, url, path)); } diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index e73f4f1..18a1a87 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -7,6 +7,7 @@ #include <map> #include <set> +#include "base/bind.h" #include "base/file_util.h" #include "base/lazy_instance.h" #include "base/metrics/field_trial.h" @@ -15,7 +16,6 @@ #include "base/scoped_temp_dir.h" #include "base/stl_util.h" #include "base/stringprintf.h" -#include "base/task.h" #include "base/threading/thread_restrictions.h" #include "base/time.h" #include "base/utf_string_conversions.h" @@ -139,7 +139,7 @@ CrxInstaller::~CrxInstaller() { if (!temp_dir_.value().empty()) { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction( + base::Bind( &extension_file_util::DeleteFile, temp_dir_, true))) NOTREACHED(); } @@ -147,7 +147,7 @@ CrxInstaller::~CrxInstaller() { if (delete_source_) { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction( + base::Bind( &extension_file_util::DeleteFile, source_file_, false))) NOTREACHED(); } @@ -168,8 +168,8 @@ void CrxInstaller::InstallCrx(const FilePath& source_file) { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod( - unpacker.get(), &SandboxedExtensionUnpacker::Start))) + base::Bind( + &SandboxedExtensionUnpacker::Start, unpacker.get()))) NOTREACHED(); } @@ -182,8 +182,7 @@ void CrxInstaller::InstallUserScript(const FilePath& source_file, if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, - &CrxInstaller::ConvertUserScriptOnFileThread))) + base::Bind(&CrxInstaller::ConvertUserScriptOnFileThread, this))) NOTREACHED(); } @@ -202,8 +201,7 @@ void CrxInstaller::ConvertUserScriptOnFileThread() { void CrxInstaller::InstallWebApp(const WebApplicationInfo& web_app) { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, &CrxInstaller::ConvertWebAppOnFileThread, - web_app))) + base::Bind(&CrxInstaller::ConvertWebAppOnFileThread, this, web_app))) NOTREACHED(); } @@ -359,7 +357,7 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, if (!BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &CrxInstaller::ConfirmInstall))) + base::Bind(&CrxInstaller::ConfirmInstall, this))) NOTREACHED(); } @@ -423,7 +421,7 @@ void CrxInstaller::ConfirmInstall() { } else { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, &CrxInstaller::CompleteInstall))) + base::Bind(&CrxInstaller::CompleteInstall, this))) NOTREACHED(); } return; @@ -432,7 +430,7 @@ void CrxInstaller::ConfirmInstall() { void CrxInstaller::InstallUIProceed() { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, &CrxInstaller::CompleteInstall))) + base::Bind(&CrxInstaller::CompleteInstall, this))) NOTREACHED(); Release(); // balanced in ConfirmInstall(). @@ -513,9 +511,7 @@ void CrxInstaller::ReportFailureFromFileThread(const std::string& error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (!BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &CrxInstaller::ReportFailureFromUIThread, - error))) + base::Bind(&CrxInstaller::ReportFailureFromUIThread, this, error))) NOTREACHED(); } @@ -559,8 +555,7 @@ void CrxInstaller::ReportSuccessFromFileThread() { if (!BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &CrxInstaller::ReportSuccessFromUIThread))) + base::Bind(&CrxInstaller::ReportSuccessFromUIThread, this))) NOTREACHED(); } diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc index dce4b6f..3e1d22c 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.cc +++ b/chrome/browser/extensions/extension_bookmarks_module.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension_bookmarks_module.h" +#include "base/bind.h" #include "base/file_path.h" #include "base/i18n/file_util_icu.h" #include "base/i18n/time_formatting.h" @@ -851,7 +852,7 @@ void BookmarksIOFunction::SelectFile(SelectFileDialog::Type type) { // (stat or access, for example), so this requires a thread with IO allowed. if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, &BookmarksIOFunction::SelectFile, type)); + base::Bind(&BookmarksIOFunction::SelectFile, this, type)); return; } @@ -865,8 +866,8 @@ void BookmarksIOFunction::SelectFile(SelectFileDialog::Type type) { // After getting the |default_path|, ask the UI to display the file dialog. BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &BookmarksIOFunction::ShowSelectFileDialog, - type, default_path)); + base::Bind(&BookmarksIOFunction::ShowSelectFileDialog, this, + type, default_path)); } void BookmarksIOFunction::ShowSelectFileDialog(SelectFileDialog::Type type, diff --git a/chrome/browser/extensions/extension_cookies_api.cc b/chrome/browser/extensions/extension_cookies_api.cc index f9f7e51..e2af159 100644 --- a/chrome/browser/extensions/extension_cookies_api.cc +++ b/chrome/browser/extensions/extension_cookies_api.cc @@ -203,7 +203,7 @@ bool GetCookieFunction::RunImpl() { bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &GetCookieFunction::GetCookieOnIOThread)); + base::Bind(&GetCookieFunction::GetCookieOnIOThread, this)); DCHECK(rv); // Will finish asynchronously. @@ -238,7 +238,7 @@ void GetCookieFunction::GetCookieCallback(const net::CookieList& cookie_list) { bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &GetCookieFunction::RespondOnUIThread)); + base::Bind(&GetCookieFunction::RespondOnUIThread, this)); DCHECK(rv); } @@ -268,7 +268,7 @@ bool GetAllCookiesFunction::RunImpl() { bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &GetAllCookiesFunction::GetAllCookiesOnIOThread)); + base::Bind(&GetAllCookiesFunction::GetAllCookiesOnIOThread, this)); DCHECK(rv); // Will finish asynchronously. @@ -296,7 +296,7 @@ void GetAllCookiesFunction::GetAllCookiesCallback( } bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &GetAllCookiesFunction::RespondOnUIThread)); + base::Bind(&GetAllCookiesFunction::RespondOnUIThread, this)); DCHECK(rv); } @@ -369,7 +369,7 @@ bool SetCookieFunction::RunImpl() { bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &SetCookieFunction::SetCookieOnIOThread)); + base::Bind(&SetCookieFunction::SetCookieOnIOThread, this)); DCHECK(rv); // Will finish asynchronously. @@ -412,7 +412,7 @@ void SetCookieFunction::PullCookieCallback(const net::CookieList& cookie_list) { bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &SetCookieFunction::RespondOnUIThread)); + base::Bind(&SetCookieFunction::RespondOnUIThread, this)); DCHECK(rv); } @@ -453,7 +453,7 @@ bool RemoveCookieFunction::RunImpl() { // Pass the work off to the IO thread. bool rv = BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &RemoveCookieFunction::RemoveCookieOnIOThread)); + base::Bind(&RemoveCookieFunction::RemoveCookieOnIOThread, this)); DCHECK(rv); // Will return asynchronously. @@ -482,7 +482,7 @@ void RemoveCookieFunction::RemoveCookieCallback() { // Return to UI thread bool rv = BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &RemoveCookieFunction::RespondOnUIThread)); + base::Bind(&RemoveCookieFunction::RespondOnUIThread, this)); DCHECK(rv); } diff --git a/chrome/browser/extensions/extension_downloads_api.cc b/chrome/browser/extensions/extension_downloads_api.cc index 0e1470e..fc98dbd 100644 --- a/chrome/browser/extensions/extension_downloads_api.cc +++ b/chrome/browser/extensions/extension_downloads_api.cc @@ -163,8 +163,8 @@ bool DownloadsDownloadFunction::ParseArgs() { void DownloadsDownloadFunction::RunInternal() { VLOG(1) << __FUNCTION__ << " " << iodata_->url.spec(); - if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod( - this, &DownloadsDownloadFunction::BeginDownloadOnIOThread))) { + if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( + &DownloadsDownloadFunction::BeginDownloadOnIOThread, this))) { error_ = constants::kGenericError; SendResponse(error_.empty()); } @@ -207,8 +207,8 @@ void DownloadsDownloadFunction::BeginDownloadOnIOThread() { void DownloadsDownloadFunction::OnStarted(DownloadId dl_id, net::Error error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); VLOG(1) << __FUNCTION__ << " " << dl_id << " " << error; - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( - this, &DownloadsDownloadFunction::RespondOnUIThread, + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( + &DownloadsDownloadFunction::RespondOnUIThread, this, dl_id.local(), error)); } diff --git a/chrome/browser/extensions/extension_error_reporter.cc b/chrome/browser/extensions/extension_error_reporter.cc index a33ce99..0cfb883 100644 --- a/chrome/browser/extensions/extension_error_reporter.cc +++ b/chrome/browser/extensions/extension_error_reporter.cc @@ -6,16 +6,13 @@ #include "build/build_config.h" +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/browser/simple_message_box.h" -// No AddRef required when using ExtensionErrorReporter with RunnableMethod. -// This is okay since the ExtensionErrorReporter is a singleton that lives until -// the end of the process. -DISABLE_RUNNABLE_METHOD_REFCOUNT(ExtensionErrorReporter); - ExtensionErrorReporter* ExtensionErrorReporter::instance_ = NULL; // static @@ -42,9 +39,13 @@ void ExtensionErrorReporter::ReportError(const std::string& message, bool be_noisy) { // NOTE: There won't be a ui_loop_ in the unit test environment. if (ui_loop_ && MessageLoop::current() != ui_loop_) { + // base::Unretained is okay since the ExtensionErrorReporter is a singleton + // that lives until the end of the process. ui_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &ExtensionErrorReporter::ReportError, message, - be_noisy)); + base::Bind(&ExtensionErrorReporter::ReportError, + base::Unretained(this), + message, + be_noisy)); return; } diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc index 3b88961..7f662ea 100644 --- a/chrome/browser/extensions/extension_event_router.cc +++ b/chrome/browser/extensions/extension_event_router.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension_event_router.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/values.h" #include "chrome/browser/extensions/extension_devtools_manager.h" @@ -140,7 +141,7 @@ void ExtensionEventRouter::RemoveEventListener( BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableFunction( + base::Bind( &NotifyEventListenerRemovedOnIOThread, profile_, listener.extension_id, event_name)); } diff --git a/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc b/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc index 4a785d6..a128cd6 100644 --- a/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc +++ b/chrome/browser/extensions/extension_event_router_forwarder_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension_event_router_forwarder.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/system_monitor/system_monitor.h" #include "base/test/thread_test_helper.h" @@ -117,9 +118,9 @@ TEST_F(ExtensionEventRouterForwarderTest, BroadcastRendererIO) { CallExtensionEventRouter( profile2_, "", kEventName, kEventArgs, profile2_, url)); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - event_router.get(), + base::Bind( &MockExtensionEventRouterForwarder::BroadcastEventToRenderers, + event_router.get(), std::string(kEventName), std::string(kEventArgs), url)); // Wait for IO thread's message loop to be processed diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index cd1d740..a89d38b 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -5,13 +5,13 @@ #include "chrome/browser/extensions/extension_file_browser_private_api.h" #include "base/base64.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/json/json_writer.h" #include "base/logging.h" #include "base/memory/singleton.h" #include "base/stringprintf.h" #include "base/string_util.h" -#include "base/task.h" #include "base/time.h" #include "base/values.h" #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" @@ -347,8 +347,9 @@ class LocalFileSystemCallbackDispatcher BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(function_, + base::Bind( &RequestLocalFileSystemFunction::RespondSuccessOnUIThread, + function_, name, root_path)); } @@ -356,8 +357,9 @@ class LocalFileSystemCallbackDispatcher virtual void DidFail(base::PlatformFileError error_code) OVERRIDE { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(function_, + base::Bind( &RequestLocalFileSystemFunction::RespondFailedOnUIThread, + function_, error_code)); } @@ -435,8 +437,9 @@ bool RequestLocalFileSystemFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &RequestLocalFileSystemFunction::RequestOnFileThread, + this, source_url_, render_view_host()->process()->id())); // Will finish asynchronously. @@ -504,8 +507,9 @@ bool FileWatchBrowserFunctionBase::RunImpl() { GURL file_watch_url(url); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &FileWatchBrowserFunctionBase::RunFileWatchOperationOnFileThread, + this, file_watch_url, extension_id())); @@ -520,21 +524,24 @@ void FileWatchBrowserFunctionBase::RunFileWatchOperationOnFileThread( local_path == FilePath()) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &FileWatchBrowserFunctionBase::RespondOnUIThread, + this, false)); } if (!PerformFileWatchOperation(local_path, virtual_path, extension_id)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &FileWatchBrowserFunctionBase::RespondOnUIThread, + this, false)); } BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &FileWatchBrowserFunctionBase::RespondOnUIThread, + this, true)); } @@ -671,15 +678,17 @@ class ExecuteTasksFileSystemCallbackDispatcher if (file_list.empty()) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(function_, - &ExecuteTasksFileBrowserFunction::ExecuteFailedOnUIThread)); + base::Bind( + &ExecuteTasksFileBrowserFunction::ExecuteFailedOnUIThread, + function_)); return; } BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(function_, + base::Bind( &ExecuteTasksFileBrowserFunction::ExecuteFileActionsOnUIThread, + function_, task_id_, file_system_name, file_system_root, @@ -689,8 +698,9 @@ class ExecuteTasksFileSystemCallbackDispatcher virtual void DidFail(base::PlatformFileError error_code) OVERRIDE { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(function_, - &ExecuteTasksFileBrowserFunction::ExecuteFailedOnUIThread)); + base::Bind( + &ExecuteTasksFileBrowserFunction::ExecuteFailedOnUIThread, + function_)); } private: @@ -839,8 +849,9 @@ bool ExecuteTasksFileBrowserFunction::InitiateFileTaskExecution( // Get local file system instance on file thread. BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread, + this, source_url_, task_id, file_urls)); @@ -1014,8 +1025,9 @@ void FileBrowserFunction::GetLocalPathsOnFileThread(const UrlList& file_urls, BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &FileBrowserFunction::GetLocalPathsResponseOnUIThread, + this, selected_files, context)); } @@ -1030,8 +1042,9 @@ bool SelectFileFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &SelectFileFunction::GetLocalPathsOnFileThread, + this, file_paths, reinterpret_cast<void*>(NULL))); return true; @@ -1082,8 +1095,9 @@ bool ViewFilesFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &ViewFilesFunction::GetLocalPathsOnFileThread, + this, file_urls, reinterpret_cast<void*>(new std::string(internal_task_id)))); @@ -1133,8 +1147,9 @@ bool SelectFilesFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &SelectFilesFunction::GetLocalPathsOnFileThread, + this, file_urls, reinterpret_cast<void*>(NULL))); return true; @@ -1205,8 +1220,9 @@ bool AddMountFunction::RunImpl() { MountParamaters* params = new MountParamaters(mount_type_str, options); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &AddMountFunction::GetLocalPathsOnFileThread, + this, file_paths, reinterpret_cast<void*>(params))); #endif // OS_CHROMEOS @@ -1267,8 +1283,9 @@ bool RemoveMountFunction::RunImpl() { file_paths.push_back(GURL(mount_path)); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &RemoveMountFunction::GetLocalPathsOnFileThread, + this, file_paths, reinterpret_cast<void*>(NULL))); return true; } @@ -1341,8 +1358,9 @@ bool GetSizeStatsFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &GetSizeStatsFunction::GetLocalPathsOnFileThread, + this, mount_paths, reinterpret_cast<void*>(NULL))); return true; } @@ -1358,8 +1376,9 @@ void GetSizeStatsFunction::GetLocalPathsResponseOnUIThread( BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &GetSizeStatsFunction::CallGetSizeStatsOnFileThread, + this, files[0].value().c_str())); } @@ -1376,8 +1395,9 @@ void GetSizeStatsFunction::CallGetSizeStatsOnFileThread( BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, + bsae::Bind( &GetSizeStatsFunction::GetSizeStatsCallbackOnUIThread, + this, mount_path, total_size_kb, remaining_size_kb)); } @@ -1416,8 +1436,9 @@ bool FormatDeviceFunction::RunImpl() { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(this, + base::Bind( &FormatDeviceFunction::GetLocalPathsOnFileThread, + this, file_paths, reinterpret_cast<void*>(NULL))); return true; } diff --git a/chrome/browser/extensions/extension_gallery_install_apitest.cc b/chrome/browser/extensions/extension_gallery_install_apitest.cc index bf3a580..16daa73 100644 --- a/chrome/browser/extensions/extension_gallery_install_apitest.cc +++ b/chrome/browser/extensions/extension_gallery_install_apitest.cc @@ -7,6 +7,7 @@ #include "base/win/windows_version.h" #endif // defined (OS_WIN) +#include "base/bind.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_webstore_private_api.h" #include "chrome/common/chrome_notification_types.h" @@ -39,9 +40,9 @@ class GalleryInstallApiTestObserver : ExtensionInstallUI* prompt = Source<ExtensionInstallUI>(source).ptr(); CHECK(prompt->delegate_); MessageLoop::current()->PostTask( - FROM_HERE, NewRunnableMethod( - this, + FROM_HERE, base::Bind( &GalleryInstallApiTestObserver::InstallUIProceed, + this, prompt->delegate_)); } diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 2a03197..bbaf432 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -6,7 +6,9 @@ #include <list> +#include "base/bind.h" #include "base/memory/singleton.h" +#include "base/memory/weak_ptr.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/string_util.h" @@ -93,14 +95,14 @@ class ExtensionHost::ProcessCreationQueue { friend struct DefaultSingletonTraits<ProcessCreationQueue>; ProcessCreationQueue() : pending_create_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { } + ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) { } // Queue up a delayed task to process the next ExtensionHost in the queue. void PostTask() { if (!pending_create_) { MessageLoop::current()->PostTask(FROM_HERE, - method_factory_.NewRunnableMethod( - &ProcessCreationQueue::ProcessOneHost)); + base::Bind(&ProcessCreationQueue::ProcessOneHost, + ptr_factory_.GetWeakPtr())); pending_create_ = true; } } @@ -121,7 +123,7 @@ class ExtensionHost::ProcessCreationQueue { typedef std::list<ExtensionHost*> Queue; Queue queue_; bool pending_create_; - ScopedRunnableMethodFactory<ProcessCreationQueue> method_factory_; + base::WeakPtrFactory<ProcessCreationQueue> ptr_factory_; }; //////////////// diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc index 7db4f60..e638801 100644 --- a/chrome/browser/extensions/extension_management_api.cc +++ b/chrome/browser/extensions/extension_management_api.cc @@ -7,6 +7,7 @@ #include <map> #include <string> +#include "base/bind.h" #include "base/basictypes.h" #include "base/json/json_writer.h" #include "base/metrics/histogram.h" @@ -211,7 +212,7 @@ class SafeManifestJSONParser : public UtilityProcessHost::Client { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &SafeManifestJSONParser::StartWorkOnIOThread)); + base::Bind(&SafeManifestJSONParser::StartWorkOnIOThread, this)); } void StartWorkOnIOThread() { @@ -245,8 +246,7 @@ class SafeManifestJSONParser : public UtilityProcessHost::Client { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &SafeManifestJSONParser::ReportResultFromUIThread)); + base::Bind(&SafeManifestJSONParser::ReportResultFromUIThread, this)); } void OnJSONParseFailed(const std::string& error) { @@ -256,8 +256,7 @@ class SafeManifestJSONParser : public UtilityProcessHost::Client { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &SafeManifestJSONParser::ReportResultFromUIThread)); + base::Bind(&SafeManifestJSONParser::ReportResultFromUIThread, this)); } void ReportResultFromUIThread() { diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 835064d..ab689c5 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <set> +#include "base/bind.h" #include "base/basictypes.h" #include "base/callback.h" #include "base/command_line.h" @@ -316,9 +317,8 @@ void ExtensionServiceBackend::LoadSingleExtension(const FilePath& path_in, file_util::AbsolutePath(&extension_path); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, - &ExtensionServiceBackend::CheckExtensionFileAccess, - extension_path, prompt_for_plugins)); + base::Bind(&ExtensionServiceBackend::CheckExtensionFileAccess, + this, extension_path, prompt_for_plugins)); } void ExtensionServiceBackend::CheckExtensionFileAccess( @@ -333,10 +333,9 @@ void ExtensionServiceBackend::CheckExtensionFileAccess( allow_file_access = frontend_->extension_prefs()->AllowFileAccess(id); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - NewRunnableMethod( - this, + base::Bind( &ExtensionServiceBackend::LoadSingleExtensionWithFileAccess, - extension_path, allow_file_access, prompt_for_plugins)); + this, extension_path, allow_file_access, prompt_for_plugins)); } void ExtensionServiceBackend::LoadSingleExtensionWithFileAccess( @@ -357,9 +356,9 @@ void ExtensionServiceBackend::LoadSingleExtensionWithFileAccess( if (!extension) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod( - this, + base::Bind( &ExtensionServiceBackend::ReportExtensionLoadError, + this, extension_path, error)); return; } @@ -367,10 +366,9 @@ void ExtensionServiceBackend::LoadSingleExtensionWithFileAccess( // Report this as an installed extension so that it gets remembered in the // prefs. BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - NewRunnableMethod( - this, + base::Bind( &ExtensionServiceBackend::OnLoadSingleExtension, - extension, prompt_for_plugins)); + this, extension, prompt_for_plugins)); } void ExtensionServiceBackend::ReportExtensionLoadError( @@ -591,7 +589,6 @@ ExtensionService::ExtensionService(Profile* profile, bool autoupdate_enabled, bool extensions_enabled) : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), - method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), profile_(profile), extension_prefs_(extension_prefs), extension_settings_frontend_( @@ -796,7 +793,7 @@ bool ExtensionService::UpdateExtension( // that would do it for us. if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction( + base::Bind( extension_file_util::DeleteFile, extension_path, false))) NOTREACHED(); @@ -937,7 +934,7 @@ bool ExtensionService::UninstallExtension( if (Extension::LOAD != extension->location()) { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction( + base::Bind( &extension_file_util::UninstallExtension, install_directory_, extension_id))) @@ -1127,9 +1124,8 @@ void ExtensionService::LoadExtension(const FilePath& extension_path) { void ExtensionService::LoadExtension(const FilePath& extension_path, bool prompt_for_plugins) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - NewRunnableMethod(backend_.get(), - &ExtensionServiceBackend::LoadSingleExtension, - extension_path, prompt_for_plugins)); + base::Bind(&ExtensionServiceBackend::LoadSingleExtension, backend_.get(), + extension_path, prompt_for_plugins)); } void ExtensionService::LoadExtensionFromCommandLine( @@ -1628,8 +1624,7 @@ void ExtensionService::NotifyExtensionUnloaded( for (size_t i = 0; i < extension->plugins().size(); ++i) { const Extension::PluginInfo& plugin = extension->plugins()[i]; if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - NewRunnableFunction(&ForceShutdownPlugin, - plugin.path))) + base::Bind(&ForceShutdownPlugin, plugin.path))) NOTREACHED(); webkit::npapi::PluginList::Singleton()->RefreshPlugins(); webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath( @@ -2333,7 +2328,7 @@ void ExtensionService::GarbageCollectExtensions() { if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction( + base::Bind( &extension_file_util::GarbageCollectExtensions, install_directory_, extension_paths))) @@ -2570,8 +2565,8 @@ void ExtensionService::OnExtensionInstalled( // load it. if (!BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction(&extension_file_util::DeleteFile, - extension->path(), true))) + base::Bind(&extension_file_util::DeleteFile, + extension->path(), true))) NOTREACHED(); return; } @@ -2827,8 +2822,9 @@ void ExtensionService::Observe(int type, // access to the Extension and ExtensionHost. MessageLoop::current()->PostTask( FROM_HERE, - method_factory_.NewRunnableMethod( + base::Bind( &ExtensionService::TrackTerminatedExtension, + weak_ptr_factory_.GetWeakPtr(), host->extension())); break; } diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 85b6ae2..b99831c 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -18,7 +18,6 @@ #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/task.h" #include "base/time.h" #include "base/tuple.h" #include "chrome/browser/extensions/apps_promo.h" @@ -688,8 +687,6 @@ class ExtensionService base::WeakPtrFactory<ExtensionService> weak_ptr_factory_; - ScopedRunnableMethodFactory<ExtensionService> method_factory_; - // The profile this ExtensionService is part of. Profile* profile_; diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 4c42e24..ff89e5e2 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -22,7 +22,6 @@ #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/task.h" #include "base/utf_string_conversions.h" #include "base/version.h" #include "chrome/browser/browser_process.h" @@ -335,9 +334,9 @@ class ExtensionTestingProfile : public TestingProfile { appcache_service_ = new ChromeAppCacheService(NULL); if (!BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - appcache_service_.get(), + base::Bind( &ChromeAppCacheService::InitializeOnIOThread, + appcache_service_.get(), IsOffTheRecord() ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), &GetResourceContext(), diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc index de58fb9..05e0805 100644 --- a/chrome/browser/extensions/extension_special_storage_policy.cc +++ b/chrome/browser/extensions/extension_special_storage_policy.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/extension_special_storage_policy.h" +#include "base/bind.h" #include "base/logging.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/common/content_settings.h" @@ -121,8 +122,7 @@ void ExtensionSpecialStoragePolicy::RevokeRightsForAllExtensions() { void ExtensionSpecialStoragePolicy::NotifyChanged() { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, - &ExtensionSpecialStoragePolicy::NotifyChanged)); + base::Bind(&ExtensionSpecialStoragePolicy::NotifyChanged, this)); return; } SpecialStoragePolicy::NotifyObservers(); diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc index 1c92c03..fd45169 100644 --- a/chrome/browser/extensions/extension_tab_id_map.cc +++ b/chrome/browser/extensions/extension_tab_id_map.cc @@ -4,6 +4,8 @@ #include "chrome/browser/extensions/extension_tab_id_map.h" +#include "base/bind.h" +#include "base/bind_helpers.h" #include "chrome/browser/sessions/restore_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "content/browser/browser_thread.h" @@ -14,9 +16,6 @@ #include "content/common/notification_observer.h" #include "content/common/notification_service.h" -// ExtensionTabIdMap is a Singleton, so it doesn't need refcounting. -DISABLE_RUNNABLE_METHOD_REFCOUNT(ExtensionTabIdMap); - // // ExtensionTabIdMap::TabObserver // @@ -67,9 +66,9 @@ void ExtensionTabIdMap::TabObserver::Observe( // have been set yet. BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - ExtensionTabIdMap::GetInstance(), + base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, + base::Unretained(ExtensionTabIdMap::GetInstance()), host->process()->id(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); @@ -80,9 +79,9 @@ void ExtensionTabIdMap::TabObserver::Observe( RenderViewHost* host = tab->render_view_host(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - ExtensionTabIdMap::GetInstance(), + base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, + base::Unretained(ExtensionTabIdMap::GetInstance()), host->process()->id(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); @@ -92,9 +91,9 @@ void ExtensionTabIdMap::TabObserver::Observe( RenderViewHost* host = Source<RenderViewHost>(source).ptr(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - ExtensionTabIdMap::GetInstance(), + base::Bind( &ExtensionTabIdMap::ClearTabAndWindowId, + base::Unretained(ExtensionTabIdMap::GetInstance()), host->process()->id(), host->routing_id())); break; } diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index c460cc9..f5a07bf 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -8,6 +8,7 @@ #include <vector> #include "base/base64.h" +#include "base/bind.h" #include "base/memory/ref_counted_memory.h" #include "base/stl_util.h" #include "base/string16.h" @@ -1494,8 +1495,8 @@ bool DetectTabLanguageFunction::RunImpl() { if (!helper->language_state().original_language().empty()) { // Delay the callback invocation until after the current JS call has // returned. - MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( - this, &DetectTabLanguageFunction::GotLanguage, + MessageLoop::current()->PostTask(FROM_HERE, base::Bind( + &DetectTabLanguageFunction::GotLanguage, this, helper->language_state().original_language())); return true; } diff --git a/chrome/browser/extensions/extension_tts_api_chromeos.cc b/chrome/browser/extensions/extension_tts_api_chromeos.cc index e421897..cf58b3d 100644 --- a/chrome/browser/extensions/extension_tts_api_chromeos.cc +++ b/chrome/browser/extensions/extension_tts_api_chromeos.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/memory/singleton.h" +#include "base/memory/weak_ptr.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" -#include "base/task.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" #include "chrome/browser/extensions/extension_tts_api_controller.h" @@ -39,7 +40,7 @@ class ExtensionTtsPlatformImplChromeOs : public ExtensionTtsPlatformImpl { private: ExtensionTtsPlatformImplChromeOs() - : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {} + : ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {} virtual ~ExtensionTtsPlatformImplChromeOs() {} void PollUntilSpeechFinishes(int utterance_id); @@ -50,7 +51,7 @@ class ExtensionTtsPlatformImplChromeOs : public ExtensionTtsPlatformImpl { int utterance_id_; int utterance_length_; - ScopedRunnableMethodFactory<ExtensionTtsPlatformImplChromeOs> method_factory_; + base::WeakPtrFactory<ExtensionTtsPlatformImplChromeOs> ptr_factory_; friend struct DefaultSingletonTraits<ExtensionTtsPlatformImplChromeOs>; @@ -165,8 +166,9 @@ void ExtensionTtsPlatformImplChromeOs::PollUntilSpeechFinishes( } MessageLoop::current()->PostDelayedTask( - FROM_HERE, method_factory_.NewRunnableMethod( + FROM_HERE, base::Bind( &ExtensionTtsPlatformImplChromeOs::PollUntilSpeechFinishes, + ptr_factory_.GetWeakPtr(), utterance_id), kSpeechCheckDelayIntervalMs); } diff --git a/chrome/browser/extensions/extension_tts_apitest.cc b/chrome/browser/extensions/extension_tts_apitest.cc index a144650..71f2634 100644 --- a/chrome/browser/extensions/extension_tts_apitest.cc +++ b/chrome/browser/extensions/extension_tts_apitest.cc @@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/command_line.h" -#include "base/task.h" +#include "base/memory/weak_ptr.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_tts_api.h" #include "chrome/browser/extensions/extension_tts_api_controller.h" @@ -32,7 +33,7 @@ using ::testing::_; class MockExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { public: MockExtensionTtsPlatformImpl() - : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {} + : ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {} virtual bool PlatformImplAvailable() { return true; @@ -60,8 +61,9 @@ class MockExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { const std::string& lang, const UtteranceContinuousParameters& params) { MessageLoop::current()->PostDelayedTask( - FROM_HERE, method_factory_.NewRunnableMethod( + FROM_HERE, base::Bind( &MockExtensionTtsPlatformImpl::SendEvent, + ptr_factory_.GetWeakPtr(), false, utterance_id, TTS_EVENT_END, utterance.size(), std::string()), 0); @@ -73,8 +75,9 @@ class MockExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { const std::string& lang, const UtteranceContinuousParameters& params) { MessageLoop::current()->PostDelayedTask( - FROM_HERE, method_factory_.NewRunnableMethod( + FROM_HERE, base::Bind( &MockExtensionTtsPlatformImpl::SendEvent, + ptr_factory_.GetWeakPtr(), true, utterance_id, TTS_EVENT_END, utterance.size(), std::string()), 0); } @@ -86,8 +89,9 @@ class MockExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { for (int i = 0; i < static_cast<int>(utterance.size()); i++) { if (i == 0 || utterance[i - 1] == ' ') { MessageLoop::current()->PostDelayedTask( - FROM_HERE, method_factory_.NewRunnableMethod( + FROM_HERE, base::Bind( &MockExtensionTtsPlatformImpl::SendEvent, + ptr_factory_.GetWeakPtr(), false, utterance_id, TTS_EVENT_WORD, i, std::string()), 0); @@ -103,8 +107,9 @@ class MockExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { ExtensionTtsController* controller = ExtensionTtsController::GetInstance(); if (wait_for_non_empty_queue && controller->QueueSize() == 0) { MessageLoop::current()->PostDelayedTask( - FROM_HERE, method_factory_.NewRunnableMethod( + FROM_HERE, base::Bind( &MockExtensionTtsPlatformImpl::SendEvent, + ptr_factory_.GetWeakPtr(), true, utterance_id, event_type, char_index, message), 100); return; @@ -114,7 +119,7 @@ class MockExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { } private: - ScopedRunnableMethodFactory<MockExtensionTtsPlatformImpl> method_factory_; + base::WeakPtrFactory<MockExtensionTtsPlatformImpl> ptr_factory_; }; class TtsApiTest : public ExtensionApiTest { diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 6dc0420..716d6f5 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <set> +#include "base/bind.h" #include "base/compiler_specific.h" #include "base/file_util.h" #include "base/logging.h" @@ -105,7 +106,7 @@ void RecordCRXWriteHistogram(bool success, const FilePath& crx_path) { // can not be read. Try reading. BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, - NewRunnableFunction(CheckThatCRXIsReadable, crx_path)); + base::Bind(CheckThatCRXIsReadable, crx_path)); } } @@ -125,7 +126,7 @@ void CheckThatCRXIsReadable(const FilePath& crx_path) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableFunction(RecordFileUpdateHistogram, file_write_result)); + base::Bind(RecordFileUpdateHistogram, file_write_result)); } void RecordFileUpdateHistogram(FileWriteResult file_write_result) { @@ -477,7 +478,6 @@ ExtensionUpdater::ExtensionUpdater(ExtensionServiceInterface* service, : alive_(false), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), service_(service), frequency_seconds_(frequency_seconds), - method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), will_check_soon_(false), extension_prefs_(extension_prefs), prefs_(prefs), profile_(profile), blacklist_checks_enabled_(true), crx_install_is_running_(false) { @@ -583,7 +583,6 @@ void ExtensionUpdater::Stop() { profile_ = NULL; timer_.Stop(); will_check_soon_ = false; - method_factory_.RevokeAll(); manifest_fetcher_.reset(); extension_fetcher_.reset(); STLDeleteElements(&manifests_pending_); @@ -631,8 +630,8 @@ class SafeManifestParser : public UtilityProcessHost::Client { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod( - this, &SafeManifestParser::ParseInSandbox, + base::Bind( + &SafeManifestParser::ParseInSandbox, this, g_browser_process->resource_dispatcher_host()))) { NOTREACHED(); } @@ -655,16 +654,16 @@ class SafeManifestParser : public UtilityProcessHost::Client { if (manifest.Parse(xml_)) { if (!BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod( - this, &SafeManifestParser::OnParseUpdateManifestSucceeded, + base::Bind( + &SafeManifestParser::OnParseUpdateManifestSucceeded, this, manifest.results()))) { NOTREACHED(); } } else { if (!BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod( - this, &SafeManifestParser::OnParseUpdateManifestFailed, + base::Bind( + &SafeManifestParser::OnParseUpdateManifestFailed, this, manifest.errors()))) { NOTREACHED(); } @@ -984,8 +983,8 @@ void ExtensionUpdater::CheckSoon() { } if (BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - method_factory_.NewRunnableMethod( - &ExtensionUpdater::DoCheckSoon))) { + base::Bind(&ExtensionUpdater::DoCheckSoon, + weak_ptr_factory_.GetWeakPtr()))) { will_check_soon_ = true; } else { NOTREACHED(); diff --git a/chrome/browser/extensions/extension_updater.h b/chrome/browser/extensions/extension_updater.h index bcba5e8..e3a390d 100644 --- a/chrome/browser/extensions/extension_updater.h +++ b/chrome/browser/extensions/extension_updater.h @@ -19,7 +19,6 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/scoped_temp_dir.h" -#include "base/task.h" #include "base/time.h" #include "base/timer.h" #include "chrome/browser/extensions/extension_service.h" @@ -363,8 +362,6 @@ class ExtensionUpdater : public URLFetcher::Delegate, base::OneShotTimer<ExtensionUpdater> timer_; int frequency_seconds_; - ScopedRunnableMethodFactory<ExtensionUpdater> method_factory_; - bool will_check_soon_; ExtensionPrefs* extension_prefs_; |