From e5ccb3fd5dbf3c24e67bab2664582b983cbeb192 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 13 Jul 2016 12:07:57 +0900 Subject: [PATCH] Remove lock in AtomCertVerifier --- atom/browser/net/atom_cert_verifier.cc | 11 ++--------- atom/browser/net/atom_cert_verifier.h | 4 +--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/atom/browser/net/atom_cert_verifier.cc b/atom/browser/net/atom_cert_verifier.cc index adfba7060c9..dd588b9501c 100644 --- a/atom/browser/net/atom_cert_verifier.cc +++ b/atom/browser/net/atom_cert_verifier.cc @@ -36,7 +36,6 @@ AtomCertVerifier::~AtomCertVerifier() { } void AtomCertVerifier::SetVerifyProc(const VerifyProc& proc) { - base::AutoLock auto_lock(lock_); verify_proc_ = proc; } @@ -52,20 +51,14 @@ int AtomCertVerifier::Verify( const net::BoundNetLog& net_log) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - VerifyProc proc; - { - base::AutoLock auto_lock(lock_); - proc = verify_proc_; - } - - if (proc.is_null()) + if (verify_proc_.is_null()) return default_cert_verifier_->Verify( cert, hostname, ocsp_response, flags, crl_set, verify_result, callback, out_req, net_log); BrowserThread::PostTask( 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))); return net::ERR_IO_PENDING; } diff --git a/atom/browser/net/atom_cert_verifier.h b/atom/browser/net/atom_cert_verifier.h index e00ba260ec3..c8b4bf9290b 100644 --- a/atom/browser/net/atom_cert_verifier.h +++ b/atom/browser/net/atom_cert_verifier.h @@ -5,10 +5,9 @@ #ifndef ATOM_BROWSER_NET_ATOM_CERT_VERIFIER_H_ #define ATOM_BROWSER_NET_ATOM_CERT_VERIFIER_H_ +#include #include -#include "base/memory/ref_counted.h" -#include "base/synchronization/lock.h" #include "net/cert/cert_verifier.h" namespace atom { @@ -39,7 +38,6 @@ class AtomCertVerifier : public net::CertVerifier { bool SupportsOCSPStapling() override; private: - base::Lock lock_; VerifyProc verify_proc_; std::unique_ptr default_cert_verifier_;