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/time/time_point.h"
12 
13 namespace fml {
14 
15 class DelayedTask {
16  public:
17  DelayedTask(size_t order,
18  const fml::closure& task,
19  fml::TimePoint target_time);
20 
21  DelayedTask(const DelayedTask& other);
22 
23  ~DelayedTask();
24 
25  const fml::closure& GetTask() const;
26 
28 
29  bool operator>(const DelayedTask& other) const;
30 
31  private:
32  size_t order_;
33  fml::closure task_;
34  fml::TimePoint target_time_;
35 };
36 
37 using DelayedTaskQueue = std::priority_queue<DelayedTask,
38  std::deque<DelayedTask>,
39  std::greater<DelayedTask>>;
40 
41 } // namespace fml
42 
43 #endif // FLUTTER_FML_DELAYED_TASK_H_
Definition: ascii_trie.cc:9
bool operator>(const DelayedTask &other) const
Definition: delayed_task.cc:28
std::function< void()> closure
Definition: closure.h:14
const fml::closure & GetTask() const
Definition: delayed_task.cc:20
fml::TimePoint GetTargetTime() const
Definition: delayed_task.cc:24
std::priority_queue< DelayedTask, std::deque< DelayedTask >, std::greater< DelayedTask > > DelayedTaskQueue
Definition: delayed_task.h:39
DelayedTask(size_t order, const fml::closure &task, fml::TimePoint target_time)
Definition: delayed_task.cc:11