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

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

Issue 10916018: Force COM machinery to notice that the path to the DelegateExecute verb handler has changed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
Index: chrome/installer/util/callback_work_item.cc
diff --git a/chrome/installer/util/callback_work_item.cc b/chrome/installer/util/callback_work_item.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e2dbbec3ab9f89744c3f444764938d86cf119cd0
--- /dev/null
+++ b/chrome/installer/util/callback_work_item.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/installer/util/callback_work_item.h"
+
+#include "base/callback.h"
+#include "base/logging.h"
+#include "chrome/installer/util/work_item.h"
+
+CallbackWorkItem::CallbackWorkItem(
+ base::Callback<bool(const CallbackWorkItem&)> callback)
+ : callback_(callback),
+ roll_state_(RS_UNDEFINED) {
+}
+
+CallbackWorkItem::~CallbackWorkItem() {
+}
+
+bool CallbackWorkItem::Do() {
+ DCHECK_EQ(roll_state_, RS_UNDEFINED);
+
+ roll_state_ = RS_FORWARD;
+ bool result = callback_.Run(*this);
+ roll_state_ = RS_UNDEFINED;
robertshield 2012/08/30 17:52:43 Should we leave roll_state_ set to RS_FORWARD, whi
grt (UTC plus 2) 2012/08/30 18:21:50 Discussed in person: doing so would make the DCHEC
+
+ return result;
+}
+
+void CallbackWorkItem::Rollback() {
+ DCHECK_EQ(roll_state_, RS_UNDEFINED);
+
+ roll_state_ = RS_BACKWARD;
+ ignore_result(callback_.Run(*this));
+ roll_state_ = RS_UNDEFINED;
+}
+
+bool CallbackWorkItem::IsRollback() const {
+ DCHECK_NE(roll_state_, RS_UNDEFINED);
+ return roll_state_ == RS_BACKWARD;
+}

Powered by Google App Engine
This is Rietveld 408576698