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 "chromeos/obsolete_logging.h" |
6 #include "update_engine/action.h" | 7 #include "update_engine/action.h" |
7 | 8 |
8 namespace chromeos_update_engine { | 9 namespace chromeos_update_engine { |
9 | 10 |
10 ActionProcessor::ActionProcessor() | 11 ActionProcessor::ActionProcessor() |
11 : current_action_(NULL), delegate_(NULL) {} | 12 : current_action_(NULL), delegate_(NULL) {} |
12 | 13 |
13 ActionProcessor::~ActionProcessor() { | 14 ActionProcessor::~ActionProcessor() { |
14 if (IsRunning()) { | 15 if (IsRunning()) { |
15 StopProcessing(); | 16 StopProcessing(); |
(...skipping 26 matching lines...) Expand all Loading... |
42 current_action_->TerminateProcessing(); | 43 current_action_->TerminateProcessing(); |
43 CHECK(current_action_); | 44 CHECK(current_action_); |
44 current_action_->SetProcessor(NULL); | 45 current_action_->SetProcessor(NULL); |
45 LOG(INFO) << "ActionProcessor::StopProcessing: aborted " | 46 LOG(INFO) << "ActionProcessor::StopProcessing: aborted " |
46 << current_action_->Type(); | 47 << current_action_->Type(); |
47 current_action_ = NULL; | 48 current_action_ = NULL; |
48 if (delegate_) | 49 if (delegate_) |
49 delegate_->ProcessingStopped(this); | 50 delegate_->ProcessingStopped(this); |
50 } | 51 } |
51 | 52 |
52 void ActionProcessor::ActionComplete(const AbstractAction* actionptr, | 53 void ActionProcessor::ActionComplete(AbstractAction* actionptr, |
53 bool success) { | 54 bool success) { |
54 CHECK_EQ(actionptr, current_action_); | 55 CHECK_EQ(actionptr, current_action_); |
55 if (delegate_) | 56 if (delegate_) |
56 delegate_->ActionCompleted(this, actionptr, success); | 57 delegate_->ActionCompleted(this, actionptr, success); |
57 string old_type = current_action_->Type(); | 58 string old_type = current_action_->Type(); |
58 current_action_->SetProcessor(NULL); | 59 current_action_->SetProcessor(NULL); |
59 current_action_ = NULL; | 60 current_action_ = NULL; |
60 if (actions_.empty()) { | 61 if (actions_.empty()) { |
61 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" | 62 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" |
62 " type " << old_type; | 63 " type " << old_type; |
| 64 } else if (!success) { |
| 65 LOG(INFO) << "ActionProcessor::ActionComplete: " << old_type |
| 66 << " action failed. Aborting processing."; |
| 67 actions_.clear(); |
| 68 } |
| 69 if (actions_.empty()) { |
| 70 LOG(INFO) << "ActionProcessor::ActionComplete: finished last action of" |
| 71 " type " << old_type; |
63 if (delegate_) { | 72 if (delegate_) { |
64 delegate_->ProcessingDone(this); | 73 delegate_->ProcessingDone(this); |
65 } | 74 } |
66 return; | 75 return; |
67 } | 76 } |
68 current_action_ = actions_.front(); | 77 current_action_ = actions_.front(); |
69 actions_.pop_front(); | 78 actions_.pop_front(); |
70 LOG(INFO) << "ActionProcessor::ActionComplete: finished " << old_type | 79 LOG(INFO) << "ActionProcessor::ActionComplete: finished " << old_type |
71 << ", starting " << current_action_->Type(); | 80 << ", starting " << current_action_->Type(); |
72 current_action_->PerformAction(); | 81 current_action_->PerformAction(); |
73 } | 82 } |
74 | 83 |
75 } // namespace chromeos_update_engine | 84 } // namespace chromeos_update_engine |
OLD | NEW |