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

Unified Diff: chromeos/geolocation/simple_geolocation_provider.cc

Issue 974883002: Revert of Fix crash in SimpleGeolocationProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | chromeos/timezone/timezone_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/geolocation/simple_geolocation_provider.cc
diff --git a/chromeos/geolocation/simple_geolocation_provider.cc b/chromeos/geolocation/simple_geolocation_provider.cc
index 5ece69d46785903687fe640a86c5ea94a0f186d3..4a57ac7919bfac41ed4dc7a608b5b098650ff479 100644
--- a/chromeos/geolocation/simple_geolocation_provider.cc
+++ b/chromeos/geolocation/simple_geolocation_provider.cc
@@ -62,13 +62,10 @@
callback.Run(geoposition, server_error, elapsed);
- ScopedVector<SimpleGeolocationRequest>::iterator position =
- std::find(requests_.begin(), requests_.end(), request);
- DCHECK_NE(&(*position), &(*requests_.end()));
- if (position != requests_.end()) {
- std::swap(*position, *requests_.rbegin());
- requests_.resize(requests_.size() - 1);
- }
+ ScopedVector<SimpleGeolocationRequest>::iterator new_end =
+ std::remove(requests_.begin(), requests_.end(), request);
+ DCHECK_EQ(std::distance(new_end, requests_.end()), 1);
+ requests_.erase(new_end, requests_.end());
}
} // namespace chromeos
« no previous file with comments | « no previous file | chromeos/timezone/timezone_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698