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

Unified Diff: chromeos/timezone/timezone_provider.cc

Issue 2295663002: Replace deprecated ScopedVector<T> in chromeos::TimeZoneProvider (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
« no previous file with comments | « chromeos/timezone/timezone_provider.h ('k') | chromeos/timezone/timezone_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/timezone/timezone_provider.cc
diff --git a/chromeos/timezone/timezone_provider.cc b/chromeos/timezone/timezone_provider.cc
index cd52b273ba66397183a6d06c244a35fca89d3d50..6df3be4d1c8471ba7ae3d482d325479482e303ac 100644
--- a/chromeos/timezone/timezone_provider.cc
+++ b/chromeos/timezone/timezone_provider.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "chromeos/geolocation/geoposition.h"
#include "net/url_request/url_request_context_getter.h"
@@ -31,7 +32,7 @@ void TimeZoneProvider::RequestTimezone(
TimeZoneRequest::TimeZoneResponseCallback callback) {
TimeZoneRequest* request(new TimeZoneRequest(
url_context_getter_.get(), url_, position,timeout));
- requests_.push_back(request);
+ requests_.push_back(base::WrapUnique(request));
// TimeZoneProvider owns all requests. It is safe to pass unretained "this"
// because destruction of TimeZoneProvider cancels all requests.
@@ -48,8 +49,11 @@ void TimeZoneProvider::OnTimezoneResponse(
TimeZoneRequest::TimeZoneResponseCallback callback,
std::unique_ptr<TimeZoneResponseData> timezone,
bool server_error) {
- ScopedVector<TimeZoneRequest>::iterator position =
- std::find(requests_.begin(), requests_.end(), request);
+ std::vector<std::unique_ptr<TimeZoneRequest>>::iterator position =
+ std::find_if(requests_.begin(), requests_.end(),
+ [request](const std::unique_ptr<TimeZoneRequest>& req) {
+ return req.get() == request;
+ });
DCHECK(position != requests_.end());
if (position != requests_.end()) {
std::swap(*position, *requests_.rbegin());
« no previous file with comments | « chromeos/timezone/timezone_provider.h ('k') | chromeos/timezone/timezone_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698