Flutter Engine
embedder_thread_host.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_SHELL_PLATFORM_EMBEDDER_EMBEDDER_THREAD_HOST_H_
6 #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_THREAD_HOST_H_
7 
8 #include <map>
9 #include <memory>
10 #include <set>
11 
12 #include "flutter/common/task_runners.h"
13 #include "flutter/fml/macros.h"
14 #include "flutter/shell/common/thread_host.h"
15 #include "flutter/shell/platform/embedder/embedder.h"
16 #include "flutter/shell/platform/embedder/embedder_task_runner.h"
17 
18 namespace flutter {
19 
21  public:
22  static std::unique_ptr<EmbedderThreadHost>
24  const FlutterCustomTaskRunners* custom_task_runners);
25 
27  ThreadHost host,
28  flutter::TaskRunners runners,
29  std::set<fml::RefPtr<EmbedderTaskRunner>> embedder_task_runners);
30 
32 
33  bool IsValid() const;
34 
35  const flutter::TaskRunners& GetTaskRunners() const;
36 
37  bool PostTask(int64_t runner, uint64_t task) const;
38 
39  private:
40  ThreadHost host_;
41  flutter::TaskRunners runners_;
42  std::map<int64_t, fml::RefPtr<EmbedderTaskRunner>> runners_map_;
43 
44  static std::unique_ptr<EmbedderThreadHost> CreateEmbedderManagedThreadHost(
45  const FlutterCustomTaskRunners* custom_task_runners);
46 
47  static std::unique_ptr<EmbedderThreadHost> CreateEngineManagedThreadHost();
48 
49  FML_DISALLOW_COPY_AND_ASSIGN(EmbedderThreadHost);
50 };
51 
52 } // namespace flutter
53 
54 #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_THREAD_HOST_H_
EmbedderThreadHost(ThreadHost host, flutter::TaskRunners runners, std::set< fml::RefPtr< EmbedderTaskRunner >> embedder_task_runners)
The collection of all the threads used by the engine.
Definition: thread_host.h:16
static std::unique_ptr< EmbedderThreadHost > CreateEmbedderOrEngineManagedThreadHost(const FlutterCustomTaskRunners *custom_task_runners)
const flutter::TaskRunners & GetTaskRunners() const
bool PostTask(int64_t runner, uint64_t task) const