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

Side by Side Diff: chrome/installer/util/work_item_list.h

Issue 1109043003: Apply automated fixits for Chrome clang plugin to chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ 5 #ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_
6 #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ 6 #define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <list> 10 #include <list>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "chrome/installer/util/work_item.h" 16 #include "chrome/installer/util/work_item.h"
17 17
18 namespace base { 18 namespace base {
19 class FilePath; 19 class FilePath;
20 } 20 }
21 21
22 // A WorkItem subclass that recursively contains a list of WorkItems. Thus it 22 // A WorkItem subclass that recursively contains a list of WorkItems. Thus it
23 // provides functionalities to carry out or roll back the sequence of actions 23 // provides functionalities to carry out or roll back the sequence of actions
24 // defined by the list of WorkItems it contains. 24 // defined by the list of WorkItems it contains.
25 // The WorkItems are executed in the same order as they are added to the list. 25 // The WorkItems are executed in the same order as they are added to the list.
26 class WorkItemList : public WorkItem { 26 class WorkItemList : public WorkItem {
27 public: 27 public:
28 virtual ~WorkItemList(); 28 ~WorkItemList() override;
29 29
30 // Execute the WorkItems in the same order as they are added to the list. 30 // Execute the WorkItems in the same order as they are added to the list.
31 // It aborts as soon as one WorkItem fails. 31 // It aborts as soon as one WorkItem fails.
32 virtual bool Do(); 32 bool Do() override;
33 33
34 // Rollback the WorkItems in the reverse order as they are executed. 34 // Rollback the WorkItems in the reverse order as they are executed.
35 virtual void Rollback(); 35 void Rollback() override;
36 36
37 // Add a WorkItem to the list. 37 // Add a WorkItem to the list.
38 // A WorkItem can only be added to the list before the list's DO() is called. 38 // A WorkItem can only be added to the list before the list's DO() is called.
39 // Once a WorkItem is added to the list. The list owns the WorkItem. 39 // Once a WorkItem is added to the list. The list owns the WorkItem.
40 virtual void AddWorkItem(WorkItem* work_item); 40 virtual void AddWorkItem(WorkItem* work_item);
41 41
42 // Add a CallbackWorkItem that invokes a callback. 42 // Add a CallbackWorkItem that invokes a callback.
43 virtual WorkItem* AddCallbackWorkItem( 43 virtual WorkItem* AddCallbackWorkItem(
44 base::Callback<bool(const CallbackWorkItem&)> callback); 44 base::Callback<bool(const CallbackWorkItem&)> callback);
45 45
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // executed. 153 // executed.
154 WorkItems executed_list_; 154 WorkItems executed_list_;
155 }; 155 };
156 156
157 // A specialization of WorkItemList that executes items in the list on a 157 // A specialization of WorkItemList that executes items in the list on a
158 // best-effort basis. Failure of individual items to execute does not prevent 158 // best-effort basis. Failure of individual items to execute does not prevent
159 // subsequent items from being executed. 159 // subsequent items from being executed.
160 // Also, as the class name suggests, Rollback is not possible. 160 // Also, as the class name suggests, Rollback is not possible.
161 class NoRollbackWorkItemList : public WorkItemList { 161 class NoRollbackWorkItemList : public WorkItemList {
162 public: 162 public:
163 virtual ~NoRollbackWorkItemList(); 163 ~NoRollbackWorkItemList() override;
164 164
165 // Execute the WorkItems in the same order as they are added to the list. 165 // Execute the WorkItems in the same order as they are added to the list.
166 // If a WorkItem fails, the function will return failure but all other 166 // If a WorkItem fails, the function will return failure but all other
167 // WorkItems will still be executed. 167 // WorkItems will still be executed.
168 virtual bool Do(); 168 bool Do() override;
169 169
170 // No-op. 170 // No-op.
171 virtual void Rollback(); 171 void Rollback() override;
172 }; 172 };
173 173
174 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_ 174 #endif // CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/set_reg_value_work_item_unittest.cc ('k') | chrome/installer/util/work_item_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698