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

Unified Diff: net/dns/mojo_host_resolver_impl.cc

Issue 2389613002: Remove stl_util's deletion functions from net/dns/. (Closed)
Patch Set: rebase atop NDK fix Created 4 years, 1 month 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
« net/dns/host_resolver_impl.h ('K') | « net/dns/mojo_host_resolver_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/mojo_host_resolver_impl.cc
diff --git a/net/dns/mojo_host_resolver_impl.cc b/net/dns/mojo_host_resolver_impl.cc
index f8f08d8b249da078cd7fc61fe3f73d665e67f24f..63a8eead147f47dd00da06d1c6d43b4753e5d2c9 100644
--- a/net/dns/mojo_host_resolver_impl.cc
+++ b/net/dns/mojo_host_resolver_impl.cc
@@ -6,7 +6,7 @@
#include <utility>
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
#include "net/base/network_interfaces.h"
@@ -51,7 +51,6 @@ MojoHostResolverImpl::MojoHostResolverImpl(net::HostResolver* resolver,
MojoHostResolverImpl::~MojoHostResolverImpl() {
DCHECK(thread_checker_.CalledOnValidThread());
- base::STLDeleteElements(&pending_jobs_);
}
void MojoHostResolverImpl::Resolve(
@@ -66,15 +65,17 @@ void MojoHostResolverImpl::Resolve(
}
Job* job =
new Job(this, resolver_, *request_info, net_log_, std::move(client));
- pending_jobs_.insert(job);
+ pending_jobs_.insert(base::WrapUnique(job));
job->Start();
}
void MojoHostResolverImpl::DeleteJob(Job* job) {
DCHECK(thread_checker_.CalledOnValidThread());
- size_t num_erased = pending_jobs_.erase(job);
- DCHECK(num_erased);
- delete job;
+ auto it = std::find_if(
+ pending_jobs_.begin(), pending_jobs_.end(),
+ [job](const std::unique_ptr<Job>& ptr) { return ptr.get() == job; });
davidben 2016/11/09 22:22:03 Same issue as always. :-) std::find_if on a std::s
+ DCHECK(it != pending_jobs_.end());
+ pending_jobs_.erase(it);
}
MojoHostResolverImpl::Job::Job(
« net/dns/host_resolver_impl.h ('K') | « net/dns/mojo_host_resolver_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698