AU: Start checkpointing update progress.
Checkpoint the manifest metadata size and the update
check response hash in the preference store. Also checkpoint
the next operation and data offset.
Add methods for getting/setting hash context.
BUG=7390,7394
TEST=unit tests
Change-Id: I25291bf598ac9b0f1033e11cfe59df45b1f6eeab
Review URL: http://codereview.chromium.org/3521016
diff --git a/omaha_hash_calculator.cc b/omaha_hash_calculator.cc
index 0df83bc..bc71476 100644
--- a/omaha_hash_calculator.cc
+++ b/omaha_hash_calculator.cc
@@ -97,4 +97,14 @@
return OmahaHashOfBytes(&data[0], data.size());
}
+string OmahaHashCalculator::GetContext() const {
+ return string(reinterpret_cast<const char*>(&ctx_), sizeof(ctx_));
+}
+
+bool OmahaHashCalculator::SetContext(const std::string& context) {
+ TEST_AND_RETURN_FALSE(context.size() == sizeof(ctx_));
+ memcpy(&ctx_, context.data(), sizeof(ctx_));
+ return true;
+}
+
} // namespace chromeos_update_engine