Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: net/proxy/proxy_resolver_v8_tracing.cc

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9eb21b3e19ffb99ef14c2790e0adab0b3b5b5e44 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_;
// Indicates if the outstanding DNS request completed synchronously. Written
// on the origin thread, and read by the worker thread.
@@ -339,7 +339,7 @@ Job::Job(const Job::Params* params,
event_(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED),
last_num_dns_(0),
- pending_dns_(NULL) {
+ pending_dns_(nullptr) {
CheckIsOnOriginThread();
}
@@ -395,8 +395,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.
@@ -710,7 +709,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 +727,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.
}

Powered by Google App Engine
This is Rietveld 408576698