Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
task_runner_checker.h
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#ifndef FLUTTER_FML_MEMORY_TASK_RUNNER_CHECKER_H_
6#define FLUTTER_FML_MEMORY_TASK_RUNNER_CHECKER_H_
7
8#include "flutter/fml/message_loop.h"
9#include "flutter/fml/task_runner.h"
10
11namespace fml {
12
13class TaskRunnerChecker final {
14 public:
16
18
19 bool RunsOnCreationTaskRunner() const;
20
21 static bool RunsOnTheSameThread(TaskQueueId queue_a, TaskQueueId queue_b);
22
23 private:
24 TaskQueueId initialized_queue_id_;
25 std::set<TaskQueueId> subsumed_queue_ids_;
26
27 TaskQueueId InitTaskQueueId();
28};
29
30#if !defined(NDEBUG)
31#define FML_DECLARE_TASK_RUNNER_CHECKER(c) fml::TaskRunnerChecker c
32#define FML_DCHECK_TASK_RUNNER_IS_CURRENT(c) \
33 FML_DCHECK((c).RunsOnCreationTaskRunner())
34#else
35#define FML_DECLARE_TASK_RUNNER_CHECKER(c)
36#define FML_DCHECK_TASK_RUNNER_IS_CURRENT(c) ((void)0)
37#endif
38
39} // namespace fml
40
41#endif // FLUTTER_FML_MEMORY_TASK_RUNNER_CHECKER_H_
static bool RunsOnTheSameThread(TaskQueueId queue_a, TaskQueueId queue_b)