summaryrefslogtreecommitdiffstats
path: root/chromeos/cert_loader.h
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 10:24:11 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-06 10:24:11 +0000
commit9e81893b54b4f48c7b18b783ed82208463fc5645 (patch)
treeb60309848866b1aa99547c0d4f5f56f230491514 /chromeos/cert_loader.h
parent6e26d08a43a3a0126f5ff22a2f886597f8d304e3 (diff)
downloadchromium_src-9e81893b54b4f48c7b18b783ed82208463fc5645.zip
chromium_src-9e81893b54b4f48c7b18b783ed82208463fc5645.tar.gz
chromium_src-9e81893b54b4f48c7b18b783ed82208463fc5645.tar.bz2
Make NSSCertDatabase::ListCerts async and use the worker pool for actual certificate listing.
BUG=340460 TBR=sky@chromium.org (for rename in chrome/browser/certificate_manager_model.cc) Review URL: https://codereview.chromium.org/144423007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/cert_loader.h')
-rw-r--r--chromeos/cert_loader.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/chromeos/cert_loader.h b/chromeos/cert_loader.h
index 94f6a41..848a2c8 100644
--- a/chromeos/cert_loader.h
+++ b/chromeos/cert_loader.h
@@ -17,10 +17,6 @@
#include "chromeos/chromeos_export.h"
#include "net/cert/cert_database.h"
-namespace base {
-class TaskRunner;
-}
-
namespace net {
class NSSCertDatabase;
class X509Certificate;
@@ -64,14 +60,12 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer {
static std::string GetPkcs11IdForCert(const net::X509Certificate& cert);
// Starts the CertLoader with the NSS cert database.
- // The CertLoader will _not_ take the ownership of the database.
+ // The CertLoader will _not_ take the ownership of the database, but it
+ // expects it to stay alive at least until the shutdown starts on the main
+ // thread. This assumes that |StartWithNSSDB| and other methods directly
+ // using |database_| are not called during shutdown.
void StartWithNSSDB(net::NSSCertDatabase* database);
- // Sets the task runner that any slow calls will be made from, e.g. calls
- // to the NSS database. If not set, uses base::WorkerPool.
- void SetSlowTaskRunnerForTest(
- const scoped_refptr<base::TaskRunner>& task_runner);
-
void AddObserver(CertLoader::Observer* observer);
void RemoveObserver(CertLoader::Observer* observer);
@@ -89,7 +83,7 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer {
bool certificates_loaded() const { return certificates_loaded_; }
// This will be empty until certificates_loaded() is true.
- const net::CertificateList& cert_list() const { return cert_list_; }
+ const net::CertificateList& cert_list() const { return *cert_list_; }
void force_hardware_backed_for_test() {
force_hardware_backed_for_test_ = true;
@@ -104,7 +98,7 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer {
void LoadCertificates();
// Called if a certificate load task is finished.
- void UpdateCertificates(net::CertificateList* cert_list);
+ void UpdateCertificates(scoped_ptr<net::CertificateList> cert_list);
void NotifyCertificatesLoaded(bool initial_load);
@@ -128,14 +122,10 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer {
bool force_hardware_backed_for_test_;
// Cached Certificates loaded from the database.
- net::CertificateList cert_list_;
+ scoped_ptr<net::CertificateList> cert_list_;
base::ThreadChecker thread_checker_;
- // TaskRunner that, if set, replaces base::WorkerPool. Should only be set in
- // tests.
- scoped_refptr<base::TaskRunner> slow_task_runner_for_test_;
-
base::WeakPtrFactory<CertLoader> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CertLoader);