Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc

Issue 2526283004: Use TaskScheduler instead of WorkerPool in platform_keys_nss.cc. (Closed)
Patch Set: add WithWait() Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
index 35366dc177c0b411e1dddb260d31acccd122b880..bb10f16f06626baded58aa35038b64ebc54273d0 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
@@ -20,8 +20,8 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "base/threading/worker_pool.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part_chromeos.h"
#include "chrome/browser/chromeos/certificate_provider/certificate_provider.h"
@@ -441,10 +441,15 @@ void GenerateRSAKeyWithDB(std::unique_ptr<GenerateRSAKeyState> state,
net::NSSCertDatabase* cert_db) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Only the slot and not the NSSCertDatabase is required. Ignore |cert_db|.
- base::WorkerPool::PostTask(
- FROM_HERE,
- base::Bind(&GenerateRSAKeyOnWorkerThread, base::Passed(&state)),
- true /*task is slow*/);
+ // This task interacts with the TPM, hence WithFileIO() and WithWait().
+ base::PostTaskWithTraits(
+ FROM_HERE, base::TaskTraits()
+ .WithFileIO()
+ .WithWait()
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
+ base::Bind(&GenerateRSAKeyOnWorkerThread, base::Passed(&state)));
}
// Does the actual signing on a worker thread. Used by SignRSAWithDB().
@@ -533,9 +538,15 @@ void SignRSAWithDB(std::unique_ptr<SignRSAState> state,
net::NSSCertDatabase* cert_db) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// Only the slot and not the NSSCertDatabase is required. Ignore |cert_db|.
- base::WorkerPool::PostTask(
- FROM_HERE, base::Bind(&SignRSAOnWorkerThread, base::Passed(&state)),
- true /*task is slow*/);
+ // This task interacts with the TPM, hence WithFileIO() and WithWait().
+ base::PostTaskWithTraits(
+ FROM_HERE, base::TaskTraits()
+ .WithFileIO()
+ .WithWait()
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
+ base::Bind(&SignRSAOnWorkerThread, base::Passed(&state)));
}
// Called when ClientCertStoreChromeOS::GetClientCerts is done. Builds the list
@@ -598,10 +609,15 @@ void DidGetCertificates(std::unique_ptr<GetCertificatesState> state,
std::unique_ptr<net::CertificateList> all_certs) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
state->certs_ = std::move(all_certs);
- base::WorkerPool::PostTask(
- FROM_HERE,
- base::Bind(&FilterCertificatesOnWorkerThread, base::Passed(&state)),
- true /*task is slow*/);
+ // This task interacts with the TPM, hence WithFileIO() and WithWait().
+ base::PostTaskWithTraits(
+ FROM_HERE, base::TaskTraits()
+ .WithFileIO()
+ .WithWait()
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
+ base::Bind(&FilterCertificatesOnWorkerThread, base::Passed(&state)));
}
// Continues getting certificates with the obtained NSSCertDatabase. Used by
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698