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

Unified Diff: components/search_engines/template_url_fetcher.cc

Issue 2307663002: Remove ScopedVector from search_engines. (Closed)
Patch Set: devlin Created 4 years, 3 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: components/search_engines/template_url_fetcher.cc
diff --git a/components/search_engines/template_url_fetcher.cc b/components/search_engines/template_url_fetcher.cc
index bd7d7b618c1466cf6844ab4d07a1712fc499d7d3..995c68e742540a1721ba5fca8b3a3263228a1239 100644
--- a/components/search_engines/template_url_fetcher.cc
+++ b/components/search_engines/template_url_fetcher.cc
@@ -208,19 +208,20 @@ void TemplateURLFetcher::ScheduleDownload(
return;
// Make sure we aren't already downloading this request.
- for (Requests::iterator i = requests_.begin(); i != requests_.end(); ++i) {
- if (((*i)->url() == osdd_url) || ((*i)->keyword() == keyword))
+ for (const auto& request : requests_) {
+ if ((request->url() == osdd_url) || (request->keyword() == keyword))
return;
}
- requests_.push_back(new RequestDelegate(
+ requests_.push_back(base::MakeUnique<RequestDelegate>(
this, keyword, osdd_url, favicon_url, url_fetcher_customize_callback));
}
void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) {
- Requests::iterator i =
- std::find(requests_.begin(), requests_.end(), request);
+ auto i = std::find_if(requests_.begin(), requests_.end(),
+ [request](const std::unique_ptr<RequestDelegate>& ptr) {
+ return ptr.get() == request;
+ });
DCHECK(i != requests_.end());
- requests_.weak_erase(i);
- delete request;
+ requests_.erase(i);
}

Powered by Google App Engine
This is Rietveld 408576698