Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
fuchsia.cc File Reference

Go to the source code of this file.

Namespaces

namespace  fuchsia
 
namespace  fuchsia::dart
 

Macros

#define REGISTER_FUNCTION(name, count)   {"" #name, name, count},
 
#define DECLARE_FUNCTION(name, count)    extern void name(Dart_NativeArguments args);
 
#define FIDL_NATIVE_LIST(V)   V(SetReturnCode, 1)
 

Functions

void fuchsia::dart::Initialize (zx::channel directory_request, std::optional< zx::eventpair > view_ref)
 Initializes Dart bindings for the Fuchsia application model.
 

Macro Definition Documentation

◆ DECLARE_FUNCTION

#define DECLARE_FUNCTION (   name,
  count 
)     extern void name(Dart_NativeArguments args);

Definition at line 42 of file fuchsia.cc.

48 {
49 const char* name;
50 Dart_NativeFunction function;
53
56 bool* auto_setup_scope) {
57 const char* function_name = nullptr;
59 if (Dart_IsError(result)) {
60 Dart_PropagateError(result);
61 }
62 FML_DCHECK(function_name != nullptr);
63 FML_DCHECK(auto_setup_scope != nullptr);
64 *auto_setup_scope = true;
65 size_t num_entries = std::size(Entries);
66 for (size_t i = 0; i < num_entries; ++i) {
67 const struct NativeEntries& entry = Entries[i];
68 if (!strcmp(function_name, entry.name) &&
69 (entry.argument_count == argument_count)) {
70 return entry.function;
71 }
72 }
73 if (!g_natives)
75 return g_natives->GetNativeFunction(name, argument_count, auto_setup_scope);
76}
77
78const uint8_t* NativeSymbol(Dart_NativeFunction native_function) {
79 size_t num_entries = std::size(Entries);
80 for (size_t i = 0; i < num_entries; ++i) {
81 const struct NativeEntries& entry = Entries[i];
82 if (entry.function == native_function) {
83 return reinterpret_cast<const uint8_t*>(entry.name);
84 }
85 }
86 if (!g_natives)
88 return g_natives->GetSymbol(native_function);
89}
90
91void SetReturnCode(Dart_NativeArguments arguments) {
93 Dart_Handle status =
95 if (!tonic::CheckAndHandleError(status)) {
97 }
98}
99
100} // namespace
101
102void Initialize(zx::channel directory_request,
103 std::optional<zx::eventpair> view_ref) {
105
106 Dart_Handle library = Dart_LookupLibrary(ToDart("dart:fuchsia"));
109 library, fuchsia::dart::NativeLookup, fuchsia::dart::NativeSymbol);
111
112 auto dart_state = tonic::DartState::Current();
113 std::unique_ptr<tonic::DartClassProvider> fuchsia_class_provider(
114 new tonic::DartClassProvider(dart_state, "dart:fuchsia"));
115 dart_state->class_library().add_provider("fuchsia",
116 std::move(fuchsia_class_provider));
117
118 if (directory_request) {
119 result = Dart_SetField(
120 library, ToDart("_outgoingServices"),
123 }
124
125 if (view_ref) {
126 result = Dart_SetField(
127 library, ToDart("_viewRef"),
128 ToDart(zircon::dart::Handle::Create((*view_ref).release())));
130 }
131}
132
133} // namespace dart
134} // namespace fuchsia
void SetReturnCode(uint32_t return_code)
Definition dart_state.cc:66
static DartState * Current()
Definition dart_state.cc:56
static fml::RefPtr< Handle > Create(zx_handle_t handle)
Definition handle.cc:28
#define FML_CHECK(condition)
Definition logging.h:104
#define FML_DCHECK(condition)
Definition logging.h:122
Dart_NativeFunction function
Definition fuchsia.cc:51
const char * name
Definition fuchsia.cc:50
#define FIDL_NATIVE_LIST(V)
Definition fuchsia.cc:45
#define REGISTER_FUNCTION(name, count)
Definition fuchsia.cc:41
int argument_count
Definition fuchsia.cc:52
void Initialize(zx::channel directory_request, std::optional< zx::eventpair > view_ref)
Initializes Dart bindings for the Fuchsia application model.
Definition fuchsia.cc:103
Dart_Handle ToDart(const T &object)
bool CheckAndHandleError(Dart_Handle handle)
Definition dart_error.cc:33
void Initialize()
Definition natives.cc:68

◆ FIDL_NATIVE_LIST

#define FIDL_NATIVE_LIST (   V)    V(SetReturnCode, 1)

Definition at line 45 of file fuchsia.cc.

◆ REGISTER_FUNCTION

#define REGISTER_FUNCTION (   name,
  count 
)    {"" #name, name, count},

Definition at line 41 of file fuchsia.cc.

Variable Documentation

◆ argument_count

int argument_count

Definition at line 52 of file fuchsia.cc.

Referenced by tonic::DartLibraryNatives::GetNativeFunction().

◆ function

◆ name

const char* name

Definition at line 50 of file fuchsia.cc.

Referenced by ui::AXPlatformNodeBase::AddAttributeToList(), ui::AXPlatformNodeBase::AddAttributeToList(), ui::AXPlatformNodeBase::AddAttributeToList(), ui::AXPlatformNodeBase::AddAttributeToList(), flutter::testing::FlutterEngineTest::AddNativeCallback(), impeller::ShaderArchiveWriter::AddShader(), checkProperty(), ui::AXPlatformNodeWinTest::CheckVariantHasName(), create_settings(), FLUTTER_ASSERT_ARC::CreateNewThread(), impeller::egl::CreateProcAddressResolver(), dart_utils::RootInspectNode::CreateRootChild(), tonic::DartInvokeField(), decode_error_method_call(), decode_error_method_call(), decode_method_call(), decode_method_call(), impeller::ContextMTL::DescribeGpuModel(), encode_method_call(), encode_method_call(), EngineProcResolver(), impeller::compiler::testing::FindByName(), fl_accessible_node_set_name(), fl_accessible_node_set_name_impl(), fl_basic_message_channel_new(), fl_engine_gl_proc_resolver(), fl_event_channel_new(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_encode_method_call(), fl_method_call_new(), fl_method_channel_new(), fl_method_codec_decode_method_call(), fl_method_codec_encode_method_call(), fl_mock_binary_messenger_invoke_json_method(), fl_mock_binary_messenger_invoke_method(), fl_mock_binary_messenger_invoke_standard_method(), fl_mock_binary_messenger_send_on_channel(), fl_plugin_registry_get_registrar_for_plugin(), fl_standard_method_codec_decode_method_call(), fl_standard_method_codec_encode_method_call(), fl_test_codec_decode_method_call(), fl_test_codec_encode_method_call(), fl_test_texture_populate(), fl_texture_gl_populate(), FlutterEngineInitialize(), FlutterEngineTraceEventDurationBegin(), FlutterEngineTraceEventDurationEnd(), FlutterEngineTraceEventInstant(), flutter_runner::GetCurrentProcessName(), impeller::CapabilitiesVK::GetEnabledDeviceExtensions(), impeller::GetGLString(), impeller::GetGLStringi(), impeller::ShaderArchive::GetMapping(), ui::AXPlatformNodeBase::GetNameAsString16(), tonic::DartLibraryNatives::GetNativeFunction(), fml::CommandLine::GetOptionValue(), fml::CommandLine::GetOptionValues(), fml::CommandLine::GetOptionValueWithDefault(), fml::GetSymbolName(), impeller::RuntimeStage::GetUniform(), impeller::GLESShaderNameToShaderKeyName(), handle_method_call(), HasExtension(), fml::CommandLine::HasOption(), impeller::AiksPlayground::ImGuiBegin(), impeller::IsExtensionInList(), flutter::LogLastEGLError(), impeller::LogShaderCompilationFailure(), message_cb(), flutter::FlutterWindowsEngine::OnChannelUpdate(), std::operator<<(), Catalog::ParseEntry(), impeller::ResourceIsLive(), flutter::FlutterWindowsEngine::Run(), RunFlutter(), flutter_runner::Runner::Runner(), impeller::ProcTableGLES::SetDebugLabel(), flutter_runner::SetInterfaceErrorHandler(), flutter_runner::SetInterfaceErrorHandler(), SetMessageHandler(), ui::AXNodeData::SetName(), ui::AXNodeData::SetName(), impeller::CapabilitiesVK::SetPhysicalDevice(), flutter_runner::SetProcessName(), fml::SetThreadName(), impeller::interop::testing::SetupImpellerHPPProcTableOnce(), impeller::compiler::SourceTypeFromString(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), flutter_runner_test::TEST_F(), ui::TEST_F(), ui::TEST_F(), ui::TEST_F(), ui::TEST_F(), ui::TEST_F(), ui::TEST_F(), test_method_codec_decode_method_call(), test_method_codec_encode_method_call(), fml::tracing::TraceCounter(), fml::tracing::TraceEvent(), fml::tracing::TraceEventAsyncComplete(), and impeller::VKShaderNameToShaderKeyName().