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

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: changed implementation of attach/detach of request 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..98763f0fce1070edf816f84fa35d81a938324b83 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_() {
mmenke 2016/07/19 19:03:56 Not needed.
maksims (do not use this acc) 2016/07/21 07:12:46 Done.
CheckIsOnOriginThread();
}
@@ -394,10 +394,8 @@ void Job::Cancel() {
ReleaseCallback();
- if (pending_dns_) {
- host_resolver()->CancelRequest(pending_dns_);
- pending_dns_ = NULL;
- }
+ if (pending_dns_)
mmenke 2016/07/19 19:03:56 Can get rid of this check
maksims (do not use this acc) 2016/07/21 07:12:46 Done.
+ pending_dns_.reset();
// The worker thread might be blocked waiting for DNS.
event_.Signal();
@@ -710,7 +708,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 +726,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 +745,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();

Powered by Google App Engine
This is Rietveld 408576698