For actions, switch bool success into an exit code.
This way we can signal specific error conditions and then
send appropriate events to Omaha from the UpdateAttempter.
BUG=560
TEST=unit tests, gmerged and looked at logs
Review URL: http://codereview.chromium.org/3022008
diff --git a/action_processor.h b/action_processor.h
index 8311b8a..f04345d 100644
--- a/action_processor.h
+++ b/action_processor.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,6 +21,12 @@
namespace chromeos_update_engine {
+// Action exit codes.
+enum ActionExitCode {
+ kActionCodeSuccess = 0,
+ kActionCodeError = 1,
+};
+
class AbstractAction;
class ActionProcessorDelegate;
@@ -57,7 +63,7 @@
}
// Called by an action to notify processor that it's done. Caller passes self.
- void ActionComplete(AbstractAction* actionptr, bool success);
+ void ActionComplete(AbstractAction* actionptr, ActionExitCode code);
private:
// Actions that have not yet begun processing, in the order in which
@@ -78,9 +84,10 @@
class ActionProcessorDelegate {
public:
// Called when all processing in an ActionProcessor has completed. A pointer
- // to the ActionProcessor is passed. success is true iff all actions
- // completed successfully
- virtual void ProcessingDone(const ActionProcessor* processor, bool success) {}
+ // to the ActionProcessor is passed. |code| is set to the exit code of the
+ // last completed action.
+ virtual void ProcessingDone(const ActionProcessor* processor,
+ ActionExitCode code) {}
// Called when processing has stopped. Does not mean that all Actions have
// completed. If/when all Actions complete, ProcessingDone() will be called.
@@ -90,7 +97,7 @@
// or otherwise.
virtual void ActionCompleted(ActionProcessor* processor,
AbstractAction* action,
- bool success) {}
+ ActionExitCode code) {}
};
} // namespace chromeos_update_engine