Flutter Engine
fml::ConcurrentTaskRunner Class Reference

#include <concurrent_message_loop.h>

Public Member Functions

 ConcurrentTaskRunner (std::weak_ptr< ConcurrentMessageLoop > weak_loop)
 
 ~ConcurrentTaskRunner ()
 
void PostTask (const fml::closure &task)
 

Detailed Description

Definition at line 61 of file concurrent_message_loop.h.

Constructor & Destructor Documentation

◆ ConcurrentTaskRunner()

fml::ConcurrentTaskRunner::ConcurrentTaskRunner ( std::weak_ptr< ConcurrentMessageLoop weak_loop)

Definition at line 151 of file concurrent_message_loop.cc.

References ~ConcurrentTaskRunner().

153  : weak_loop_(std::move(weak_loop)) {}

◆ ~ConcurrentTaskRunner()

fml::ConcurrentTaskRunner::~ConcurrentTaskRunner ( )
default

Referenced by ConcurrentTaskRunner().

Member Function Documentation

◆ PostTask()

void fml::ConcurrentTaskRunner::PostTask ( const fml::closure task)

Definition at line 157 of file concurrent_message_loop.cc.

References FML_DLOG.

157  {
158  if (!task) {
159  return;
160  }
161 
162  if (auto loop = weak_loop_.lock()) {
163  loop->PostTask(task);
164  return;
165  }
166 
167  FML_DLOG(WARNING)
168  << "Tried to post to a concurrent message loop that has already died. "
169  "Executing the task on the callers thread.";
170  task();
171 }
#define FML_DLOG(severity)
Definition: logging.h:85

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