• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2018 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #ifndef API_TASK_QUEUE_QUEUED_TASK_H_
11 #define API_TASK_QUEUE_QUEUED_TASK_H_
12 
13 namespace webrtc {
14 
15 // Base interface for asynchronously executed tasks.
16 // The interface basically consists of a single function, Run(), that executes
17 // on the target queue.  For more details see the Run() method and TaskQueue.
18 class QueuedTask {
19  public:
20   virtual ~QueuedTask() = default;
21 
22   // Main routine that will run when the task is executed on the desired queue.
23   // The task should return |true| to indicate that it should be deleted or
24   // |false| to indicate that the queue should consider ownership of the task
25   // having been transferred.  Returning |false| can be useful if a task has
26   // re-posted itself to a different queue or is otherwise being re-used.
27   virtual bool Run() = 0;
28 };
29 
30 }  // namespace webrtc
31 
32 #endif  // API_TASK_QUEUE_QUEUED_TASK_H_
33