Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
dart::BootstrapNatives Class Reference

#include <bootstrap_natives.h>

Inheritance diagram for dart::BootstrapNatives:
dart::AllStatic

Static Public Member Functions

static Dart_NativeFunction Lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
static void * LookupFfiNative (const char *name, uintptr_t argument_count)
 
static const uint8_t * Symbol (Dart_NativeFunction nf)
 

Detailed Description

Definition at line 373 of file bootstrap_natives.h.

Member Function Documentation

◆ Lookup()

Dart_NativeFunction dart::BootstrapNatives::Lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 43 of file bootstrap_natives.cc.

45 {
46 Thread* thread = Thread::Current();
47 TransitionNativeToVM transition(thread);
48 const Object& obj = Object::Handle(thread->zone(), Api::UnwrapHandle(name));
49 if (!obj.IsString()) {
50 return nullptr;
51 }
52 ASSERT(auto_setup_scope);
53 *auto_setup_scope = false;
54 const char* function_name = obj.ToCString();
55 ASSERT(function_name != nullptr);
56 int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries);
57 for (int i = 0; i < num_entries; i++) {
58 const struct NativeEntries* entry = &(BootStrapEntries[i]);
59 if ((strcmp(function_name, entry->name_) == 0) &&
60 (entry->argument_count_ == argument_count)) {
61 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
62 }
63 }
64 return nullptr;
65}
static ObjectPtr UnwrapHandle(Dart_Handle object)
static Object & Handle()
Definition: object.h:407
static Thread * Current()
Definition: thread.h:362
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
Definition: dart_api.h:3207
#define ASSERT(E)
int argument_count
Definition: fuchsia.cc:52
const char *const name
static const struct dart::NativeEntries BootStrapEntries[]
const char *const function_name

◆ LookupFfiNative()

void * dart::BootstrapNatives::LookupFfiNative ( const char *  name,
uintptr_t  argument_count 
)
static

Definition at line 67 of file bootstrap_natives.cc.

68 {
69 int num_entries =
70 sizeof(BootStrapFfiEntries) / sizeof(struct FfiNativeEntries);
71 for (int i = 0; i < num_entries; i++) {
72 const struct FfiNativeEntries* entry = &(BootStrapFfiEntries[i]);
73 if (strcmp(name, entry->name_) == 0) {
74 return entry->function_;
75 }
76 }
77 return nullptr;
78}
static const struct dart::FfiNativeEntries BootStrapFfiEntries[]

◆ Symbol()

const uint8_t * dart::BootstrapNatives::Symbol ( Dart_NativeFunction  nf)
static

Definition at line 80 of file bootstrap_natives.cc.

80 {
81 int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries);
82 for (int i = 0; i < num_entries; i++) {
83 const struct NativeEntries* entry = &(BootStrapEntries[i]);
84 if (reinterpret_cast<Dart_NativeFunction>(entry->function_) == nf) {
85 return reinterpret_cast<const uint8_t*>(entry->name_);
86 }
87 }
88 return nullptr;
89}

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