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/delta_performer.h b/delta_performer.h
index 82f4d90..2f9fd8a 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -17,13 +17,16 @@
 
 namespace chromeos_update_engine {
 
+class PrefsInterface;
+
 // This class performs the actions in a delta update synchronously. The delta
 // update itself should be passed in in chunks as it is received.
 
 class DeltaPerformer : public FileWriter {
  public:
-  DeltaPerformer()
-      : fd_(-1),
+  DeltaPerformer(PrefsInterface* prefs)
+      : prefs_(prefs),
+        fd_(-1),
         kernel_fd_(-1),
         manifest_valid_(false),
         next_operation_num_(0),
@@ -99,6 +102,12 @@
   // updates the hash calculator with these bytes before discarding them.
   void DiscardBufferHeadBytes(size_t count, bool do_hash);
 
+  bool ResetUpdateProgress();
+  bool CheckpointUpdateProgress();
+
+  // Update Engine preference store.
+  PrefsInterface* prefs_;
+
   // File descriptor of open device.
   int fd_;