diff options
Diffstat (limited to 'chromium/extensions/browser/content_verifier.cc')
-rw-r--r-- | chromium/extensions/browser/content_verifier.cc | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/chromium/extensions/browser/content_verifier.cc b/chromium/extensions/browser/content_verifier.cc index feec17b834e..6bcf0ed5134 100644 --- a/chromium/extensions/browser/content_verifier.cc +++ b/chromium/extensions/browser/content_verifier.cc @@ -16,7 +16,6 @@ #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" #include "base/strings/string_util.h" -#include "base/task/post_task.h" #include "base/threading/thread_restrictions.h" #include "base/timer/elapsed_timer.h" #include "content/public/browser/browser_context.h" @@ -324,8 +323,8 @@ class ContentVerifier::HashHelper { if (was_cancelled) return; - base::PostTask( - FROM_HERE, {content::BrowserThread::IO}, + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), content_hash, was_cancelled)); } @@ -448,8 +447,8 @@ void ContentVerifier::Start() { void ContentVerifier::Shutdown() { shutdown_on_ui_ = true; delegate_->Shutdown(); - base::PostTask(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&ContentVerifier::ShutdownOnIO, this)); + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(&ContentVerifier::ShutdownOnIO, this)); observer_.RemoveAll(); } @@ -511,8 +510,8 @@ void ContentVerifier::GetContentHash( // TODO(lazyboy): Make CreateJobFor return a scoped_refptr instead of raw // pointer to fix this. Also add unit test to exercise this code path // explicitly. - base::PostTask(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(base::DoNothing::Once<ContentHashCallback>(), + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(base::DoNothing::Once<ContentHashCallback>(), std::move(callback))); return; } @@ -522,8 +521,8 @@ void ContentVerifier::GetContentHash( auto cache_iter = cache_.find(cache_key); if (cache_iter != cache_.end()) { // Currently, we expect |callback| to be called asynchronously. - base::PostTask(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(std::move(callback), cache_iter->second)); + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), cache_iter->second)); return; } @@ -549,8 +548,8 @@ bool ContentVerifier::ShouldComputeHashesOnInstall(const Extension& extension) { void ContentVerifier::VerifyFailed(const ExtensionId& extension_id, ContentVerifyJob::FailureReason reason) { if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { - base::PostTask(FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce(&ContentVerifier::VerifyFailed, this, + content::GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(&ContentVerifier::VerifyFailed, this, extension_id, reason)); return; } @@ -572,8 +571,8 @@ void ContentVerifier::OnExtensionLoaded( std::unique_ptr<ContentVerifierIOData::ExtensionData> io_data = CreateIOData(extension, delegate_.get()); if (io_data) { - base::PostTask(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&ContentVerifier::OnExtensionLoadedOnIO, this, + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(&ContentVerifier::OnExtensionLoadedOnIO, this, extension->id(), extension->path(), extension->version(), std::move(io_data))); } @@ -600,8 +599,8 @@ void ContentVerifier::OnExtensionUnloaded( UnloadedExtensionReason reason) { if (shutdown_on_ui_) return; - base::PostTask(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(&ContentVerifier::OnExtensionUnloadedOnIO, this, + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(&ContentVerifier::OnExtensionUnloadedOnIO, this, extension->id(), extension->version())); } @@ -679,8 +678,8 @@ ContentHash::FetchKey ContentVerifier::GetFetchKey( // even though it needs to finish initialization on the UI thread. mojo::PendingRemote<network::mojom::URLLoaderFactory> url_loader_factory_remote; - base::PostTask( - FROM_HERE, {content::BrowserThread::UI}, + content::GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce( &ContentVerifier::BindURLLoaderFactoryReceiverOnUIThread, this, url_loader_factory_remote.InitWithNewPipeAndPassReceiver())); |