Flutter Engine
fml::TaskRunnerChecker Class Referencefinal

#include <task_runner_checker.h>

Public Member Functions

 TaskRunnerChecker ()
 
 ~TaskRunnerChecker ()
 
bool RunsOnCreationTaskRunner () const
 

Static Public Member Functions

static bool RunsOnTheSameThread (TaskQueueId queue_a, TaskQueueId queue_b)
 

Detailed Description

Definition at line 13 of file task_runner_checker.h.

Constructor & Destructor Documentation

◆ TaskRunnerChecker()

fml::TaskRunnerChecker::TaskRunnerChecker ( )

Definition at line 9 of file task_runner_checker.cc.

References ~TaskRunnerChecker().

10  : initialized_queue_id_(InitTaskQueueId()){};

◆ ~TaskRunnerChecker()

fml::TaskRunnerChecker::~TaskRunnerChecker ( )
default

Referenced by TaskRunnerChecker().

Member Function Documentation

◆ RunsOnCreationTaskRunner()

bool fml::TaskRunnerChecker::RunsOnCreationTaskRunner ( ) const

Definition at line 14 of file task_runner_checker.cc.

References FML_CHECK, fml::MessageLoop::GetCurrentTaskQueueId(), fml::MessageLoop::IsInitializedForCurrentThread(), and RunsOnTheSameThread().

Referenced by fml::testing::TEST().

14  {
16  const auto current_queue_id = MessageLoop::GetCurrentTaskQueueId();
17  return RunsOnTheSameThread(current_queue_id, initialized_queue_id_);
18 };
static TaskQueueId GetCurrentTaskQueueId()
Definition: message_loop.cc:76
#define FML_CHECK(condition)
Definition: logging.h:68
static bool IsInitializedForCurrentThread()
Definition: message_loop.cc:35
static bool RunsOnTheSameThread(TaskQueueId queue_a, TaskQueueId queue_b)

◆ RunsOnTheSameThread()

bool fml::TaskRunnerChecker::RunsOnTheSameThread ( TaskQueueId  queue_a,
TaskQueueId  queue_b 
)
static

Definition at line 20 of file task_runner_checker.cc.

References fml::MessageLoop::EnsureInitializedForCurrentThread(), fml::MessageLoop::GetCurrentTaskQueueId(), and fml::MessageLoopTaskQueues::GetInstance().

Referenced by RunsOnCreationTaskRunner(), fml::TaskRunner::RunsTasksOnCurrentThread(), fml::testing::TEST(), and flutter::testing::TEST_F().

21  {
22  if (queue_a == queue_b) {
23  return true;
24  }
25 
26  auto queues = MessageLoopTaskQueues::GetInstance();
27  if (queues->Owns(queue_a, queue_b)) {
28  return true;
29  }
30  if (queues->Owns(queue_b, queue_a)) {
31  return true;
32  }
33  return false;
34 };
static fml::RefPtr< MessageLoopTaskQueues > GetInstance()

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