Remove obsolete for_web_contents parameter in FontRenderParamsQuery.
[chromium-blink-merge.git] / chrome / installer / util / callback_work_item.cc
blobe2dbbec3ab9f89744c3f444764938d86cf119cd0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/installer/util/callback_work_item.h"
7 #include "base/callback.h"
8 #include "base/logging.h"
9 #include "chrome/installer/util/work_item.h"
11 CallbackWorkItem::CallbackWorkItem(
12 base::Callback<bool(const CallbackWorkItem&)> callback)
13 : callback_(callback),
14 roll_state_(RS_UNDEFINED) {
17 CallbackWorkItem::~CallbackWorkItem() {
20 bool CallbackWorkItem::Do() {
21 DCHECK_EQ(roll_state_, RS_UNDEFINED);
23 roll_state_ = RS_FORWARD;
24 bool result = callback_.Run(*this);
25 roll_state_ = RS_UNDEFINED;
27 return result;
30 void CallbackWorkItem::Rollback() {
31 DCHECK_EQ(roll_state_, RS_UNDEFINED);
33 roll_state_ = RS_BACKWARD;
34 ignore_result(callback_.Run(*this));
35 roll_state_ = RS_UNDEFINED;
38 bool CallbackWorkItem::IsRollback() const {
39 DCHECK_NE(roll_state_, RS_UNDEFINED);
40 return roll_state_ == RS_BACKWARD;