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

Unified Diff: net/cert/nss_cert_database.h

Issue 2722733002: Revert of Use TaskScheduler instead of WorkerPool in nss_cert_database.cc. (Closed)
Patch Set: rebase Created 3 years, 10 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 | « chromeos/network/network_connection_handler_unittest.cc ('k') | net/cert/nss_cert_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/nss_cert_database.h
diff --git a/net/cert/nss_cert_database.h b/net/cert/nss_cert_database.h
index d096f18d654ec9d1f48c08ad373a896c55b4d2b3..a9f5c8ac51035a0e7490a22059b76f1df8d8d234 100644
--- a/net/cert/nss_cert_database.h
+++ b/net/cert/nss_cert_database.h
@@ -25,6 +25,7 @@
namespace base {
template <class ObserverType>
class ObserverListThreadSafe;
+class TaskRunner;
}
namespace net {
@@ -235,6 +236,10 @@ class NET_EXPORT NSSCertDatabase {
// Check whether cert is stored in a hardware slot.
bool IsHardwareBacked(const X509Certificate* cert) const;
+ // Overrides task runner that's used for running slow tasks.
+ void SetSlowTaskRunnerForTest(
+ const scoped_refptr<base::TaskRunner>& task_runner);
+
protected:
// Certificate listing implementation used by |ListCerts*| and
// |ListCertsSync|. Static so it may safely be used on the worker thread.
@@ -243,6 +248,11 @@ class NET_EXPORT NSSCertDatabase {
static void ListCertsImpl(crypto::ScopedPK11Slot slot,
CertificateList* certs);
+ // Gets task runner that should be used for slow tasks like certificate
+ // listing. Defaults to a base::WorkerPool runner, but may be overriden
+ // in tests (see SetSlowTaskRunnerForTest).
+ scoped_refptr<base::TaskRunner> GetSlowTaskRunner() const;
+
protected:
// Broadcasts notifications to all registered observers.
void NotifyObserversCertDBChanged();
@@ -275,6 +285,9 @@ class NET_EXPORT NSSCertDatabase {
// A helper observer that forwards events from this database to CertDatabase.
std::unique_ptr<Observer> cert_notification_forwarder_;
+ // Task runner that should be used in tests if set.
+ scoped_refptr<base::TaskRunner> slow_task_runner_for_test_;
+
const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_;
base::WeakPtrFactory<NSSCertDatabase> weak_factory_;
« no previous file with comments | « chromeos/network/network_connection_handler_unittest.cc ('k') | net/cert/nss_cert_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698