AU: Fall back to full updates after a number of failed delta update attempts.
Count each failed delta update attempt. Keep the count in persistent storage. If
the count exceeds a threshold (3), disable delta updates by setting delta_okay
to false in the update check request.
Once this CL is in, we have to ensure that we have a full update payload
available on the update server for each version otherwise we may orphan clients.
BUG=7221
TEST=unit tests, gmerged on device and tested with a mod'ed dev server
Change-Id: I7f7fa73f652f12f22cc8604dad6a26c802b8582d
Review URL: http://codereview.chromium.org/3617002
diff --git a/update_attempter.h b/update_attempter.h
index 5df6af9..05f3dcb 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -45,6 +45,8 @@
class UpdateAttempter : public ActionProcessorDelegate,
public DownloadActionDelegate {
public:
+ static const int kMaxDeltaUpdateFailures;
+
UpdateAttempter(PrefsInterface* prefs, MetricsLibraryInterface* metrics_lib);
virtual ~UpdateAttempter();
@@ -106,6 +108,8 @@
private:
friend class UpdateAttempterTest;
+ FRIEND_TEST(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest);
+ FRIEND_TEST(UpdateAttempterTest, MarkDeltaUpdateFailureTest);
FRIEND_TEST(UpdateAttempterTest, UpdateTest);
// Sets the status to the given status and notifies a status update
@@ -142,6 +146,14 @@
static gboolean StaticManagePriorityCallback(gpointer data);
bool ManagePriorityCallback();
+ // Checks if a full update is needed and forces it by updating the Omaha
+ // request params.
+ void DisableDeltaUpdateIfNeeded();
+
+ // If this was a delta update attempt that failed, count it so that a full
+ // update can be tried when needed.
+ void MarkDeltaUpdateFailure();
+
// Last status notification timestamp used for throttling. Use
// monotonic TimeTicks to ensure that notifications are sent even if
// the system clock is set back in the middle of an update.
@@ -188,6 +200,7 @@
int64_t last_checked_time_;
std::string new_version_;
int64_t new_size_;
+ bool is_full_update_;
// Device paramaters common to all Omaha requests.
OmahaRequestDeviceParams omaha_request_params_;