Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: delta_performer.h

Issue 3541016: AU: Optimize checkpointing a bit and decide on new update vs. resume. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix copyrights Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | delta_performer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: delta_performer.h
diff --git a/delta_performer.h b/delta_performer.h
index 2f9fd8a7906a9ee6e5dcc31dee202c55c3fdf864..87a27dd9454aa7759430539c87ac3ccc8bd801b2 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -31,6 +31,7 @@ class DeltaPerformer : public FileWriter {
manifest_valid_(false),
next_operation_num_(0),
buffer_offset_(0),
+ last_updated_buffer_offset_(kuint64max),
block_size_(0) {}
// Opens the kernel. Should be called before or after Open(), but before
@@ -72,6 +73,15 @@ class DeltaPerformer : public FileWriter {
uint64_t full_length,
std::string* positions_string);
+ // Returns true if a previous update attempt can be continued based on the
+ // persistent preferences and the new update check response hash.
+ static bool CanResumeUpdate(PrefsInterface* prefs,
+ std::string update_check_response_hash);
+
+ // Resets the persistent update progress state to indicate that an update
+ // can't be resumed. Returns true on success, false otherwise.
+ static bool ResetUpdateProgress(PrefsInterface* prefs);
+
private:
// Returns true if enough of the delta file has been passed via Write()
// to be able to perform a given install operation.
@@ -102,7 +112,8 @@ class DeltaPerformer : public FileWriter {
// updates the hash calculator with these bytes before discarding them.
void DiscardBufferHeadBytes(size_t count, bool do_hash);
- bool ResetUpdateProgress();
+ // Checkpoints the update progress into persistent storage to allow this
+ // update attempt to be resumed after reboot.
bool CheckpointUpdateProgress();
// Update Engine preference store.
@@ -131,6 +142,9 @@ class DeltaPerformer : public FileWriter {
// Offset of buffer_ in the binary blobs section of the update.
uint64_t buffer_offset_;
+ // Last |buffer_offset_| value updated as part of the progress update.
+ uint64_t last_updated_buffer_offset_;
+
// The block size (parsed from the manifest).
uint32_t block_size_;
« no previous file with comments | « no previous file | delta_performer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698