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

Side by Side Diff: components/drive/chromeos/change_list_processor.cc

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Rebase and address comments from mmenke@ 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 unified diff | Download patch
« no previous file with comments | « components/domain_reliability/util.cc ('k') | components/drive/chromeos/fake_file_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/drive/chromeos/change_list_processor.h" 5 #include "components/drive/chromeos/change_list_processor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8
9 #include <memory>
8 #include <utility> 10 #include <utility>
11 #include <vector>
9 12
10 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
11 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
12 #include "base/synchronization/cancellation_flag.h" 15 #include "base/synchronization/cancellation_flag.h"
13 #include "components/drive/chromeos/resource_metadata.h" 16 #include "components/drive/chromeos/resource_metadata.h"
14 #include "components/drive/drive.pb.h" 17 #include "components/drive/drive.pb.h"
15 #include "components/drive/drive_api_util.h" 18 #include "components/drive/drive_api_util.h"
16 #include "components/drive/file_change.h" 19 #include "components/drive/file_change.h"
17 #include "components/drive/file_system_core_util.h" 20 #include "components/drive/file_system_core_util.h"
18 #include "components/drive/resource_entry_conversion.h" 21 #include "components/drive/resource_entry_conversion.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return ("local_id: " + local_id_ + 67 return ("local_id: " + local_id_ +
65 ", resource_id: " + resource_id_ + 68 ", resource_id: " + resource_id_ +
66 ", changestamp: " + base::Int64ToString(changestamp_)); 69 ", changestamp: " + base::Int64ToString(changestamp_));
67 } 70 }
68 71
69 ChangeList::ChangeList() {} 72 ChangeList::ChangeList() {}
70 73
71 ChangeList::ChangeList(const google_apis::ChangeList& change_list) 74 ChangeList::ChangeList(const google_apis::ChangeList& change_list)
72 : next_url_(change_list.next_link()), 75 : next_url_(change_list.next_link()),
73 largest_changestamp_(change_list.largest_change_id()) { 76 largest_changestamp_(change_list.largest_change_id()) {
74 const ScopedVector<google_apis::ChangeResource>& items = change_list.items(); 77 const std::vector<std::unique_ptr<google_apis::ChangeResource>>& items =
78 change_list.items();
75 entries_.resize(items.size()); 79 entries_.resize(items.size());
76 parent_resource_ids_.resize(items.size()); 80 parent_resource_ids_.resize(items.size());
77 size_t entries_index = 0; 81 size_t entries_index = 0;
78 for (size_t i = 0; i < items.size(); ++i) { 82 for (size_t i = 0; i < items.size(); ++i) {
79 if (ConvertChangeResourceToResourceEntry( 83 if (ConvertChangeResourceToResourceEntry(
80 *items[i], 84 *items[i],
81 &entries_[entries_index], 85 &entries_[entries_index],
82 &parent_resource_ids_[entries_index])) { 86 &parent_resource_ids_[entries_index])) {
83 ++entries_index; 87 ++entries_index;
84 } 88 }
85 } 89 }
86 entries_.resize(entries_index); 90 entries_.resize(entries_index);
87 parent_resource_ids_.resize(entries_index); 91 parent_resource_ids_.resize(entries_index);
88 } 92 }
89 93
90 ChangeList::ChangeList(const google_apis::FileList& file_list) 94 ChangeList::ChangeList(const google_apis::FileList& file_list)
91 : next_url_(file_list.next_link()), 95 : next_url_(file_list.next_link()),
92 largest_changestamp_(0) { 96 largest_changestamp_(0) {
93 const ScopedVector<google_apis::FileResource>& items = file_list.items(); 97 const std::vector<std::unique_ptr<google_apis::FileResource>>& items =
98 file_list.items();
94 entries_.resize(items.size()); 99 entries_.resize(items.size());
95 parent_resource_ids_.resize(items.size()); 100 parent_resource_ids_.resize(items.size());
96 size_t entries_index = 0; 101 size_t entries_index = 0;
97 for (size_t i = 0; i < items.size(); ++i) { 102 for (size_t i = 0; i < items.size(); ++i) {
98 if (ConvertFileResourceToResourceEntry( 103 if (ConvertFileResourceToResourceEntry(
99 *items[i], 104 *items[i],
100 &entries_[entries_index], 105 &entries_[entries_index],
101 &parent_resource_ids_[entries_index])) { 106 &parent_resource_ids_[entries_index])) {
102 ++entries_index; 107 ++entries_index;
103 } 108 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 if (!file_path.empty()) { 491 if (!file_path.empty()) {
487 FileChange::ChangeType type = entry.deleted() 492 FileChange::ChangeType type = entry.deleted()
488 ? FileChange::CHANGE_TYPE_DELETE 493 ? FileChange::CHANGE_TYPE_DELETE
489 : FileChange::CHANGE_TYPE_ADD_OR_UPDATE; 494 : FileChange::CHANGE_TYPE_ADD_OR_UPDATE;
490 changed_files_->Update(file_path, entry, type); 495 changed_files_->Update(file_path, entry, type);
491 } 496 }
492 } 497 }
493 498
494 } // namespace internal 499 } // namespace internal
495 } // namespace drive 500 } // namespace drive
OLDNEW
« no previous file with comments | « components/domain_reliability/util.cc ('k') | components/drive/chromeos/fake_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698