Flutter Engine
flutter::DartIO Class Reference

#include <dart_io.h>

Static Public Member Functions

static void InitForIsolate (bool may_insecurely_connect_to_all_domains, std::string domain_network_policy)
 

Detailed Description

Definition at line 15 of file dart_io.h.

Member Function Documentation

◆ InitForIsolate()

void flutter::DartIO::InitForIsolate ( bool  may_insecurely_connect_to_all_domains,
std::string  domain_network_policy 
)
static

Definition at line 18 of file dart_io.cc.

References FML_CHECK, tonic::LogIfError(), and tonic::ToDart().

Referenced by flutter::DartIsolate::GetMessageHandlingTaskRunner().

19  {
20  Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io"));
21  Dart_Handle result = Dart_SetNativeResolver(io_lib, dart::bin::LookupIONative,
22  dart::bin::LookupIONativeSymbol);
23  FML_CHECK(!LogIfError(result));
24 
25  Dart_Handle embedder_config_type =
26  Dart_GetNonNullableType(io_lib, ToDart("_EmbedderConfig"), 0, nullptr);
27  FML_CHECK(!LogIfError(embedder_config_type));
28 
29  Dart_Handle allow_insecure_connections_result = Dart_SetField(
30  embedder_config_type, ToDart("_mayInsecurelyConnectToAllDomains"),
31  ToDart(may_insecurely_connect_to_all_domains));
32  FML_CHECK(!LogIfError(allow_insecure_connections_result));
33 
34  Dart_Handle dart_args[1];
35  dart_args[0] = ToDart(domain_network_policy);
36  Dart_Handle set_domain_network_policy_result = Dart_Invoke(
37  embedder_config_type, ToDart("_setDomainPolicies"), 1, dart_args);
38  FML_CHECK(!LogIfError(set_domain_network_policy_result));
39 }
#define FML_CHECK(condition)
Definition: logging.h:68
Dart_Handle ToDart(const T &object)
bool LogIfError(Dart_Handle handle)
Definition: dart_error.cc:15

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