summaryrefslogtreecommitdiff
path: root/payload_consumer/file_descriptor_utils.cc
diff options
context:
space:
mode:
authorAmin Hassani <ahassani@google.com>2017-09-18 17:05:02 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-21 14:15:50 -0700
commitcd7edbe3eeff0b4379649eea8308c325882407ff (patch)
treeb5619b1081d2420df7ca9b04f876a7d90aa1fc4b /payload_consumer/file_descriptor_utils.cc
parentb7f45dfcc72b1cfed2432cf30b36d815ff1af0d4 (diff)
update_engine: Replace vector<Extent> with RepeatedPtrField<Extent>
This patch removes references to vector<Extent> and replaces them with RepeatedPtrField in payload_consumer. Extent itself is a protobuf item and it makes sense to use google::protobuf::RepeatedPtrField instead of vector because then we won't have any extra copy to vector. We can directly use the list of extents given in the payload protobuf. Also removed references to vector in files which did not use vector. BUG=chromium:766397 TEST=FEATURES="test" emerge-amd64-generic update_engine Change-Id: I1f12332ff4d6303c1e4b7470bb87bf934acdf81a Reviewed-on: https://chromium-review.googlesource.com/672006 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
Diffstat (limited to 'payload_consumer/file_descriptor_utils.cc')
-rw-r--r--payload_consumer/file_descriptor_utils.cc7
1 files changed, 1 insertions, 6 deletions
diff --git a/payload_consumer/file_descriptor_utils.cc b/payload_consumer/file_descriptor_utils.cc
index f7f61a5c..b092149b 100644
--- a/payload_consumer/file_descriptor_utils.cc
+++ b/payload_consumer/file_descriptor_utils.cc
@@ -66,12 +66,7 @@ bool CopyAndHashExtents(FileDescriptorPtr source,
brillo::Blob buf(buffer_blocks * block_size);
DirectExtentWriter writer;
- std::vector<Extent> vec_tgt_extents;
- vec_tgt_extents.reserve(tgt_extents.size());
- for (const auto& ext : tgt_extents) {
- vec_tgt_extents.push_back(ext);
- }
- TEST_AND_RETURN_FALSE(writer.Init(target, vec_tgt_extents, block_size));
+ TEST_AND_RETURN_FALSE(writer.Init(target, tgt_extents, block_size));
for (const Extent& src_ext : src_extents) {
for (uint64_t src_ext_block = 0; src_ext_block < src_ext.num_blocks();