Flutter Engine
dart_utils::ElfSnapshot Class Reference

#include <mapped_resource.h>

Public Member Functions

 ElfSnapshot ()
 
 ~ElfSnapshot ()
 
 ElfSnapshot (ElfSnapshot &&other)
 
ElfSnapshotoperator= (ElfSnapshot &&other)
 
bool Load (fdio_ns_t *namespc, const std::string &path)
 
bool Load (int dirfd, const std::string &path)
 
const uint8_t * VmData () const
 
const uint8_t * VmInstrs () const
 
const uint8_t * IsolateData () const
 
const uint8_t * IsolateInstrs () const
 

Detailed Description

Definition at line 15 of file mapped_resource.h.

Constructor & Destructor Documentation

◆ ElfSnapshot() [1/2]

dart_utils::ElfSnapshot::ElfSnapshot ( )
inline

Definition at line 17 of file mapped_resource.h.

References ~ElfSnapshot().

Referenced by IsolateInstrs().

17 {}

◆ ~ElfSnapshot()

dart_utils::ElfSnapshot::~ElfSnapshot ( )

Definition at line 166 of file mapped_resource.cc.

Referenced by ElfSnapshot().

166  {
167  Dart_UnloadELF(handle_);
168 }

◆ ElfSnapshot() [2/2]

dart_utils::ElfSnapshot::ElfSnapshot ( ElfSnapshot &&  other)
inline

Definition at line 19 of file mapped_resource.h.

19  : handle_(other.handle_) {
20  other.handle_ = nullptr;
21  }

Member Function Documentation

◆ IsolateData()

const uint8_t* dart_utils::ElfSnapshot::IsolateData ( ) const
inline

Definition at line 32 of file mapped_resource.h.

Referenced by dart_runner::CreateServiceIsolate().

32 { return isolate_data_; }

◆ IsolateInstrs()

const uint8_t* dart_utils::ElfSnapshot::IsolateInstrs ( ) const
inline

Definition at line 33 of file mapped_resource.h.

References ElfSnapshot(), Load(), and operator=().

Referenced by dart_runner::CreateServiceIsolate().

33 { return isolate_instrs_; }

◆ Load() [1/2]

bool dart_utils::ElfSnapshot::Load ( fdio_ns_t *  namespc,
const std::string &  path 
)

Definition at line 131 of file mapped_resource.cc.

References LOG_TAG.

Referenced by dart_runner::CreateServiceIsolate(), IsolateInstrs(), Load(), and operator=().

131  {
132  int root_dir = -1;
133  if (namespc == nullptr) {
134  root_dir = AT_FDCWD;
135  } else {
136  root_dir = fdio_ns_opendir(namespc);
137  if (root_dir < 0) {
138  FX_LOG(ERROR, LOG_TAG, "Failed to open namespace directory");
139  return false;
140  }
141  }
142  return Load(root_dir, path);
143 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
bool Load(fdio_ns_t *namespc, const std::string &path)
#define LOG_TAG
Definition: logging.h:11

◆ Load() [2/2]

bool dart_utils::ElfSnapshot::Load ( int  dirfd,
const std::string &  path 
)

Definition at line 145 of file mapped_resource.cc.

References error, Load(), LOG_TAG, and dart_utils::OpenFdExec().

145  {
146  const int fd = OpenFdExec(path, dirfd);
147  if (fd < 0) {
148  FX_LOGF(ERROR, LOG_TAG, "Failed to open VMO for %s from dir.",
149  path.c_str());
150  return false;
151  }
152  return Load(fd);
153 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
bool Load(fdio_ns_t *namespc, const std::string &path)
#define LOG_TAG
Definition: logging.h:11
static int OpenFdExec(const std::string &path, int dirfd)

◆ operator=()

ElfSnapshot& dart_utils::ElfSnapshot::operator= ( ElfSnapshot &&  other)
inline

Definition at line 22 of file mapped_resource.h.

References Load(), flutter::path, and fml::swap().

Referenced by IsolateInstrs().

22  {
23  std::swap(handle_, other.handle_);
24  return *this;
25  }
void swap(scoped_nsprotocol< C > &p1, scoped_nsprotocol< C > &p2)

◆ VmData()

const uint8_t* dart_utils::ElfSnapshot::VmData ( ) const
inline

Definition at line 30 of file mapped_resource.h.

30 { return vm_data_; }

◆ VmInstrs()

const uint8_t* dart_utils::ElfSnapshot::VmInstrs ( ) const
inline

Definition at line 31 of file mapped_resource.h.

31 { return vm_instrs_; }

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