| Index: chrome/installer/util/set_reg_value_work_item.cc
|
| diff --git a/chrome/installer/util/set_reg_value_work_item.cc b/chrome/installer/util/set_reg_value_work_item.cc
|
| index 492fa4bbeb3eba4bb0b77f764eabf78c3576f988..b134aecb7c9988f2a239148fb0c77527cd877599 100644
|
| --- a/chrome/installer/util/set_reg_value_work_item.cc
|
| +++ b/chrome/installer/util/set_reg_value_work_item.cc
|
| @@ -129,17 +129,23 @@
|
| // Nothing to do, |get_value_callback| will fill |value_| later.
|
| }
|
|
|
| -bool SetRegValueWorkItem::DoImpl() {
|
| - DCHECK_EQ(SET_VALUE, status_);
|
| +bool SetRegValueWorkItem::Do() {
|
| + LONG result = ERROR_SUCCESS;
|
| + base::win::RegKey key;
|
| + if (status_ != SET_VALUE) {
|
| + // we already did something.
|
| + VLOG(1) << "multiple calls to Do()";
|
| + result = ERROR_CANTWRITE;
|
| + return ignore_failure_;
|
| + }
|
|
|
| status_ = VALUE_UNCHANGED;
|
| -
|
| - base::win::RegKey key;
|
| - LONG result = key.Open(predefined_root_, key_path_.c_str(),
|
| - KEY_READ | KEY_SET_VALUE | wow64_access_);
|
| + result = key.Open(predefined_root_,
|
| + key_path_.c_str(),
|
| + KEY_READ | KEY_SET_VALUE | wow64_access_);
|
| if (result != ERROR_SUCCESS) {
|
| VLOG(1) << "can not open " << key_path_ << " error: " << result;
|
| - return false;
|
| + return ignore_failure_;
|
| }
|
|
|
| DWORD type = 0;
|
| @@ -185,16 +191,19 @@
|
| static_cast<DWORD>(value_.size()), type_);
|
| if (result != ERROR_SUCCESS) {
|
| VLOG(1) << "Failed to write value " << key_path_ << " error: " << result;
|
| - return false;
|
| + return ignore_failure_;
|
| }
|
|
|
| status_ = previous_type_ ? VALUE_OVERWRITTEN : NEW_VALUE_CREATED;
|
| return true;
|
| }
|
|
|
| -void SetRegValueWorkItem::RollbackImpl() {
|
| - DCHECK_NE(SET_VALUE, status_);
|
| - DCHECK_NE(VALUE_ROLL_BACK, status_);
|
| +void SetRegValueWorkItem::Rollback() {
|
| + if (ignore_failure_)
|
| + return;
|
| +
|
| + if (status_ == SET_VALUE || status_ == VALUE_ROLL_BACK)
|
| + return;
|
|
|
| if (status_ == VALUE_UNCHANGED) {
|
| status_ = VALUE_ROLL_BACK;
|
|
|