summaryrefslogtreecommitdiff
path: root/common/action_processor.h
diff options
context:
space:
mode:
authorAlex Deymo <deymo@google.com>2016-02-25 11:20:13 -0800
committerAlex Deymo <deymo@google.com>2016-03-04 07:59:40 +0000
commitf28585764e91b7c25a7c2856ff645c8bb22d64a9 (patch)
tree606f49f48fb3b61422b4657f83019201c337d5d2 /common/action_processor.h
parent14dbd333439f34c648b9f783ffa656ef565de0cc (diff)
Implement suspend, resume and cancel the download.
The DownloadAction can now be suspended and resumed, using the existing libcurl hooks to pause the download. For canceling an ongoing update, this patch leverages the existing StopProcessing method previously used in unittest only with a slight change: Stopping the ActionProcessor also removes all the pending actions. The LibcurlHttpFetcher Pause/Unpause methods where improved to support (not crash) if paused in circumstances where there isn't a current connection, like when waiting for the proxy resolver and when trying to reconnect. Finally, the value of ongoing_update_ is now properly set in the UpdateAttempter. Bug: 27047026 TEST=Tested suspending, resuming and canceling the update on a device. TEST=Added unittest for the Pause/Unpause logic. Change-Id: I0df1e1a8cf70a3b736bc9cd4899d37813f381b94
Diffstat (limited to 'common/action_processor.h')
-rw-r--r--common/action_processor.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/common/action_processor.h b/common/action_processor.h
index 050eee97..c9c179ea 100644
--- a/common/action_processor.h
+++ b/common/action_processor.h
@@ -51,8 +51,9 @@ class ActionProcessor {
virtual void StartProcessing();
// Aborts processing. If an Action is running, it will have
- // TerminateProcessing() called on it. The Action that was running
- // will be lost and must be re-enqueued if this Processor is to use it.
+ // TerminateProcessing() called on it. The Action that was running and all the
+ // remaining actions will be lost and must be re-enqueued if this Processor is
+ // to use it.
void StopProcessing();
// Suspend the processing. If an Action is running, it will have the
@@ -63,7 +64,7 @@ class ActionProcessor {
void SuspendProcessing();
// Resume the suspended processing. If the ActionProcessor is not suspended
- // or not running on the first place this method performs no action.
+ // or not running in the first place this method performs no action.
void ResumeProcessing();
// Returns true iff the processing was started but not yet completed nor