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

Unified Diff: crypto/nss_util.cc

Issue 2610463002: Use TaskScheduler instead of WorkerPool in nss_util.cc. (Closed)
Patch Set: Created 3 years, 12 months 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: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index f26bf0979a6ad2181d216fb2049a3255315fc419..73fdf1efa2743eed9a5dc7aea418c71a272e5c9f 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -17,6 +17,7 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "crypto/nss_util_internal.h"
@@ -49,7 +50,6 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_restrictions.h"
-#include "base/threading/worker_pool.h"
#include "build/build_config.h"
#include "crypto/nss_crypto_module_delegate.h"
@@ -365,22 +365,17 @@ class NSSInitSingleton {
std::unique_ptr<TPMModuleAndSlot> tpm_args(
new TPMModuleAndSlot(chaps_module_));
TPMModuleAndSlot* tpm_args_ptr = tpm_args.get();
- if (base::WorkerPool::PostTaskAndReply(
- FROM_HERE,
- base::Bind(&NSSInitSingleton::InitializeTPMTokenOnWorkerThread,
- system_slot_id,
- tpm_args_ptr),
- base::Bind(&NSSInitSingleton::OnInitializedTPMTokenAndSystemSlot,
- base::Unretained(this), // NSSInitSingleton is leaky
- callback,
- base::Passed(&tpm_args)),
- true /* task_is_slow */
- )) {
- initializing_tpm_token_ = true;
- } else {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(callback, false));
- }
+ base::PostTaskWithTraitsAndReply(
+ FROM_HERE, base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .MayBlock(),
+ base::Bind(&NSSInitSingleton::InitializeTPMTokenOnWorkerThread,
+ system_slot_id, tpm_args_ptr),
+ base::Bind(&NSSInitSingleton::OnInitializedTPMTokenAndSystemSlot,
+ base::Unretained(this), // NSSInitSingleton is leaky
+ callback, base::Passed(&tpm_args)));
+ initializing_tpm_token_ = true;
}
static void InitializeTPMTokenOnWorkerThread(CK_SLOT_ID token_slot_id,
@@ -528,17 +523,16 @@ class NSSInitSingleton {
std::unique_ptr<TPMModuleAndSlot> tpm_args(
new TPMModuleAndSlot(chaps_module_));
TPMModuleAndSlot* tpm_args_ptr = tpm_args.get();
- base::WorkerPool::PostTaskAndReply(
- FROM_HERE,
- base::Bind(&NSSInitSingleton::InitializeTPMTokenOnWorkerThread,
- slot_id,
+ base::PostTaskWithTraitsAndReply(
+ FROM_HERE, base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .MayBlock(),
+ base::Bind(&NSSInitSingleton::InitializeTPMTokenOnWorkerThread, slot_id,
tpm_args_ptr),
base::Bind(&NSSInitSingleton::OnInitializedTPMForChromeOSUser,
base::Unretained(this), // NSSInitSingleton is leaky
- username_hash,
- base::Passed(&tpm_args)),
- true /* task_is_slow */
- );
+ username_hash, base::Passed(&tpm_args)));
}
void OnInitializedTPMForChromeOSUser(
« 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