AU: eliminate redundancy with buffering of operation data

Instead of copying all downloaded bytes into a C++ vector only to remove
the first bytes as each operation is applied, we now copy up to the next
operation's expected data size and discard the whole buffer once
processed. This also includes a more refined handling of the payload
metadata.

CL includes a few small random code simplifications and formatting
fixes, too.

BUG=chromium:229726
TEST=Unit tests.

Change-Id: I85e997015a3daf430429b497a8ef8b3c145ec5a8
Reviewed-on: https://chromium-review.googlesource.com/182547
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index 4ec8dac..70e6db2 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -922,20 +922,19 @@
 
   // Parse the delta payload we created.
   DeltaArchiveManifest manifest;
-  uint64_t parsed_metadata_size;
 
   // Init actual_error with an invalid value so that we make sure
   // ParsePayloadMetadata properly populates it in all cases.
   actual_error = kErrorCodeUmaReportedMax;
   actual_result = delta_performer.ParsePayloadMetadata(payload, &manifest,
-      &parsed_metadata_size, &actual_error);
+                                                       &actual_error);
 
   EXPECT_EQ(expected_result, actual_result);
   EXPECT_EQ(expected_error, actual_error);
 
   // Check that the parsed metadata size is what's expected. This test
   // implicitly confirms that the metadata signature is valid, if required.
-  EXPECT_EQ(state.metadata_size, parsed_metadata_size);
+  EXPECT_EQ(state.metadata_size, delta_performer.GetMetadataSize());
 }
 
 void DoOperationHashMismatchTest(OperationHashTest op_hash_test,