| Index: chrome/installer/util/work_item_list.cc
|
| diff --git a/chrome/installer/util/work_item_list.cc b/chrome/installer/util/work_item_list.cc
|
| index 609933065afaa65ac768c1c48a34d0820e2b79ef..58489ddcd52ff82c83519ab09bab2033d5842d6f 100644
|
| --- a/chrome/installer/util/work_item_list.cc
|
| +++ b/chrome/installer/util/work_item_list.cc
|
| @@ -28,19 +28,22 @@ WorkItemList::~WorkItemList() {
|
| }
|
| }
|
|
|
| -WorkItemList::WorkItemList()
|
| - : status_(ADD_ITEM) {
|
| -}
|
| +WorkItemList::WorkItemList() = default;
|
|
|
| -bool WorkItemList::Do() {
|
| - if (status_ != ADD_ITEM)
|
| - return false;
|
| +bool WorkItemList::DoImpl() {
|
| + VLOG(1) << "Beginning execution of work item list " << log_message();
|
|
|
| bool result = true;
|
| while (!list_.empty()) {
|
| WorkItem* work_item = list_.front();
|
| list_.pop_front();
|
| executed_list_.push_front(work_item);
|
| +
|
| + if (best_effort())
|
| + work_item->set_best_effort(true);
|
| + if (!rollback_enabled())
|
| + work_item->set_rollback_enabled(false);
|
| +
|
| if (!work_item->Do()) {
|
| LOG(ERROR) << "item execution failed " << work_item->log_message();
|
| result = false;
|
| @@ -49,27 +52,22 @@ bool WorkItemList::Do() {
|
| }
|
|
|
| if (result)
|
| - VLOG(1) << "list execution succeeded";
|
| + VLOG(1) << "Successful execution of work item list " << log_message();
|
| + else
|
| + LOG(ERROR) << "Failed execution of work item list " << log_message();
|
|
|
| - status_ = LIST_EXECUTED;
|
| return result;
|
| }
|
|
|
| -void WorkItemList::Rollback() {
|
| - if (status_ != LIST_EXECUTED)
|
| - return;
|
| -
|
| +void WorkItemList::RollbackImpl() {
|
| for (WorkItemIterator itr = executed_list_.begin();
|
| itr != executed_list_.end(); ++itr) {
|
| (*itr)->Rollback();
|
| }
|
| -
|
| - status_ = LIST_ROLLED_BACK;
|
| - return;
|
| }
|
|
|
| void WorkItemList::AddWorkItem(WorkItem* work_item) {
|
| - DCHECK(status_ == ADD_ITEM);
|
| + DCHECK_EQ(BEFORE_DO, state());
|
| list_.push_back(work_item);
|
| }
|
|
|
| @@ -131,20 +129,11 @@ WorkItem* WorkItemList::AddDeleteRegValueWorkItem(
|
| return item;
|
| }
|
|
|
| -WorkItem* WorkItemList::AddDeleteTreeWorkItem(
|
| - const base::FilePath& root_path,
|
| - const base::FilePath& temp_path,
|
| - const std::vector<base::FilePath>& key_paths) {
|
| - WorkItem* item = WorkItem::CreateDeleteTreeWorkItem(root_path, temp_path,
|
| - key_paths);
|
| - AddWorkItem(item);
|
| - return item;
|
| -}
|
| -
|
| WorkItem* WorkItemList::AddDeleteTreeWorkItem(const base::FilePath& root_path,
|
| const base::FilePath& temp_path) {
|
| - std::vector<base::FilePath> no_key_files;
|
| - return AddDeleteTreeWorkItem(root_path, temp_path, no_key_files);
|
| + WorkItem* item = WorkItem::CreateDeleteTreeWorkItem(root_path, temp_path);
|
| + AddWorkItem(item);
|
| + return item;
|
| }
|
|
|
| WorkItem* WorkItemList::AddMoveTreeWorkItem(const std::wstring& source_path,
|
| @@ -231,35 +220,3 @@ WorkItem* WorkItemList::AddSelfRegWorkItem(const std::wstring& dll_path,
|
| AddWorkItem(item);
|
| return item;
|
| }
|
| -
|
| -////////////////////////////////////////////////////////////////////////////////
|
| -NoRollbackWorkItemList::~NoRollbackWorkItemList() {
|
| -}
|
| -
|
| -bool NoRollbackWorkItemList::Do() {
|
| - if (status_ != ADD_ITEM)
|
| - return false;
|
| -
|
| - bool result = true;
|
| - while (!list_.empty()) {
|
| - WorkItem* work_item = list_.front();
|
| - list_.pop_front();
|
| - executed_list_.push_front(work_item);
|
| - work_item->set_ignore_failure(true);
|
| - if (!work_item->Do()) {
|
| - LOG(ERROR) << "NoRollbackWorkItemList: item execution failed "
|
| - << work_item->log_message();
|
| - result = false;
|
| - }
|
| - }
|
| -
|
| - if (result)
|
| - VLOG(1) << "NoRollbackWorkItemList: list execution succeeded";
|
| -
|
| - status_ = LIST_EXECUTED;
|
| - return result;
|
| -}
|
| -
|
| -void NoRollbackWorkItemList::Rollback() {
|
| - // Ignore rollback.
|
| -}
|
|
|