Flutter Engine
 
Loading...
Searching...
No Matches
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 (intptr_t runner, uint64_t task) const
 
void InvalidateActiveRunners ()
 

Static Public Member Functions

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

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 308 of file embedder_thread_host.cc.

312 : host_(std::move(host)), runners_(runners) {
313 std::lock_guard guard(active_runners_mutex_);
314 for (const auto& runner : embedder_task_runners) {
315 runners_map_[runner->unique_id()] = runner;
316 active_runners_.insert(runner->unique_id());
317 }
318}
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 switch_defs.h:69

◆ ~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 96 of file embedder_thread_host.cc.

98 {
99 {
100 auto host =
101 CreateEmbedderManagedThreadHost(custom_task_runners, config_setter);
102 if (host && host->IsValid()) {
103 return host;
104 }
105 }
106
107 // Only attempt to create the engine managed host if the embedder did not
108 // specify a custom configuration. Don't fallback to the engine managed
109 // configuration if the embedder attempted to specify a configuration but
110 // messed up with an incorrect configuration.
111 if (custom_task_runners == nullptr) {
112 auto host = CreateEngineManagedThreadHost(config_setter);
113 if (host && host->IsValid()) {
114 return host;
115 }
116 }
117
118 return nullptr;
119}

References flutter::host.

Referenced by FlutterEngineInitialize().

◆ GetTaskRunners()

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

Definition at line 338 of file embedder_thread_host.cc.

338 {
339 return runners_;
340}

◆ InvalidateActiveRunners()

void flutter::EmbedderThreadHost::InvalidateActiveRunners ( )

Definition at line 322 of file embedder_thread_host.cc.

322 {
323 std::lock_guard guard(active_runners_mutex_);
324 for (const auto& runner : runners_map_) {
325 active_runners_.erase(runner.first);
326 }
327}

◆ IsValid()

bool flutter::EmbedderThreadHost::IsValid ( ) const

Definition at line 334 of file embedder_thread_host.cc.

334 {
335 return runners_.IsValid();
336}

References flutter::TaskRunners::IsValid().

◆ PostTask()

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

Definition at line 342 of file embedder_thread_host.cc.

342 {
343 auto found = runners_map_.find(runner);
344 if (found == runners_map_.end()) {
345 return false;
346 }
347 return found->second->PostTask(task);
348}

◆ RunnerIsValid()

bool flutter::EmbedderThreadHost::RunnerIsValid ( intptr_t  runner)
static

Definition at line 329 of file embedder_thread_host.cc.

329 {
330 std::lock_guard guard(active_runners_mutex_);
331 return active_runners_.find(runner) != active_runners_.end();
332}

Referenced by FlutterEngineRunTask().


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