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()),
11  subsumed_queue_ids_(
12  MessageLoopTaskQueues::GetInstance()->GetSubsumedTaskQueueId(
13  initialized_queue_id_)){};
static fml::RefPtr< MessageLoopTaskQueues > GetInstance()

◆ ~TaskRunnerChecker()

fml::TaskRunnerChecker::~TaskRunnerChecker ( )
default

Referenced by TaskRunnerChecker().

Member Function Documentation

◆ RunsOnCreationTaskRunner()

bool fml::TaskRunnerChecker::RunsOnCreationTaskRunner ( ) const

Definition at line 17 of file task_runner_checker.cc.

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

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

17  {
19  const auto current_queue_id = MessageLoop::GetCurrentTaskQueueId();
20  if (RunsOnTheSameThread(current_queue_id, initialized_queue_id_)) {
21  return true;
22  }
23  for (auto& subsumed : subsumed_queue_ids_) {
24  if (RunsOnTheSameThread(current_queue_id, subsumed)) {
25  return true;
26  }
27  }
28  return false;
29 };
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 31 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().

32  {
33  if (queue_a == queue_b) {
34  return true;
35  }
36 
37  auto queues = MessageLoopTaskQueues::GetInstance();
38  if (queues->Owns(queue_a, queue_b)) {
39  return true;
40  }
41  if (queues->Owns(queue_b, queue_a)) {
42  return true;
43  }
44  return false;
45 };
static fml::RefPtr< MessageLoopTaskQueues > GetInstance()

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