Flutter Engine
fml::NativeLibrary Class Reference

#include <native_library.h>

Inheritance diagram for fml::NativeLibrary:
fml::RefCountedThreadSafe< NativeLibrary > fml::internal::RefCountedThreadSafeBase

Public Types

using Handle = void *
 

Public Member Functions

const uint8_t * ResolveSymbol (const char *symbol)
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< NativeLibrary >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Static Public Member Functions

static fml::RefPtr< NativeLibraryCreate (const char *path)
 
static fml::RefPtr< NativeLibraryCreateWithHandle (Handle handle, bool close_handle_when_done)
 
static fml::RefPtr< NativeLibraryCreateForCurrentProcess ()
 

Additional Inherited Members

- Protected Member Functions inherited from fml::RefCountedThreadSafe< NativeLibrary >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Detailed Description

Definition at line 18 of file native_library.h.

Member Typedef Documentation

◆ Handle

Definition at line 23 of file native_library.h.

Member Function Documentation

◆ Create()

fml::RefPtr< NativeLibrary > fml::NativeLibrary::Create ( const char *  path)
static

Definition at line 43 of file native_library_posix.cc.

References fml::AdoptRef().

Referenced by flutter::GetSymbolMapping(), IsRendererValid(), and flutter::SearchMapping().

43  {
44  auto library = fml::AdoptRef(new NativeLibrary(path));
45  return library->GetHandle() != nullptr ? library : nullptr;
46 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
RefPtr< T > AdoptRef(T *ptr)
Definition: ref_ptr.h:218

◆ CreateForCurrentProcess()

fml::RefPtr< NativeLibrary > fml::NativeLibrary::CreateForCurrentProcess ( )
static

Definition at line 56 of file native_library_posix.cc.

References fml::AdoptRef().

Referenced by flutter::GetSymbolMapping(), IsRendererValid(), and flutter::SearchMapping().

56  {
57  return fml::AdoptRef(new NativeLibrary(RTLD_DEFAULT, false));
58 }
RefPtr< T > AdoptRef(T *ptr)
Definition: ref_ptr.h:218

◆ CreateWithHandle()

fml::RefPtr< NativeLibrary > fml::NativeLibrary::CreateWithHandle ( Handle  handle,
bool  close_handle_when_done 
)
static

Definition at line 48 of file native_library_posix.cc.

References fml::AdoptRef().

50  {
51  auto library =
52  fml::AdoptRef(new NativeLibrary(handle, close_handle_when_done));
53  return library->GetHandle() != nullptr ? library : nullptr;
54 }
RefPtr< T > AdoptRef(T *ptr)
Definition: ref_ptr.h:218

◆ ResolveSymbol()

const uint8_t * fml::NativeLibrary::ResolveSymbol ( const char *  symbol)

Definition at line 60 of file native_library_posix.cc.

References FML_DLOG.

Referenced by IsRendererValid(), and fml::SymbolMapping::SymbolMapping().

60  {
61  auto* resolved_symbol = static_cast<const uint8_t*>(::dlsym(handle_, symbol));
62  if (resolved_symbol == nullptr) {
63  FML_DLOG(INFO) << "Could not resolve symbol in library: " << symbol;
64  }
65  return resolved_symbol;
66 }
#define FML_DLOG(severity)
Definition: logging.h:85

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