Flutter Engine
flutter_runner::Application Class Referencefinal

#include <component.h>

Inheritance diagram for flutter_runner::Application:
flutter_runner::Engine::Delegate

Public Types

using TerminationCallback = fit::function< void(const Application *)>
 

Public Member Functions

 ~Application ()
 
const std::string & GetDebugLabel () const
 
void WriteProfileToTrace () const
 

Static Public Member Functions

static ActiveApplication Create (TerminationCallback termination_callback, fuchsia::sys::Package package, fuchsia::sys::StartupInfo startup_info, std::shared_ptr< sys::ServiceDirectory > runner_incoming_services, fidl::InterfaceRequest< fuchsia::sys::ComponentController > controller)
 
static void ParseProgramMetadata (const fidl::VectorPtr< fuchsia::sys::ProgramMetadata > &program_metadata, std::string *data_path, std::string *assets_path)
 

Detailed Description

Definition at line 53 of file component.h.

Member Typedef Documentation

◆ TerminationCallback

Constructor & Destructor Documentation

◆ ~Application()

flutter_runner::Application::~Application ( )
default

Member Function Documentation

◆ Create()

ActiveApplication flutter_runner::Application::Create ( TerminationCallback  termination_callback,
fuchsia::sys::Package  package,
fuchsia::sys::StartupInfo  startup_info,
std::shared_ptr< sys::ServiceDirectory >  runner_incoming_services,
fidl::InterfaceRequest< fuchsia::sys::ComponentController >  controller 
)
static

Definition at line 83 of file component.cc.

References fml::AutoResetWaitableEvent::Signal(), and fml::AutoResetWaitableEvent::Wait().

Referenced by flutter_runner::Runner::~Runner().

88  {
89  std::unique_ptr<Thread> thread = std::make_unique<Thread>();
90  std::unique_ptr<Application> application;
91 
93  async::PostTask(thread->dispatcher(), [&]() mutable {
94  application.reset(
95  new Application(std::move(termination_callback), std::move(package),
96  std::move(startup_info), runner_incoming_services,
97  std::move(controller)));
98  latch.Signal();
99  });
100 
101  latch.Wait();
102  return {.thread = std::move(thread), .application = std::move(application)};
103 }

◆ GetDebugLabel()

const std::string & flutter_runner::Application::GetDebugLabel ( ) const

Definition at line 461 of file component.cc.

461  {
462  return debug_label_;
463 }

◆ ParseProgramMetadata()

void flutter_runner::Application::ParseProgramMetadata ( const fidl::VectorPtr< fuchsia::sys::ProgramMetadata > &  program_metadata,
std::string *  data_path,
std::string *  assets_path 
)
static

Definition at line 61 of file component.cc.

Referenced by flutter_runner::MakeDataFileMapping().

64  {
65  if (!program_metadata.has_value()) {
66  return;
67  }
68  for (const auto& pg : *program_metadata) {
69  if (pg.key.compare(kDataKey) == 0) {
70  *data_path = "pkg/" + pg.value;
71  } else if (pg.key.compare(kAssetsKey) == 0) {
72  *assets_path = "pkg/" + pg.value;
73  }
74  }
75 
76  // assets_path defaults to the same as data_path if omitted.
77  if (assets_path->empty()) {
78  *assets_path = *data_path;
79  }
80 }
constexpr char kDataKey[]
Definition: component.cc:54
constexpr char kAssetsKey[]
Definition: component.cc:55

◆ WriteProfileToTrace()

void flutter_runner::Application::WriteProfileToTrace ( ) const

Definition at line 660 of file component.cc.

References engine.

660  {
661  for (const auto& engine : shell_holders_) {
662  engine->WriteProfileToTrace();
663  }
664 }

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