Chromium Code Reviews| Index: net/proxy/proxy_resolver_v8_tracing.cc |
| diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc |
| index ef25fc80ece4bdbfa1fff4cf64a88c313bc5bb75..6bee71dec16a0b405b30f7386b81e22840a03a6e 100644 |
| --- a/net/proxy/proxy_resolver_v8_tracing.cc |
| +++ b/net/proxy/proxy_resolver_v8_tracing.cc |
| @@ -284,7 +284,7 @@ class Job : public base::RefCountedThreadSafe<Job>, |
| // Handle to the outstanding request in the HostResolver, or NULL. |
| // This is mutated and used on the origin thread, however it may be read by |
| // the worker thread for some DCHECKS(). |
| - HostResolver::RequestHandle pending_dns_; |
| + std::unique_ptr<HostResolver::Request> pending_dns_; |
|
jochen (gone - plz use gerrit)
2017/03/08 15:22:10
std::unique_ptr cannot be read atomically, and giv
|
| // Indicates if the outstanding DNS request completed synchronously. Written |
| // on the origin thread, and read by the worker thread. |
| @@ -338,8 +338,7 @@ Job::Job(const Job::Params* params, |
| bindings_(std::move(bindings)), |
| event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| base::WaitableEvent::InitialState::NOT_SIGNALED), |
| - last_num_dns_(0), |
| - pending_dns_(NULL) { |
| + last_num_dns_(0) { |
| CheckIsOnOriginThread(); |
| } |
| @@ -394,10 +393,7 @@ void Job::Cancel() { |
| ReleaseCallback(); |
| - if (pending_dns_) { |
| - host_resolver()->CancelRequest(pending_dns_); |
| - pending_dns_ = NULL; |
| - } |
| + pending_dns_.reset(); |
| // The worker thread might be blocked waiting for DNS. |
| event_.Signal(); |
| @@ -710,7 +706,7 @@ void Job::DoDnsOperation() { |
| if (cancelled_.IsSet()) |
| return; |
| - HostResolver::RequestHandle dns_request = NULL; |
| + std::unique_ptr<HostResolver::Request> dns_request; |
| int result = host_resolver()->Resolve( |
| MakeDnsRequestInfo(pending_dns_host_, pending_dns_op_), DEFAULT_PRIORITY, |
| &pending_dns_addresses_, base::Bind(&Job::OnDnsOperationComplete, this), |
| @@ -728,7 +724,7 @@ void Job::DoDnsOperation() { |
| OnDnsOperationComplete(result); |
| } else { |
| DCHECK(dns_request); |
| - pending_dns_ = dns_request; |
| + pending_dns_ = std::move(dns_request); |
| // OnDnsOperationComplete() will be called by host resolver on completion. |
| } |
| @@ -747,7 +743,7 @@ void Job::OnDnsOperationComplete(int result) { |
| SaveDnsToLocalCache(pending_dns_host_, pending_dns_op_, result, |
| pending_dns_addresses_); |
| - pending_dns_ = NULL; |
| + pending_dns_.reset(); |
| if (blocking_dns_) { |
| event_.Signal(); |