Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::testing::TestDartNativeResolver Class Reference

#include <test_dart_native_resolver.h>

Inheritance diagram for flutter::testing::TestDartNativeResolver:

Public Member Functions

 TestDartNativeResolver ()
 
 ~TestDartNativeResolver ()
 
void AddNativeCallback (const std::string &name, Dart_NativeFunction callback)
 
void AddFfiNativeCallback (const std::string &name, void *callback_ptr)
 
void SetNativeResolverForIsolate ()
 

Detailed Description

Definition at line 31 of file test_dart_native_resolver.h.

Constructor & Destructor Documentation

◆ TestDartNativeResolver()

flutter::testing::TestDartNativeResolver::TestDartNativeResolver ( )
default

◆ ~TestDartNativeResolver()

flutter::testing::TestDartNativeResolver::~TestDartNativeResolver ( )
default

Member Function Documentation

◆ AddFfiNativeCallback()

void flutter::testing::TestDartNativeResolver::AddFfiNativeCallback ( const std::string &  name,
void *  callback_ptr 
)

Definition at line 25 of file test_dart_native_resolver.cc.

26 {
27 ffi_native_callbacks_[name] = callback_ptr;
28}
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ AddNativeCallback()

void flutter::testing::TestDartNativeResolver::AddNativeCallback ( const std::string &  name,
Dart_NativeFunction  callback 
)

Definition at line 21 of file test_dart_native_resolver.cc.

22 {
23 native_callbacks_[name] = callback;
24}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ SetNativeResolverForIsolate()

void flutter::testing::TestDartNativeResolver::SetNativeResolverForIsolate ( )

Definition at line 100 of file test_dart_native_resolver.cc.

100 {
103 DartNativeEntryResolverCallback,
106 << "Could not set native resolver in test.";
107
108 result = Dart_SetFfiNativeResolver(Dart_RootLibrary(), &FfiNativeResolver);
110 << "Could not set FFI native resolver in test.";
111
112 std::scoped_lock lock(gIsolateResolversMutex);
113 gIsolateResolvers[Dart_CurrentIsolate()] = shared_from_this();
114
115 std::vector<Dart_Isolate> isolates_with_dead_resolvers;
116 for (const auto& entry : gIsolateResolvers) {
117 if (!entry.second.lock()) {
118 isolates_with_dead_resolvers.push_back(entry.first);
119 }
120 }
121
122 for (const auto& dead_isolate : isolates_with_dead_resolvers) {
123 gIsolateResolvers.erase(dead_isolate);
124 }
125}
DART_EXPORT Dart_Handle Dart_SetFfiNativeResolver(Dart_Handle library, Dart_FfiNativeResolver resolver)
DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
DART_EXPORT Dart_Isolate Dart_CurrentIsolate(void)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_RootLibrary(void)
GAsyncResult * result
#define FML_CHECK(condition)
Definition: logging.h:85
static std::mutex gIsolateResolversMutex
static std::map< Dart_Isolate, std::weak_ptr< TestDartNativeResolver > > gIsolateResolvers
static const uint8_t * DartNativeEntrySymbolCallback(Dart_NativeFunction function)
bool CheckAndHandleError(Dart_Handle handle)
Definition: dart_error.cc:33

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