Flutter Engine
delayed_task.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_FML_DELAYED_TASK_H_
6 #define FLUTTER_FML_DELAYED_TASK_H_
7 
8 #include <queue>
9 
10 #include "flutter/fml/closure.h"
11 #include "flutter/fml/task_source_grade.h"
12 #include "flutter/fml/time/time_point.h"
13 
14 namespace fml {
15 
16 class DelayedTask {
17  public:
18  DelayedTask(size_t order,
19  const fml::closure& task,
20  fml::TimePoint target_time,
21  fml::TaskSourceGrade task_source_grade);
22 
23  DelayedTask(const DelayedTask& other);
24 
25  ~DelayedTask();
26 
27  const fml::closure& GetTask() const;
28 
30 
32 
33  bool operator>(const DelayedTask& other) const;
34 
35  private:
36  size_t order_;
37  fml::closure task_;
38  fml::TimePoint target_time_;
39  fml::TaskSourceGrade task_source_grade_;
40 };
41 
42 using DelayedTaskQueue = std::priority_queue<DelayedTask,
43  std::deque<DelayedTask>,
44  std::greater<DelayedTask>>;
45 
46 } // namespace fml
47 
48 #endif // FLUTTER_FML_DELAYED_TASK_H_
Definition: ascii_trie.cc:9
bool operator>(const DelayedTask &other) const
Definition: delayed_task.cc:36
DelayedTask(size_t order, const fml::closure &task, fml::TimePoint target_time, fml::TaskSourceGrade task_source_grade)
Definition: delayed_task.cc:11
std::function< void()> closure
Definition: closure.h:14
const fml::closure & GetTask() const
Definition: delayed_task.cc:24
fml::TimePoint GetTargetTime() const
Definition: delayed_task.cc:28
std::priority_queue< DelayedTask, std::deque< DelayedTask >, std::greater< DelayedTask > > DelayedTaskQueue
Definition: delayed_task.h:44
fml::TaskSourceGrade GetTaskSourceGrade() const
Definition: delayed_task.cc:32