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

Side by Side Diff: net/cert/nss_cert_database_chromeos.cc

Issue 2722733002: Revert of Use TaskScheduler instead of WorkerPool in nss_cert_database.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
« no previous file with comments | « net/cert/nss_cert_database.cc ('k') | net/cert/nss_cert_database_chromeos_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/cert/nss_cert_database_chromeos.h" 5 #include "net/cert/nss_cert_database_chromeos.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <pk11pub.h> 8 #include <pk11pub.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/task_scheduler/post_task.h" 17 #include "base/task_runner.h"
18 #include "net/base/crypto_module.h" 18 #include "net/base/crypto_module.h"
19 #include "net/cert/x509_certificate.h" 19 #include "net/cert/x509_certificate.h"
20 20
21 namespace net { 21 namespace net {
22 22
23 NSSCertDatabaseChromeOS::NSSCertDatabaseChromeOS( 23 NSSCertDatabaseChromeOS::NSSCertDatabaseChromeOS(
24 crypto::ScopedPK11Slot public_slot, 24 crypto::ScopedPK11Slot public_slot,
25 crypto::ScopedPK11Slot private_slot) 25 crypto::ScopedPK11Slot private_slot)
26 : NSSCertDatabase(std::move(public_slot), std::move(private_slot)) { 26 : NSSCertDatabase(std::move(public_slot), std::move(private_slot)) {
27 // By default, don't use a system slot. Only if explicitly set by 27 // By default, don't use a system slot. Only if explicitly set by
(...skipping 14 matching lines...) Expand all
42 void NSSCertDatabaseChromeOS::ListCertsSync(CertificateList* certs) { 42 void NSSCertDatabaseChromeOS::ListCertsSync(CertificateList* certs) {
43 ListCertsImpl(profile_filter_, certs); 43 ListCertsImpl(profile_filter_, certs);
44 } 44 }
45 45
46 void NSSCertDatabaseChromeOS::ListCerts( 46 void NSSCertDatabaseChromeOS::ListCerts(
47 const NSSCertDatabase::ListCertsCallback& callback) { 47 const NSSCertDatabase::ListCertsCallback& callback) {
48 std::unique_ptr<CertificateList> certs(new CertificateList()); 48 std::unique_ptr<CertificateList> certs(new CertificateList());
49 49
50 // base::Pased will NULL out |certs|, so cache the underlying pointer here. 50 // base::Pased will NULL out |certs|, so cache the underlying pointer here.
51 CertificateList* raw_certs = certs.get(); 51 CertificateList* raw_certs = certs.get();
52 base::PostTaskWithTraitsAndReply( 52 GetSlowTaskRunner()->PostTaskAndReply(
53 FROM_HERE, base::TaskTraits() 53 FROM_HERE, base::Bind(&NSSCertDatabaseChromeOS::ListCertsImpl,
54 .WithShutdownBehavior( 54 profile_filter_, base::Unretained(raw_certs)),
55 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
56 .MayBlock(),
57 base::Bind(&NSSCertDatabaseChromeOS::ListCertsImpl, profile_filter_,
58 base::Unretained(raw_certs)),
59 base::Bind(callback, base::Passed(&certs))); 55 base::Bind(callback, base::Passed(&certs)));
60 } 56 }
61 57
62 crypto::ScopedPK11Slot NSSCertDatabaseChromeOS::GetSystemSlot() const { 58 crypto::ScopedPK11Slot NSSCertDatabaseChromeOS::GetSystemSlot() const {
63 if (system_slot_) 59 if (system_slot_)
64 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_slot_.get())); 60 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_slot_.get()));
65 return crypto::ScopedPK11Slot(); 61 return crypto::ScopedPK11Slot();
66 } 62 }
67 63
68 void NSSCertDatabaseChromeOS::ListModules(CryptoModuleList* modules, 64 void NSSCertDatabaseChromeOS::ListModules(CryptoModuleList* modules,
(...skipping 22 matching lines...) Expand all
91 certs->begin(), 87 certs->begin(),
92 certs->end(), 88 certs->end(),
93 NSSProfileFilterChromeOS::CertNotAllowedForProfilePredicate( 89 NSSProfileFilterChromeOS::CertNotAllowedForProfilePredicate(
94 profile_filter)), 90 profile_filter)),
95 certs->end()); 91 certs->end());
96 DVLOG(1) << "filtered " << pre_size - certs->size() << " of " << pre_size 92 DVLOG(1) << "filtered " << pre_size - certs->size() << " of " << pre_size
97 << " certs"; 93 << " certs";
98 } 94 }
99 95
100 } // namespace net 96 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/nss_cert_database.cc ('k') | net/cert/nss_cert_database_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698