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

Unified Diff: chrome/installer/util/set_reg_value_work_item.cc

Issue 1976443005: Revert of Add best-effort/allow rollback flags on WorkItem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_list_tests
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/set_reg_value_work_item.h ('k') | chrome/installer/util/work_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/installer/util/set_reg_value_work_item.h ('k') | chrome/installer/util/work_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698