Flutter Engine
flutter_runner::FileInNamespaceBuffer Class Referencefinal
Inheritance diagram for flutter_runner::FileInNamespaceBuffer:
fml::Mapping

Public Member Functions

 FileInNamespaceBuffer (int namespace_fd, const char *path, bool executable)
 
 ~FileInNamespaceBuffer ()
 
const uint8_t * GetMapping () const override
 
size_t GetSize () const override
 
- Public Member Functions inherited from fml::Mapping
 Mapping ()
 
virtual ~Mapping ()
 

Detailed Description

Definition at line 465 of file component.cc.

Constructor & Destructor Documentation

◆ FileInNamespaceBuffer()

flutter_runner::FileInNamespaceBuffer::FileInNamespaceBuffer ( int  namespace_fd,
const char *  path,
bool  executable 
)
inline

Definition at line 467 of file component.cc.

468  : address_(nullptr), size_(0) {
469  fuchsia::mem::Buffer buffer;
470  if (!dart_utils::VmoFromFilenameAt(namespace_fd, path, executable,
471  &buffer)) {
472  return;
473  }
474  if (buffer.size == 0) {
475  return;
476  }
477 
478  uint32_t flags = ZX_VM_PERM_READ;
479  if (executable) {
480  flags |= ZX_VM_PERM_EXECUTE;
481  }
482  uintptr_t addr;
483  zx_status_t status =
484  zx::vmar::root_self()->map(flags, 0, buffer.vmo, 0, buffer.size, &addr);
485  if (status != ZX_OK) {
486  FML_LOG(FATAL) << "Failed to map " << path << ": "
487  << zx_status_get_string(status);
488  }
489 
490  address_ = reinterpret_cast<void*>(addr);
491  size_ = buffer.size;
492  }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
#define FML_LOG(severity)
Definition: logging.h:65
bool VmoFromFilenameAt(int dirfd, const std::string &filename, bool executable, fuchsia::mem::Buffer *buffer)
Definition: vmo.cc:76
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart flags
Definition: switches.h:66

◆ ~FileInNamespaceBuffer()

flutter_runner::FileInNamespaceBuffer::~FileInNamespaceBuffer ( )
inline

Definition at line 494 of file component.cc.

494  {
495  if (address_ != nullptr) {
496  zx::vmar::root_self()->unmap(reinterpret_cast<uintptr_t>(address_),
497  size_);
498  address_ = nullptr;
499  size_ = 0;
500  }
501  }

Member Function Documentation

◆ GetMapping()

const uint8_t* flutter_runner::FileInNamespaceBuffer::GetMapping ( ) const
inlineoverridevirtual

Implements fml::Mapping.

Definition at line 504 of file component.cc.

504  {
505  return reinterpret_cast<const uint8_t*>(address_);
506  }

◆ GetSize()

size_t flutter_runner::FileInNamespaceBuffer::GetSize ( ) const
inlineoverridevirtual

Implements fml::Mapping.

Definition at line 509 of file component.cc.

509 { return size_; }

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