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

Side by Side Diff: chrome/browser/chromeos/net/client_cert_store_chromeos.cc

Issue 2720143003: Revert of Use TaskScheduler instead of WorkerPool in client_cert_store_chromeos.cc. (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/net/client_cert_store_chromeos.h" 5 #include "chrome/browser/chromeos/net/client_cert_store_chromeos.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/task_scheduler/post_task.h" 15 #include "base/threading/worker_pool.h"
16 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" 16 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h"
17 #include "crypto/nss_crypto_module_delegate.h" 17 #include "crypto/nss_crypto_module_delegate.h"
18 #include "net/ssl/ssl_cert_request_info.h" 18 #include "net/ssl/ssl_cert_request_info.h"
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 namespace { 22 namespace {
23 23
24 class CertNotAllowedPredicate { 24 class CertNotAllowedPredicate {
25 public: 25 public:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const net::SSLCertRequestInfo* request, 74 const net::SSLCertRequestInfo* request,
75 net::CertificateList* selected_certs, 75 net::CertificateList* selected_certs,
76 const base::Closure& callback, 76 const base::Closure& callback,
77 const net::CertificateList& additional_certs) { 77 const net::CertificateList& additional_certs) {
78 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> 78 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate>
79 password_delegate; 79 password_delegate;
80 if (!password_delegate_factory_.is_null()) { 80 if (!password_delegate_factory_.is_null()) {
81 password_delegate.reset( 81 password_delegate.reset(
82 password_delegate_factory_.Run(request->host_and_port)); 82 password_delegate_factory_.Run(request->host_and_port));
83 } 83 }
84 base::PostTaskWithTraitsAndReply( 84 if (base::WorkerPool::PostTaskAndReply(
gab 2017/02/28 01:42:40 Probably don't need to bring back handling PostTas
85 FROM_HERE, base::TaskTraits().MayBlock().WithShutdownBehavior( 85 FROM_HERE,
86 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), 86 base::Bind(&ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread,
87 base::Bind(&ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread, 87 base::Unretained(this), base::Passed(&password_delegate),
88 base::Unretained(this), base::Passed(&password_delegate), 88 request, additional_certs, selected_certs),
89 request, additional_certs, selected_certs), 89 callback, true)) {
90 callback); 90 return;
91 }
92 // If the task could not be posted, behave as if there were no certificates
93 // which requires to clear |selected_certs|.
94 selected_certs->clear();
95 callback.Run();
91 } 96 }
92 97
93 void ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread( 98 void ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread(
94 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> 99 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate>
95 password_delegate, 100 password_delegate,
96 const net::SSLCertRequestInfo* request, 101 const net::SSLCertRequestInfo* request,
97 const net::CertificateList& additional_certs, 102 const net::CertificateList& additional_certs,
98 net::CertificateList* selected_certs) { 103 net::CertificateList* selected_certs) {
99 net::CertificateList unfiltered_certs; 104 net::CertificateList unfiltered_certs;
100 net::ClientCertStoreNSS::GetPlatformCertsOnWorkerThread( 105 net::ClientCertStoreNSS::GetPlatformCertsOnWorkerThread(
101 std::move(password_delegate), &unfiltered_certs); 106 std::move(password_delegate), &unfiltered_certs);
102 107
103 unfiltered_certs.erase( 108 unfiltered_certs.erase(
104 std::remove_if(unfiltered_certs.begin(), unfiltered_certs.end(), 109 std::remove_if(unfiltered_certs.begin(), unfiltered_certs.end(),
105 CertNotAllowedPredicate(cert_filter_.get())), 110 CertNotAllowedPredicate(cert_filter_.get())),
106 unfiltered_certs.end()); 111 unfiltered_certs.end());
107 112
108 unfiltered_certs.insert(unfiltered_certs.end(), additional_certs.begin(), 113 unfiltered_certs.insert(unfiltered_certs.end(), additional_certs.begin(),
109 additional_certs.end()); 114 additional_certs.end());
110 115
111 net::ClientCertStoreNSS::FilterCertsOnWorkerThread(unfiltered_certs, *request, 116 net::ClientCertStoreNSS::FilterCertsOnWorkerThread(unfiltered_certs, *request,
112 selected_certs); 117 selected_certs);
113 } 118 }
114 119
115 } // namespace chromeos 120 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698