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

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: http_stream_factory_impl_job_controller_unittest RequestHandle* to unique_ptr 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
« no previous file with comments | « net/proxy/proxy_resolver_factory_mojo_unittest.cc ('k') | net/proxy/proxy_resolver_v8_tracing_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « net/proxy/proxy_resolver_factory_mojo_unittest.cc ('k') | net/proxy/proxy_resolver_v8_tracing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698