Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
tonic::DartLibraryNatives Class Reference

#include <dart_library_natives.h>

Classes

struct  Entry
 

Public Member Functions

 DartLibraryNatives ()
 
 ~DartLibraryNatives ()
 
void Register (std::initializer_list< Entry > entries)
 
Dart_NativeFunction GetNativeFunction (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
const uint8_t * GetSymbol (Dart_NativeFunction native_function)
 

Detailed Description

Definition at line 17 of file dart_library_natives.h.

Constructor & Destructor Documentation

◆ DartLibraryNatives()

tonic::DartLibraryNatives::DartLibraryNatives ( )

Definition at line 11 of file dart_library_natives.cc.

11{}

◆ ~DartLibraryNatives()

tonic::DartLibraryNatives::~DartLibraryNatives ( )

Definition at line 13 of file dart_library_natives.cc.

13{}

Member Function Documentation

◆ GetNativeFunction()

Dart_NativeFunction tonic::DartLibraryNatives::GetNativeFunction ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)

Definition at line 22 of file dart_library_natives.cc.

25 {
26 std::string name_string = StdStringFromDart(name);
27 auto it = entries_.find(name_string);
28 if (it == entries_.end())
29 return nullptr;
30 const Entry& entry = it->second;
31 if (entry.argument_count != argument_count)
32 return nullptr;
33 *auto_setup_scope = entry.auto_setup_scope;
34 return entry.native_function;
35}
int argument_count
Definition: fuchsia.cc:52
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
std::string StdStringFromDart(Dart_Handle handle)

◆ GetSymbol()

const uint8_t * tonic::DartLibraryNatives::GetSymbol ( Dart_NativeFunction  native_function)

Definition at line 37 of file dart_library_natives.cc.

38 {
39 auto it = symbols_.find(native_function);
40 if (it == symbols_.end())
41 return nullptr;
42 return reinterpret_cast<const uint8_t*>(it->second);
43}

◆ Register()

void tonic::DartLibraryNatives::Register ( std::initializer_list< Entry entries)

Definition at line 15 of file dart_library_natives.cc.

15 {
16 for (const Entry& entry : entries) {
17 symbols_.emplace(entry.native_function, entry.symbol);
18 entries_.emplace(entry.symbol, entry);
19 }
20}

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