6#if defined(_WIN32) && defined(SK_USING_THIRD_PARTY_ICU)
8#ifndef WIN32_LEAN_AND_MEAN
9#define WIN32_LEAN_AND_MEAN
19#include "unicode/udata.h"
21static void* win_mmap(
const wchar_t* dataFile) {
25 struct FCloseWrapper {
void operator()(FILE*
f) { fclose(
f); } };
26 std::unique_ptr<FILE, FCloseWrapper>
stream(_wfopen(dataFile,
L"rb"));
28 fprintf(stderr,
"SkIcuLoader: datafile missing: %ls.\n", dataFile);
31 int fileno = _fileno(
stream.get());
33 fprintf(stderr,
"SkIcuLoader: datafile fileno error.\n");
38 fprintf(stderr,
"SkIcuLoader: datafile handle error.\n");
41 struct CloseHandleWrapper {
void operator()(
HANDLE h) { CloseHandle(
h); } };
42 std::unique_ptr<void, CloseHandleWrapper> mmapHandle(
43 CreateFileMapping(
file,
nullptr, PAGE_READONLY, 0, 0,
nullptr));
45 fprintf(stderr,
"SkIcuLoader: datafile mmap error.\n");
48 void*
addr = MapViewOfFile(mmapHandle.get(), FILE_MAP_READ, 0, 0, 0);
49 if (
nullptr ==
addr) {
50 fprintf(stderr,
"SkIcuLoader: datafile view error.\n");
56static bool init_icu(
void*
addr) {
57 UErrorCode err = U_ZERO_ERROR;
58 udata_setCommonData(
addr, &err);
59 if (err != U_ZERO_ERROR) {
60 fprintf(stderr,
"udata_setCommonData() returned %d.\n", (
int)err);
63 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
64 if (err != U_ZERO_ERROR) {
65 fprintf(stderr,
"udata_setFileAccess() returned %d.\n", (
int)err);
71static std::wstring get_module_path(
HMODULE module) {
82 std::size_t
end =
path.rfind(
'\\');
83 if (
end == std::wstring::npos) {
84 return std::wstring();
90static std::wstring library_directory() {
92 GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
93 reinterpret_cast<LPCSTR
>(&library_directory), &hModule);
94 return get_module_path(hModule);
97static std::wstring executable_directory() {
98 HMODULE hModule = GetModuleHandleA(NULL);
99 return get_module_path(hModule);
102static bool load_from(
const std::wstring&
dir) {
103 auto sPath =
dir +
L"\\icudtl.dat";
104 if (
void*
addr = win_mmap(sPath.c_str())) {
105 if (init_icu(
addr)) {
113 static bool good =
false;
114 static std::once_flag
flag;
115 std::call_once(
flag, []() {
116 good = load_from(executable_directory()) || load_from(library_directory());
FlutterSemanticsFlag flag
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
#define INVALID_HANDLE_VALUE