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_; |