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

Side by Side Diff: chrome/browser/chromeos/platform_keys/platform_keys.cc

Issue 2534513002: Use TaskScheduler instead of WorkerPool in platform_keys.cc. (Closed)
Patch Set: add comment about priority Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/platform_keys/platform_keys.h" 5 #include "chrome/browser/chromeos/platform_keys/platform_keys.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/task_scheduler/post_task.h"
14 #include "net/base/hash_value.h" 14 #include "net/base/hash_value.h"
15 #include "net/cert/x509_certificate.h" 15 #include "net/cert/x509_certificate.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 namespace platform_keys { 19 namespace platform_keys {
20 20
21 namespace { 21 namespace {
22 22
23 void IntersectOnWorkerThread(const net::CertificateList& certs1, 23 void IntersectOnWorkerThread(const net::CertificateList& certs1,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 ClientCertificateRequest::~ClientCertificateRequest() { 59 ClientCertificateRequest::~ClientCertificateRequest() {
60 } 60 }
61 61
62 void IntersectCertificates( 62 void IntersectCertificates(
63 const net::CertificateList& certs1, 63 const net::CertificateList& certs1,
64 const net::CertificateList& certs2, 64 const net::CertificateList& certs2,
65 const base::Callback<void(std::unique_ptr<net::CertificateList>)>& 65 const base::Callback<void(std::unique_ptr<net::CertificateList>)>&
66 callback) { 66 callback) {
67 std::unique_ptr<net::CertificateList> intersection(new net::CertificateList); 67 std::unique_ptr<net::CertificateList> intersection(new net::CertificateList);
68 net::CertificateList* const intersection_ptr = intersection.get(); 68 net::CertificateList* const intersection_ptr = intersection.get();
69 if (!base::WorkerPool::PostTaskAndReply( 69
70 FROM_HERE, base::Bind(&IntersectOnWorkerThread, certs1, certs2, 70 // This is triggered by a call to the
71 intersection_ptr), 71 // chrome.platformKeys.selectClientCertificates extensions API. Completion
72 base::Bind(callback, base::Passed(&intersection)), 72 // does not affect browser responsiveness, hence the BACKGROUND priority.
73 false /* task_is_slow */)) { 73 base::PostTaskWithTraitsAndReply(
74 callback.Run(base::WrapUnique(new net::CertificateList)); 74 FROM_HERE, base::TaskTraits()
75 } 75 .WithPriority(base::TaskPriority::BACKGROUND)
76 .WithShutdownBehavior(
77 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
78 base::Bind(&IntersectOnWorkerThread, certs1, certs2, intersection_ptr),
79 base::Bind(callback, base::Passed(&intersection)));
76 } 80 }
77 81
78 } // namespace platform_keys 82 } // namespace platform_keys
79 83
80 } // namespace chromeos 84 } // namespace chromeos
OLDNEW
« 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