Flutter Engine
flutter_runner::CompatTaskRunner Class Reference
Inheritance diagram for flutter_runner::CompatTaskRunner:
fml::TaskRunner fml::RefCountedThreadSafe< TaskRunner > fml::BasicTaskRunner fml::internal::RefCountedThreadSafeBase

Public Member Functions

 CompatTaskRunner (async_dispatcher_t *dispatcher)
 
void PostTask (const fml::closure &task) override
 
void PostTaskForTime (const fml::closure &task, fml::TimePoint target_time) override
 
void PostDelayedTask (const fml::closure &task, fml::TimeDelta delay) override
 
bool RunsTasksOnCurrentThread () override
 
- Public Member Functions inherited from fml::TaskRunner
virtual ~TaskRunner ()
 
virtual TaskQueueId GetTaskQueueId ()
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< TaskRunner >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Additional Inherited Members

- Static Public Member Functions inherited from fml::TaskRunner
static void RunNowOrPostTask (fml::RefPtr< fml::TaskRunner > runner, const fml::closure &task)
 
- Protected Member Functions inherited from fml::TaskRunner
 TaskRunner (fml::RefPtr< MessageLoopImpl > loop)
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< TaskRunner >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Detailed Description

Definition at line 15 of file task_runner_adapter.cc.

Constructor & Destructor Documentation

◆ CompatTaskRunner()

flutter_runner::CompatTaskRunner::CompatTaskRunner ( async_dispatcher_t *  dispatcher)
inline

Definition at line 17 of file task_runner_adapter.cc.

References FML_DCHECK.

18  : fml::TaskRunner(nullptr), forwarding_target_(dispatcher) {
19  FML_DCHECK(forwarding_target_);
20  }
#define FML_DCHECK(condition)
Definition: logging.h:86

Member Function Documentation

◆ PostDelayedTask()

void flutter_runner::CompatTaskRunner::PostDelayedTask ( const fml::closure task,
fml::TimeDelta  delay 
)
inlineoverridevirtual

Schedules a task to be run on the MessageLoop after the time delay has passed.

Note
There is latency between when the task is schedule and actually executed so that the actual execution time is: now + delay + message_loop_latency, where message_loop_latency is undefined and could be tens of milliseconds.

Reimplemented from fml::TaskRunner.

Definition at line 33 of file task_runner_adapter.cc.

References fml::TimeDelta::ToNanoseconds().

34  {
35  async::PostDelayedTask(forwarding_target_, task,
36  zx::duration(delay.ToNanoseconds()));
37  }
constexpr int64_t ToNanoseconds() const
Definition: time_delta.h:61

◆ PostTask()

void flutter_runner::CompatTaskRunner::PostTask ( const fml::closure task)
inlineoverridevirtual

Schedules task to be executed on the TaskRunner's associated event loop.

Reimplemented from fml::TaskRunner.

Definition at line 22 of file task_runner_adapter.cc.

22  {
23  async::PostTask(forwarding_target_, task);
24  }

◆ PostTaskForTime()

void flutter_runner::CompatTaskRunner::PostTaskForTime ( const fml::closure task,
fml::TimePoint  target_time 
)
inlineoverridevirtual

Reimplemented from fml::TaskRunner.

Definition at line 26 of file task_runner_adapter.cc.

References fml::TimePoint::ToEpochDelta(), and fml::TimeDelta::ToNanoseconds().

27  {
28  async::PostTaskForTime(
29  forwarding_target_, task,
30  zx::time(target_time.ToEpochDelta().ToNanoseconds()));
31  }
TimeDelta ToEpochDelta() const
Definition: time_point.h:47
constexpr int64_t ToNanoseconds() const
Definition: time_delta.h:61

◆ RunsTasksOnCurrentThread()

bool flutter_runner::CompatTaskRunner::RunsTasksOnCurrentThread ( )
inlineoverridevirtual

Returns true when the current executing thread's TaskRunner matches this instance.

Reimplemented from fml::TaskRunner.

Definition at line 39 of file task_runner_adapter.cc.

39  {
40  return forwarding_target_ == async_get_default_dispatcher();
41  }

The documentation for this class was generated from the following file: