| Index: delta_diff_generator.cc | 
| diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc | 
| index 21a4c03ad84b98decd39afa9c7a94bfd6e4f29d1..4d8ccab0697fa1844d7605d28b10eefc620b95d8 100644 | 
| --- a/delta_diff_generator.cc | 
| +++ b/delta_diff_generator.cc | 
| @@ -30,6 +30,7 @@ | 
| #include "update_engine/full_update_generator.h" | 
| #include "update_engine/graph_types.h" | 
| #include "update_engine/graph_utils.h" | 
| +#include "update_engine/metadata.h" | 
| #include "update_engine/omaha_hash_calculator.h" | 
| #include "update_engine/payload_signer.h" | 
| #include "update_engine/subprocess.h" | 
| @@ -52,31 +53,6 @@ typedef DeltaDiffGenerator::Block Block; | 
| typedef map<const DeltaArchiveManifest_InstallOperation*, | 
| const string*> OperationNameMap; | 
|  | 
| -namespace { | 
| -const size_t kBlockSize = 4096;  // bytes | 
| - | 
| -// TODO(adlr): switch from 1GiB to 2GiB when we no longer care about old | 
| -// clients: | 
| -const size_t kRootFSPartitionSize = 1 * 1024 * 1024 * 1024;  // bytes | 
| -const uint64_t kVersionNumber = 1; | 
| -const uint64_t kFullUpdateChunkSize = 1024 * 1024;  // bytes | 
| - | 
| -static const char* kInstallOperationTypes[] = { | 
| -  "REPLACE", | 
| -  "REPLACE_BZ", | 
| -  "MOVE", | 
| -  "BSDIFF" | 
| -}; | 
| - | 
| -// Stores all Extents for a file into 'out'. Returns true on success. | 
| -bool GatherExtents(const string& path, | 
| -                   google::protobuf::RepeatedPtrField<Extent>* out) { | 
| -  vector<Extent> extents; | 
| -  TEST_AND_RETURN_FALSE(extent_mapper::ExtentsForFileFibmap(path, &extents)); | 
| -  DeltaDiffGenerator::StoreExtents(extents, out); | 
| -  return true; | 
| -} | 
| - | 
| // Runs the bsdiff tool on two files and returns the resulting delta in | 
| // 'out'. Returns true on success. | 
| bool BsdiffFiles(const string& old_file, | 
| @@ -152,6 +128,31 @@ bool AddInstallOpToBlocksVector( | 
| return true; | 
| } | 
|  | 
| +namespace { | 
| +const size_t kBlockSize = 4096;  // bytes | 
| + | 
| +// TODO(adlr): switch from 1GiB to 2GiB when we no longer care about old | 
| +// clients: | 
| +const size_t kRootFSPartitionSize = 1 * 1024 * 1024 * 1024;  // bytes | 
| +const uint64_t kVersionNumber = 1; | 
| +const uint64_t kFullUpdateChunkSize = 1024 * 1024;  // bytes | 
| + | 
| +static const char* kInstallOperationTypes[] = { | 
| +  "REPLACE", | 
| +  "REPLACE_BZ", | 
| +  "MOVE", | 
| +  "BSDIFF" | 
| +}; | 
| + | 
| +// Stores all Extents for a file into 'out'. Returns true on success. | 
| +bool GatherExtents(const string& path, | 
| +                   google::protobuf::RepeatedPtrField<Extent>* out) { | 
| +  vector<Extent> extents; | 
| +  TEST_AND_RETURN_FALSE(extent_mapper::ExtentsForFileFibmap(path, &extents)); | 
| +  DeltaDiffGenerator::StoreExtents(extents, out); | 
| +  return true; | 
| +} | 
| + | 
| // For a given regular file which must exist at new_root + path, and | 
| // may exist at old_root + path, creates a new InstallOperation and | 
| // adds it to the graph. Also, populates the |blocks| array as | 
| @@ -1390,6 +1391,16 @@ bool DeltaDiffGenerator::GenerateDeltaUpdateFile( | 
| LOG(INFO) << "done reading normal files"; | 
| CheckGraph(graph); | 
|  | 
| +      LOG(INFO) << "Starting metadata processing"; | 
| +      TEST_AND_RETURN_FALSE(DeltaReadMetadata(&graph, | 
| +                                              &blocks, | 
| +                                              old_image, | 
| +                                              new_image, | 
| +                                              fd, | 
| +                                              &data_file_size)); | 
| +      LOG(INFO) << "Done metadata processing"; | 
| +      CheckGraph(graph); | 
| + | 
| graph.resize(graph.size() + 1); | 
| TEST_AND_RETURN_FALSE(ReadUnwrittenBlocks(blocks, | 
| fd, | 
|  |