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

Unified Diff: extensions/browser/api/dns/dns_api.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: extensions/browser/api/dns/dns_api.cc
diff --git a/extensions/browser/api/dns/dns_api.cc b/extensions/browser/api/dns/dns_api.cc
index 671254ba4026dc861652631cc4563b53484984f0..c01cb2f0c20bab7cf9040f15eb3911d6c37e60c2 100644
--- a/extensions/browser/api/dns/dns_api.cc
+++ b/extensions/browser/api/dns/dns_api.cc
@@ -25,7 +25,7 @@ namespace extensions {
DnsResolveFunction::DnsResolveFunction()
: resource_context_(NULL),
response_(false),
- request_handle_(new net::HostResolver::RequestHandle()),
+ request_(),
addresses_(new net::AddressList) {}
DnsResolveFunction::~DnsResolveFunction() {}
@@ -58,13 +58,11 @@ void DnsResolveFunction::WorkOnIOThread() {
// determining its answer.
net::HostPortPair host_port_pair(hostname_, 0);
+ std::unique_ptr<net::HostResolver::Request> request;
net::HostResolver::RequestInfo request_info(host_port_pair);
int resolve_result = host_resolver->Resolve(
- request_info,
- net::DEFAULT_PRIORITY,
- addresses_.get(),
- base::Bind(&DnsResolveFunction::OnLookupFinished, this),
- request_handle_.get(),
+ request_info, net::DEFAULT_PRIORITY, addresses_.get(),
+ base::Bind(&DnsResolveFunction::OnLookupFinished, this), &request,
net::BoundNetLog());
// Balanced in OnLookupFinished.
@@ -72,6 +70,8 @@ void DnsResolveFunction::WorkOnIOThread() {
if (resolve_result != net::ERR_IO_PENDING)
OnLookupFinished(resolve_result);
+ if (resolve_result == net::ERR_IO_PENDING)
+ request_ = std::move(request);
}
void DnsResolveFunction::RespondOnUIThread() {

Powered by Google App Engine
This is Rietveld 408576698