No need to use weak reference

Ref-counting manages everything.
This commit is contained in:
Cheng Zhao 2015-11-17 19:00:33 +08:00
parent 24f573eceb
commit 217311ef21
3 changed files with 5 additions and 13 deletions

View file

@ -241,10 +241,7 @@ void SetProxyInIO(net::URLRequestContextGetter* getter,
void PassVerificationResult(
scoped_refptr<AtomCertVerifier::CertVerifyRequest> request,
bool success) {
int result = net::OK;
if (!success)
result = net::ERR_FAILED;
request->ContinueWithResult(result);
request->ContinueWithResult(success ? net::OK : net::ERR_FAILED);
}
} // namespace

View file

@ -66,8 +66,7 @@ void AtomCertVerifier::CertVerifyRequest::DelegateToDefaultVerifier() {
key_.flags,
crl_set_.get(),
verify_result_,
base::Bind(&CertVerifyRequest::RunResult,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&CertVerifyRequest::RunResult, this),
out_req_,
net_log_);
@ -86,15 +85,14 @@ void AtomCertVerifier::CertVerifyRequest::ContinueWithResult(int result) {
if (result != net::ERR_IO_PENDING) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&CertVerifyRequest::RunResult,
weak_ptr_factory_.GetWeakPtr(),
this,
result));
return;
}
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&CertVerifyRequest::DelegateToDefaultVerifier,
weak_ptr_factory_.GetWeakPtr()));
base::Bind(&CertVerifyRequest::DelegateToDefaultVerifier, this));
}
AtomCertVerifier::AtomCertVerifier()

View file

@ -55,8 +55,7 @@ class AtomCertVerifier : public net::CertVerifier {
verify_result_(verify_result),
out_req_(out_req),
net_log_(net_log),
handled_(false),
weak_ptr_factory_(this) {
handled_(false) {
}
void RunResult(int result);
@ -91,8 +90,6 @@ class AtomCertVerifier : public net::CertVerifier {
std::vector<net::CompletionCallback> callbacks_;
bool handled_;
base::WeakPtrFactory<CertVerifyRequest> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CertVerifyRequest);
};