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

Unified Diff: chromeos/geolocation/simple_geolocation_provider.cc

Issue 2285393004: Replace deprecated ScopedVector<T> in chromeos::SimpleGeolocationProvider (Closed)
Patch Set: Created 4 years, 4 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: chromeos/geolocation/simple_geolocation_provider.cc
diff --git a/chromeos/geolocation/simple_geolocation_provider.cc b/chromeos/geolocation/simple_geolocation_provider.cc
index c94f058ff5dd98798f47b6b47c1b6c7f611d3ad4..45d6981dcb8b08bdf1d25cbf8ec6dc848915c429 100644
--- a/chromeos/geolocation/simple_geolocation_provider.cc
+++ b/chromeos/geolocation/simple_geolocation_provider.cc
@@ -8,6 +8,7 @@
#include <iterator>
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "chromeos/geolocation/geoposition.h"
#include "chromeos/network/geolocation_handler.h"
#include "chromeos/network/network_handler.h"
@@ -54,7 +55,7 @@ void SimpleGeolocationProvider::RequestGeolocation(
SimpleGeolocationRequest* request(new SimpleGeolocationRequest(
url_context_getter_.get(), url_, timeout,
send_wifi_access_points ? GetAccessPointData() : nullptr));
- requests_.push_back(request);
+ requests_.push_back(base::WrapUnique(request));
// SimpleGeolocationProvider owns all requests. It is safe to pass unretained
// "this" because destruction of SimpleGeolocationProvider cancels all
@@ -82,8 +83,12 @@ void SimpleGeolocationProvider::OnGeolocationResponse(
callback.Run(geoposition, server_error, elapsed);
- ScopedVector<SimpleGeolocationRequest>::iterator position =
- std::find(requests_.begin(), requests_.end(), request);
+ std::vector<std::unique_ptr<SimpleGeolocationRequest>>::iterator position =
+ std::find_if(
+ requests_.begin(), requests_.end(),
+ [request](const std::unique_ptr<SimpleGeolocationRequest>& req) {
+ return req.get() == request;
+ });
DCHECK(position != requests_.end());
if (position != requests_.end()) {
std::swap(*position, *requests_.rbegin());
« no previous file with comments | « chromeos/geolocation/simple_geolocation_provider.h ('k') | chromeos/geolocation/simple_geolocation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698