Remove lock in AtomCertVerifier

This commit is contained in:
Cheng Zhao 2016-07-13 12:07:57 +09:00
parent 24c60019b7
commit e5ccb3fd5d
2 changed files with 3 additions and 12 deletions

View file

@ -36,7 +36,6 @@ AtomCertVerifier::~AtomCertVerifier() {
} }
void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) { void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) {
base::AutoLock auto_lock(lock_);
verify_proc_ = proc; verify_proc_ = proc;
} }
@ -52,20 +51,14 @@ int AtomCertVerifier::Verify(
const net::BoundNetLog& net_log) { const net::BoundNetLog& net_log) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
VerifyProc proc; if (verify_proc_.is_null())
{
base::AutoLock auto_lock(lock_);
proc = verify_proc_;
}
if (proc.is_null())
return default_cert_verifier_->Verify( return default_cert_verifier_->Verify(
cert, hostname, ocsp_response, flags, crl_set, verify_result, callback, cert, hostname, ocsp_response, flags, crl_set, verify_result, callback,
out_req, net_log); out_req, net_log);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::Bind(proc, hostname, make_scoped_refptr(cert), base::Bind(verify_proc_, hostname, make_scoped_refptr(cert),
base::Bind(OnResult, verify_result, callback))); base::Bind(OnResult, verify_result, callback)));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }

View file

@ -5,10 +5,9 @@
#ifndef ATOM_BROWSER_NET_ATOM_CERT_VERIFIER_H_ #ifndef ATOM_BROWSER_NET_ATOM_CERT_VERIFIER_H_
#define ATOM_BROWSER_NET_ATOM_CERT_VERIFIER_H_ #define ATOM_BROWSER_NET_ATOM_CERT_VERIFIER_H_
#include <memory>
#include <string> #include <string>
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "net/cert/cert_verifier.h" #include "net/cert/cert_verifier.h"
namespace atom { namespace atom {
@ -39,7 +38,6 @@ class AtomCertVerifier : public net::CertVerifier {
bool SupportsOCSPStapling() override; bool SupportsOCSPStapling() override;
private: private:
base::Lock lock_;
VerifyProc verify_proc_; VerifyProc verify_proc_;
std::unique_ptr<net::CertVerifier> default_cert_verifier_; std::unique_ptr<net::CertVerifier> default_cert_verifier_;