Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: action_processor.cc

Issue 3022008: For actions, switch bool success into an exit code. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: switch to all positive error codes. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « action_processor.h ('k') | action_processor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « action_processor.h ('k') | action_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698