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

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: 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..fd61ab74a215728c00e71a17b7828608fb8a7518 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_handle_(nullptr),
Devlin 2016/07/12 15:04:51 unnecessary (this is the default construction of s
maksims (do not use this acc) 2016/07/19 15:00:25 Done.
addresses_(new net::AddressList) {}
DnsResolveFunction::~DnsResolveFunction() {}
@@ -57,14 +57,10 @@ void DnsResolveFunction::WorkOnIOThread() {
// hostname you'd like to resolve, even though it doesn't use that value in
// determining its answer.
net::HostPortPair host_port_pair(hostname_, 0);
-
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_handle_,
net::BoundNetLog());
// Balanced in OnLookupFinished.
@@ -91,6 +87,10 @@ void DnsResolveFunction::OnLookupFinished(int resolve_result) {
results_ = Resolve::Results::Create(*resolve_info);
response_ = true;
+ // TODO(maksims): investigate why std::unique_ptr<HostResolver::Request>'s
+ // destructor is not called automatically.
Devlin 2016/07/12 15:04:51 I don't quite follow this comment. Automatically
maksims (do not use this acc) 2016/07/14 12:02:47 No, I mean that DnsResolveFunction's destructor is
mmenke 2016/07/14 18:25:31 Without digging into it, my guess is that the test
maksims (do not use this acc) 2016/07/19 15:00:25 Done.
maksims (do not use this acc) 2016/07/19 15:00:25 Done.
maksims (do not use this acc) 2016/07/19 15:00:25 I just the implementation of ::RequestImpl and it
maksims (do not use this acc) 2016/07/19 15:00:25 Done.
+ request_handle_.reset();
+
bool post_task_result = BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698