blob: e9b480e93a50aed7d4b734f8c5db709601958946 [file] [log] [blame]
sorin9797aba2015-04-17 17:15:031// 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_TASK_H_
6#define COMPONENTS_UPDATE_CLIENT_TASK_H_
7
sorin08d153c2015-10-30 00:04:208#include <string>
9#include <vector>
10
Sorin Jianuf7e356502018-03-07 20:54:3411#include "base/macros.h"
12#include "base/memory/ref_counted.h"
sorin9797aba2015-04-17 17:15:0313
14namespace update_client {
15
sorin9797aba2015-04-17 17:15:0316// Defines an abstraction for a unit of work done by the update client.
17// Each invocation of the update client API results in a task being created and
18// run. In most cases, a task corresponds to a set of CRXs, which are updated
19// together.
Sorin Jianuf7e356502018-03-07 20:54:3420class Task : public base::RefCounted<Task> {
sorin9797aba2015-04-17 17:15:0321 public:
Sorin Jianuf7e356502018-03-07 20:54:3422 Task() = default;
sorin7c717622015-05-26 19:59:0923 virtual void Run() = 0;
sorin08d153c2015-10-30 00:04:2024
sorinecaad3e2015-11-13 19:15:5225 // Does a best effort attempt to make a task release its resources and stop
26 // soon. It is possible that a running task may complete even if this
27 // method is called.
28 virtual void Cancel() = 0;
29
sorin08d153c2015-10-30 00:04:2030 // Returns the ids corresponding to the CRXs associated with this update task.
31 virtual std::vector<std::string> GetIds() const = 0;
Sorin Jianuf7e356502018-03-07 20:54:3432
33 protected:
34 friend class base::RefCounted<Task>;
35 virtual ~Task() = default;
36
37 private:
38 DISALLOW_COPY_AND_ASSIGN(Task);
sorin9797aba2015-04-17 17:15:0339};
40
41} // namespace update_client
42
43#endif // COMPONENTS_UPDATE_CLIENT_TASK_H_