| OLD | NEW |
| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return ("local_id: " + local_id_ + | 64 return ("local_id: " + local_id_ + |
| 65 ", resource_id: " + resource_id_ + | 65 ", resource_id: " + resource_id_ + |
| 66 ", changestamp: " + base::Int64ToString(changestamp_)); | 66 ", changestamp: " + base::Int64ToString(changestamp_)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 ChangeList::ChangeList() {} | 69 ChangeList::ChangeList() {} |
| 70 | 70 |
| 71 ChangeList::ChangeList(const google_apis::ChangeList& change_list) | 71 ChangeList::ChangeList(const google_apis::ChangeList& change_list) |
| 72 : next_url_(change_list.next_link()), | 72 : next_url_(change_list.next_link()), |
| 73 largest_changestamp_(change_list.largest_change_id()) { | 73 largest_changestamp_(change_list.largest_change_id()) { |
| 74 const ScopedVector<google_apis::ChangeResource>& items = change_list.items(); | 74 const std::vector<std::unique_ptr<google_apis::ChangeResource>>& items = |
| 75 change_list.items(); |
| 75 entries_.resize(items.size()); | 76 entries_.resize(items.size()); |
| 76 parent_resource_ids_.resize(items.size()); | 77 parent_resource_ids_.resize(items.size()); |
| 77 size_t entries_index = 0; | 78 size_t entries_index = 0; |
| 78 for (size_t i = 0; i < items.size(); ++i) { | 79 for (size_t i = 0; i < items.size(); ++i) { |
| 79 if (ConvertChangeResourceToResourceEntry( | 80 if (ConvertChangeResourceToResourceEntry( |
| 80 *items[i], | 81 *items[i], |
| 81 &entries_[entries_index], | 82 &entries_[entries_index], |
| 82 &parent_resource_ids_[entries_index])) { | 83 &parent_resource_ids_[entries_index])) { |
| 83 ++entries_index; | 84 ++entries_index; |
| 84 } | 85 } |
| 85 } | 86 } |
| 86 entries_.resize(entries_index); | 87 entries_.resize(entries_index); |
| 87 parent_resource_ids_.resize(entries_index); | 88 parent_resource_ids_.resize(entries_index); |
| 88 } | 89 } |
| 89 | 90 |
| 90 ChangeList::ChangeList(const google_apis::FileList& file_list) | 91 ChangeList::ChangeList(const google_apis::FileList& file_list) |
| 91 : next_url_(file_list.next_link()), | 92 : next_url_(file_list.next_link()), |
| 92 largest_changestamp_(0) { | 93 largest_changestamp_(0) { |
| 93 const ScopedVector<google_apis::FileResource>& items = file_list.items(); | 94 const std::vector<std::unique_ptr<google_apis::FileResource>>& items = |
| 95 file_list.items(); |
| 94 entries_.resize(items.size()); | 96 entries_.resize(items.size()); |
| 95 parent_resource_ids_.resize(items.size()); | 97 parent_resource_ids_.resize(items.size()); |
| 96 size_t entries_index = 0; | 98 size_t entries_index = 0; |
| 97 for (size_t i = 0; i < items.size(); ++i) { | 99 for (size_t i = 0; i < items.size(); ++i) { |
| 98 if (ConvertFileResourceToResourceEntry( | 100 if (ConvertFileResourceToResourceEntry( |
| 99 *items[i], | 101 *items[i], |
| 100 &entries_[entries_index], | 102 &entries_[entries_index], |
| 101 &parent_resource_ids_[entries_index])) { | 103 &parent_resource_ids_[entries_index])) { |
| 102 ++entries_index; | 104 ++entries_index; |
| 103 } | 105 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 if (!file_path.empty()) { | 488 if (!file_path.empty()) { |
| 487 FileChange::ChangeType type = entry.deleted() | 489 FileChange::ChangeType type = entry.deleted() |
| 488 ? FileChange::CHANGE_TYPE_DELETE | 490 ? FileChange::CHANGE_TYPE_DELETE |
| 489 : FileChange::CHANGE_TYPE_ADD_OR_UPDATE; | 491 : FileChange::CHANGE_TYPE_ADD_OR_UPDATE; |
| 490 changed_files_->Update(file_path, entry, type); | 492 changed_files_->Update(file_path, entry, type); |
| 491 } | 493 } |
| 492 } | 494 } |
| 493 | 495 |
| 494 } // namespace internal | 496 } // namespace internal |
| 495 } // namespace drive | 497 } // namespace drive |
| OLD | NEW |