mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Initialize the global dart library natives separately and outside the isolate create callback
This commit is contained in:
parent
90ef9fa39c
commit
a59456d63c
@ -42,7 +42,7 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void DartUI::InitForIsolate() {
|
||||
void DartUI::InitForGlobal() {
|
||||
if (!g_natives) {
|
||||
g_natives = new DartLibraryNatives();
|
||||
Canvas::RegisterNatives(g_natives);
|
||||
@ -64,7 +64,10 @@ void DartUI::InitForIsolate() {
|
||||
SceneBuilder::RegisterNatives(g_natives);
|
||||
Window::RegisterNatives(g_natives);
|
||||
}
|
||||
}
|
||||
|
||||
void DartUI::InitForIsolate() {
|
||||
DCHECK(g_natives);
|
||||
DART_CHECK_VALID(Dart_SetNativeResolver(
|
||||
Dart_LookupLibrary(ToDart("dart:ui")), GetNativeFunction, GetSymbol));
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ namespace blink {
|
||||
|
||||
class DartUI {
|
||||
public:
|
||||
static void InitForGlobal();
|
||||
static void InitForIsolate();
|
||||
|
||||
private:
|
||||
|
||||
@ -290,6 +290,8 @@ void InitDartVM() {
|
||||
DartDebugger::InitDebugger();
|
||||
}
|
||||
|
||||
DartUI::InitForGlobal();
|
||||
|
||||
{
|
||||
TRACE_EVENT0("flutter", "Dart_Initialize");
|
||||
CHECK(Dart_Initialize(reinterpret_cast<uint8_t*>(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user