OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "update_engine/action_processor.h" | 5 #include "update_engine/action_processor.h" |
6 #include <string> | 6 #include <string> |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "update_engine/action.h" | 8 #include "update_engine/action.h" |
9 | 9 |
10 using std::string; | 10 using std::string; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 CHECK(current_action_); | 47 CHECK(current_action_); |
48 current_action_->SetProcessor(NULL); | 48 current_action_->SetProcessor(NULL); |
49 LOG(INFO) << "ActionProcessor::StopProcessing: aborted " | 49 LOG(INFO) << "ActionProcessor::StopProcessing: aborted " |
50 << current_action_->Type(); | 50 << current_action_->Type(); |
51 current_action_ = NULL; | 51 current_action_ = NULL; |
52 if (delegate_) | 52 if (delegate_) |
53 delegate_->ProcessingStopped(this); | 53 delegate_->ProcessingStopped(this); |
54 } | 54 } |
55 | 55 |
56 void ActionProcessor::ActionComplete(AbstractAction* actionptr, | 56 void ActionProcessor::ActionComplete(AbstractAction* actionptr, |
57 bool success) { | 57 ActionExitCode code) { |
58 CHECK_EQ(actionptr, current_action_); | 58 CHECK_EQ(actionptr, current_action_); |
59 if (delegate_) | 59 if (delegate_) |
60 delegate_->ActionCompleted(this, actionptr, success); | 60 delegate_->ActionCompleted(this, actionptr, code); |
61 string old_type = current_action_->Type(); | 61 string old_type = current_action_->Type(); |
62 current_action_->SetProcessor(NULL); | 62 current_action_->SetProcessor(NULL); |
63 current_action_ = NULL; | 63 current_action_ = NULL; |
64 if (actions_.empty()) { | 64 if (actions_.empty()) { |
65 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" | 65 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" |
66 " type " << old_type; | 66 " type " << old_type; |
67 } else if (!success) { | 67 } else if (code != kActionCodeSuccess) { |
68 LOG(INFO) << "ActionProcessor::ActionComplete: " << old_type | 68 LOG(INFO) << "ActionProcessor::ActionComplete: " << old_type |
69 << " action failed. Aborting processing."; | 69 << " action failed. Aborting processing."; |
70 actions_.clear(); | 70 actions_.clear(); |
71 } | 71 } |
72 if (actions_.empty()) { | 72 if (actions_.empty()) { |
73 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" | 73 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" |
74 " type " << old_type; | 74 " type " << old_type; |
75 if (delegate_) { | 75 if (delegate_) { |
76 delegate_->ProcessingDone(this, success); | 76 delegate_->ProcessingDone(this, code); |
77 } | 77 } |
78 return; | 78 return; |
79 } | 79 } |
80 current_action_ = actions_.front(); | 80 current_action_ = actions_.front(); |
81 actions_.pop_front(); | 81 actions_.pop_front(); |
82 LOG(INFO) << "ActionProcessor::ActionComplete: finished " << old_type | 82 LOG(INFO) << "ActionProcessor::ActionComplete: finished " << old_type |
83 << ", starting " << current_action_->Type(); | 83 << ", starting " << current_action_->Type(); |
84 current_action_->PerformAction(); | 84 current_action_->PerformAction(); |
85 } | 85 } |
86 | 86 |
87 } // namespace chromeos_update_engine | 87 } // namespace chromeos_update_engine |
OLD | NEW |