Commit 7d184215 authored by fdoray's avatar fdoray Committed by Commit bot

Use TaskScheduler instead of WorkerPool in platform_keys.cc.

This CL replaces base::WorkerPool::PostTask() with
base::PostTaskWithTraits(). The following traits are used:

Priority: BACKGROUND
  User won't notice if this task takes an arbitrarily long time
  to complete.

Shutdown behavior: CONTINUE_ON_SHUTDOWN
  Tasks posted with this mode which have not started executing before
  shutdown is initiated will never run. Tasks with this mode running at
  shutdown will be ignored (the worker will not be joined).

No File IO (default):
  The task does not perform synchronous IO operations.

No Wait (default):
  The task does not wait on things other than synchronous file IO
  operations (e.g. WaitableEvent, ConditionVariable, join a thread,
  join a process, blocking system call that doesn't involve
  interactions with the file system).

BUG=659191

Review-Url: https://codereview.chromium.org/2534513002
Cr-Commit-Position: refs/heads/master@{#435057}
parent 0c923444
......@@ -10,7 +10,7 @@
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/threading/worker_pool.h"
#include "base/task_scheduler/post_task.h"
#include "net/base/hash_value.h"
#include "net/cert/x509_certificate.h"
......@@ -66,13 +66,17 @@ void IntersectCertificates(
callback) {
std::unique_ptr<net::CertificateList> intersection(new net::CertificateList);
net::CertificateList* const intersection_ptr = intersection.get();
if (!base::WorkerPool::PostTaskAndReply(
FROM_HERE, base::Bind(&IntersectOnWorkerThread, certs1, certs2,
intersection_ptr),
base::Bind(callback, base::Passed(&intersection)),
false /* task_is_slow */)) {
callback.Run(base::WrapUnique(new net::CertificateList));
}
// This is triggered by a call to the
// chrome.platformKeys.selectClientCertificates extensions API. Completion
// does not affect browser responsiveness, hence the BACKGROUND priority.
base::PostTaskWithTraitsAndReply(
FROM_HERE, base::TaskTraits()
.WithPriority(base::TaskPriority::BACKGROUND)
.WithShutdownBehavior(
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
base::Bind(&IntersectOnWorkerThread, certs1, certs2, intersection_ptr),
base::Bind(callback, base::Passed(&intersection)));
}
} // namespace platform_keys
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment