sorin | 9797aba | 2015-04-17 17:15:03 | [diff] [blame] | 1 | // Copyright 2015 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. |
| 4 | |
| 5 | #ifndef COMPONENTS_UPDATE_CLIENT_ACTION_WAIT_H_ |
| 6 | #define COMPONENTS_UPDATE_CLIENT_ACTION_WAIT_H_ |
| 7 | |
| 8 | #include "base/callback.h" |
| 9 | #include "base/macros.h" |
| 10 | #include "base/time/time.h" |
| 11 | |
| 12 | #include "components/update_client/action.h" |
| 13 | |
| 14 | namespace update_client { |
| 15 | |
| 16 | // Implements a wait between handling updates for the CRXs in this context. |
| 17 | // To avoid thrashing of local computing resources, updates are applied one |
| 18 | // at a time, with a delay between them. |
| 19 | class ActionWait : public Action, protected ActionImpl { |
| 20 | public: |
| 21 | explicit ActionWait(const base::TimeDelta& time_delta); |
| 22 | ~ActionWait() override; |
| 23 | |
| 24 | void Run(UpdateContext* update_context, Callback callback) override; |
| 25 | |
| 26 | private: |
| 27 | void WaitComplete(); |
| 28 | |
| 29 | const base::TimeDelta time_delta_; |
| 30 | |
| 31 | DISALLOW_COPY_AND_ASSIGN(ActionWait); |
| 32 | }; |
| 33 | |
| 34 | } // namespace update_client |
| 35 | |
| 36 | #endif // COMPONENTS_UPDATE_CLIENT_ACTION_WAIT_H_ |