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/utils.h b/utils.h
index c6edb7d..5a3efe9 100644
--- a/utils.h
+++ b/utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -134,7 +134,7 @@
template<typename T>
bool VectorContainsValue(const std::vector<T>& vect, const T& value) {
- return std::find(vect.begin(), vect.end(), value) != vect.end();
+ return std::find(vect.begin(), vect.end(), value) != vect.end();
}
template<typename T>
@@ -234,22 +234,21 @@
AbstractAction* action)
: processor_(processor),
action_(action),
- success_(false),
+ code_(kActionCodeError),
should_complete_(true) {}
~ScopedActionCompleter() {
if (should_complete_)
- processor_->ActionComplete(action_, success_);
+ processor_->ActionComplete(action_, code_);
}
- void set_success(bool success) {
- success_ = success;
- }
+ void set_code(ActionExitCode code) { code_ = code; }
void set_should_complete(bool should_complete) {
should_complete_ = should_complete;
}
+
private:
ActionProcessor* processor_;
AbstractAction* action_;
- bool success_;
+ ActionExitCode code_;
bool should_complete_;
DISALLOW_COPY_AND_ASSIGN(ScopedActionCompleter);
};