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

Unified Diff: chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Created 3 years, 11 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: chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
index 26d0a799b834e1609a22c0d1ba1ceb2bc207976c..6975d046a54dfe39472dbcb479289be694f3c3a9 100644
--- a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
+++ b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
@@ -217,12 +217,11 @@ DriveApiErrorCode FakeDriveServiceHelper::GetSyncRootFolderID(
if (error != google_apis::HTTP_SUCCESS)
return error;
- const ScopedVector<FileResource>& items = resource_list->items();
- for (ScopedVector<FileResource>::const_iterator itr = items.begin();
- itr != items.end(); ++itr) {
- const FileResource& item = **itr;
- if (item.parents().empty()) {
- *sync_root_folder_id = item.file_id();
+ const std::vector<std::unique_ptr<FileResource>>& items =
+ resource_list->items();
+ for (const auto& item : items) {
+ if (item->parents().empty()) {
+ *sync_root_folder_id = item->file_id();
return google_apis::HTTP_SUCCESS;
}
}
@@ -231,7 +230,7 @@ DriveApiErrorCode FakeDriveServiceHelper::GetSyncRootFolderID(
DriveApiErrorCode FakeDriveServiceHelper::ListFilesInFolder(
const std::string& folder_id,
- ScopedVector<FileResource>* entries) {
+ std::vector<std::unique_ptr<FileResource>>* entries) {
DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
std::unique_ptr<FileList> list;
fake_drive_service_->GetFileListInDirectory(
@@ -247,7 +246,7 @@ DriveApiErrorCode FakeDriveServiceHelper::ListFilesInFolder(
DriveApiErrorCode FakeDriveServiceHelper::SearchByTitle(
const std::string& folder_id,
const std::string& title,
- ScopedVector<FileResource>* entries) {
+ std::vector<std::unique_ptr<FileResource>>* entries) {
DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
std::unique_ptr<FileList> list;
fake_drive_service_->SearchByTitle(
@@ -316,15 +315,12 @@ DriveApiErrorCode FakeDriveServiceHelper::GetAboutResource(
DriveApiErrorCode FakeDriveServiceHelper::CompleteListing(
std::unique_ptr<FileList> list,
- ScopedVector<FileResource>* entries) {
+ std::vector<std::unique_ptr<FileResource>>* entries) {
while (true) {
entries->reserve(entries->size() + list->items().size());
- std::vector<FileResource*> tmp;
- list->mutable_items()->release(&tmp);
- for (std::vector<FileResource*>::const_iterator itr =
- tmp.begin(); itr != tmp.end(); ++itr) {
- entries->push_back(*itr);
- }
+ std::move(list->mutable_items()->begin(), list->mutable_items()->end(),
+ std::back_inserter(*entries));
Avi (use Gerrit) 2017/01/09 17:18:29 Yay move to a back_inserter!
+ list->mutable_items()->clear();
GURL next_feed = list->next_link();
if (next_feed.is_empty())

Powered by Google App Engine
This is Rietveld 408576698