Remove SystemState references from DeltaPerformer.
DeltaPerformer is used as part of the DownloadAction and had
references to the global SystemState. The common references to
BootControlInterface (to query the partitions based on the names
from the payload) and the HardwareInterface (for dev-mode bits) are
now referenced directly from the DeltaPerformer. The calls to
UpdateAttempter and PayloadState were moved to the
DownloadActionDelegate since these calls are received by classes
outside the payload_consumer.
Bug: 25773375
TEST=FEATURES=test emerge-link update_engine
Change-Id: Id2e81d5ccf835cad22f03b069c681dcce104c456
diff --git a/payload_consumer/download_action.h b/payload_consumer/download_action.h
index e57ffb3..300d97e 100644
--- a/payload_consumer/download_action.h
+++ b/payload_consumer/download_action.h
@@ -43,9 +43,23 @@
virtual ~DownloadActionDelegate() = default;
// Called periodically after bytes are received. This method will be invoked
- // only if the DownloadAction is running. |bytes_received| is the number of
- // bytes downloaded thus far. |total| is the number of bytes expected.
- virtual void BytesReceived(uint64_t bytes_received, uint64_t total) = 0;
+ // only if the DownloadAction is running. |bytes_progressed| is the number of
+ // bytes downloaded since the last call of this method, |bytes_received|
+ // the number of bytes downloaded thus far and |total| is the number of bytes
+ // expected.
+ virtual void BytesReceived(uint64_t bytes_progressed,
+ uint64_t bytes_received,
+ uint64_t total) = 0;
+
+ // Returns whether the download should be canceled, in which case the
+ // |cancel_reason| error should be set to the reason why the download was
+ // canceled.
+ virtual bool ShouldCancel(ErrorCode* cancel_reason) = 0;
+
+ // Called once the complete payload has been downloaded. Note that any errors
+ // while applying or downloading the partial payload will result in this
+ // method not being called.
+ virtual void DownloadComplete() = 0;
};
class PrefsInterface;