Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
flutter::EmbedderThreadHost Class Reference

#include <embedder_thread_host.h>

Public Member Functions

 EmbedderThreadHost (ThreadHost host, const flutter::TaskRunners &runners, const std::set< fml::RefPtr< EmbedderTaskRunner > > &embedder_task_runners)
 
 ~EmbedderThreadHost ()
 
bool IsValid () const
 
const flutter::TaskRunnersGetTaskRunners () const
 
bool PostTask (int64_t runner, uint64_t task) const
 

Static Public Member Functions

static std::unique_ptr< EmbedderThreadHostCreateEmbedderOrEngineManagedThreadHost (const FlutterCustomTaskRunners *custom_task_runners, const flutter::ThreadConfigSetter &config_setter=fml::Thread::SetCurrentThreadName)
 

Detailed Description

Definition at line 20 of file embedder_thread_host.h.

Constructor & Destructor Documentation

◆ EmbedderThreadHost()

flutter::EmbedderThreadHost::EmbedderThreadHost ( ThreadHost  host,
const flutter::TaskRunners runners,
const std::set< fml::RefPtr< EmbedderTaskRunner > > &  embedder_task_runners 
)

Definition at line 270 of file embedder_thread_host.cc.

274 : host_(std::move(host)), runners_(runners) {
275 for (const auto& runner : embedder_task_runners) {
276 runners_map_[reinterpret_cast<int64_t>(runner.get())] = runner;
277 }
278}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service host
Definition switches.h:74

◆ ~EmbedderThreadHost()

flutter::EmbedderThreadHost::~EmbedderThreadHost ( )
default

Member Function Documentation

◆ CreateEmbedderOrEngineManagedThreadHost()

std::unique_ptr< EmbedderThreadHost > flutter::EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost ( const FlutterCustomTaskRunners custom_task_runners,
const flutter::ThreadConfigSetter config_setter = fml::Thread::SetCurrentThreadName 
)
static

Definition at line 83 of file embedder_thread_host.cc.

85 {
86 {
87 auto host =
88 CreateEmbedderManagedThreadHost(custom_task_runners, config_setter);
89 if (host && host->IsValid()) {
90 return host;
91 }
92 }
93
94 // Only attempt to create the engine managed host if the embedder did not
95 // specify a custom configuration. Don't fallback to the engine managed
96 // configuration if the embedder attempted to specify a configuration but
97 // messed up with an incorrect configuration.
98 if (custom_task_runners == nullptr) {
99 auto host = CreateEngineManagedThreadHost(config_setter);
100 if (host && host->IsValid()) {
101 return host;
102 }
103 }
104
105 return nullptr;
106}

◆ GetTaskRunners()

const flutter::TaskRunners & flutter::EmbedderThreadHost::GetTaskRunners ( ) const

Definition at line 286 of file embedder_thread_host.cc.

286 {
287 return runners_;
288}

◆ IsValid()

bool flutter::EmbedderThreadHost::IsValid ( ) const

Definition at line 282 of file embedder_thread_host.cc.

282 {
283 return runners_.IsValid();
284}

◆ PostTask()

bool flutter::EmbedderThreadHost::PostTask ( int64_t  runner,
uint64_t  task 
) const

Definition at line 290 of file embedder_thread_host.cc.

290 {
291 auto found = runners_map_.find(runner);
292 if (found == runners_map_.end()) {
293 return false;
294 }
295 return found->second->PostTask(task);
296}

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