提交 a59456d6 编写于 作者: C Chinmay Garde

Initialize the global dart library natives separately and outside the isolate create callback

上级 90ef9fa3
......@@ -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*>(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册