Flutter Engine
task_runner_checker.cc
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 #include "flutter/fml/memory/task_runner_checker.h"
6 
7 namespace fml {
8 
10  : initialized_queue_id_(InitTaskQueueId()),
11  subsumed_queue_ids_(
12  MessageLoopTaskQueues::GetInstance()->GetSubsumedTaskQueueId(
13  initialized_queue_id_)){};
14 
16 
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 };
30 
32  TaskQueueId queue_b) {
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 };
46 
47 TaskQueueId TaskRunnerChecker::InitTaskQueueId() {
50 };
51 
52 } // namespace fml
static void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
Definition: ascii_trie.cc:9
static TaskQueueId GetCurrentTaskQueueId()
Definition: message_loop.cc:76
static fml::RefPtr< MessageLoopTaskQueues > GetInstance()
#define FML_CHECK(condition)
Definition: logging.h:68
bool RunsOnCreationTaskRunner() const
static bool IsInitializedForCurrentThread()
Definition: message_loop.cc:35
static bool RunsOnTheSameThread(TaskQueueId queue_a, TaskQueueId queue_b)