Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
2970c099
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2970c099
编写于
4月 23, 2018
作者:
J
Jason Simmons
提交者:
GitHub
4月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use the default microtask scheduler on all isolates except the UI isolate (#5068)
See
https://github.com/flutter/flutter/issues/16846
上级
96af3b29
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
12 addition
and
22 deletion
+12
-22
lib/ui/dart_runtime_hooks.cc
lib/ui/dart_runtime_hooks.cc
+7
-10
lib/ui/dart_runtime_hooks.h
lib/ui/dart_runtime_hooks.h
+1
-6
runtime/dart_isolate.cc
runtime/dart_isolate.cc
+3
-5
runtime/dart_isolate.h
runtime/dart_isolate.h
+1
-1
未找到文件。
lib/ui/dart_runtime_hooks.cc
浏览文件 @
2970c099
...
@@ -62,8 +62,7 @@ static Dart_Handle GetClosure(Dart_Handle builtin_library, const char* name) {
...
@@ -62,8 +62,7 @@ static Dart_Handle GetClosure(Dart_Handle builtin_library, const char* name) {
return
closure
;
return
closure
;
}
}
static
void
InitDartInternal
(
Dart_Handle
builtin_library
,
static
void
InitDartInternal
(
Dart_Handle
builtin_library
,
bool
is_ui_isolate
)
{
DartRuntimeHooks
::
IsolateType
isolate_type
)
{
Dart_Handle
print
=
GetClosure
(
builtin_library
,
"_getPrintClosure"
);
Dart_Handle
print
=
GetClosure
(
builtin_library
,
"_getPrintClosure"
);
Dart_Handle
internal_library
=
Dart_LookupLibrary
(
ToDart
(
"dart:_internal"
));
Dart_Handle
internal_library
=
Dart_LookupLibrary
(
ToDart
(
"dart:_internal"
));
...
@@ -71,7 +70,7 @@ static void InitDartInternal(Dart_Handle builtin_library,
...
@@ -71,7 +70,7 @@ static void InitDartInternal(Dart_Handle builtin_library,
DART_CHECK_VALID
(
DART_CHECK_VALID
(
Dart_SetField
(
internal_library
,
ToDart
(
"_printClosure"
),
print
));
Dart_SetField
(
internal_library
,
ToDart
(
"_printClosure"
),
print
));
if
(
is
olate_type
==
DartRuntimeHooks
::
MainI
solate
)
{
if
(
is
_ui_i
solate
)
{
// Call |_setupHooks| to configure |VMLibraryHooks|.
// Call |_setupHooks| to configure |VMLibraryHooks|.
Dart_Handle
method_name
=
Dart_NewStringFromCString
(
"_setupHooks"
);
Dart_Handle
method_name
=
Dart_NewStringFromCString
(
"_setupHooks"
);
DART_CHECK_VALID
(
Dart_Invoke
(
builtin_library
,
method_name
,
0
,
NULL
))
DART_CHECK_VALID
(
Dart_Invoke
(
builtin_library
,
method_name
,
0
,
NULL
))
...
@@ -97,14 +96,12 @@ static void InitDartCore(Dart_Handle builtin, const std::string& script_uri) {
...
@@ -97,14 +96,12 @@ static void InitDartCore(Dart_Handle builtin, const std::string& script_uri) {
Dart_SetField
(
core_library
,
ToDart
(
"_uriBaseClosure"
),
get_base_url
));
Dart_SetField
(
core_library
,
ToDart
(
"_uriBaseClosure"
),
get_base_url
));
}
}
static
void
InitDartAsync
(
Dart_Handle
builtin_library
,
static
void
InitDartAsync
(
Dart_Handle
builtin_library
,
bool
is_ui_isolate
)
{
DartRuntimeHooks
::
IsolateType
isolate_type
)
{
Dart_Handle
schedule_microtask
;
Dart_Handle
schedule_microtask
;
if
(
is
olate_type
==
DartRuntimeHooks
::
MainI
solate
)
{
if
(
is
_ui_i
solate
)
{
schedule_microtask
=
schedule_microtask
=
GetClosure
(
builtin_library
,
"_getScheduleMicrotaskClosure"
);
GetClosure
(
builtin_library
,
"_getScheduleMicrotaskClosure"
);
}
else
{
}
else
{
FXL_CHECK
(
isolate_type
==
DartRuntimeHooks
::
SecondaryIsolate
);
Dart_Handle
isolate_lib
=
Dart_LookupLibrary
(
ToDart
(
"dart:isolate"
));
Dart_Handle
isolate_lib
=
Dart_LookupLibrary
(
ToDart
(
"dart:isolate"
));
Dart_Handle
method_name
=
Dart_Handle
method_name
=
Dart_NewStringFromCString
(
"_getIsolateScheduleImmediateClosure"
);
Dart_NewStringFromCString
(
"_getIsolateScheduleImmediateClosure"
);
...
@@ -132,13 +129,13 @@ static void InitDartIO(Dart_Handle builtin_library,
...
@@ -132,13 +129,13 @@ static void InitDartIO(Dart_Handle builtin_library,
Dart_SetField
(
platform_type
,
ToDart
(
"_localeClosure"
),
locale_closure
));
Dart_SetField
(
platform_type
,
ToDart
(
"_localeClosure"
),
locale_closure
));
}
}
void
DartRuntimeHooks
::
Install
(
IsolateType
isolate_typ
e
,
void
DartRuntimeHooks
::
Install
(
bool
is_ui_isolat
e
,
const
std
::
string
&
script_uri
)
{
const
std
::
string
&
script_uri
)
{
Dart_Handle
builtin
=
Dart_LookupLibrary
(
ToDart
(
"dart:ui"
));
Dart_Handle
builtin
=
Dart_LookupLibrary
(
ToDart
(
"dart:ui"
));
DART_CHECK_VALID
(
builtin
);
DART_CHECK_VALID
(
builtin
);
InitDartInternal
(
builtin
,
is
olate_typ
e
);
InitDartInternal
(
builtin
,
is
_ui_isolat
e
);
InitDartCore
(
builtin
,
script_uri
);
InitDartCore
(
builtin
,
script_uri
);
InitDartAsync
(
builtin
,
is
olate_typ
e
);
InitDartAsync
(
builtin
,
is
_ui_isolat
e
);
InitDartIO
(
builtin
,
script_uri
);
InitDartIO
(
builtin
,
script_uri
);
}
}
...
...
lib/ui/dart_runtime_hooks.h
浏览文件 @
2970c099
...
@@ -13,12 +13,7 @@ namespace blink {
...
@@ -13,12 +13,7 @@ namespace blink {
class
DartRuntimeHooks
{
class
DartRuntimeHooks
{
public:
public:
enum
IsolateType
{
static
void
Install
(
bool
is_ui_isolate
,
const
std
::
string
&
script_uri
);
MainIsolate
,
SecondaryIsolate
,
};
static
void
Install
(
IsolateType
isolate_type
,
const
std
::
string
&
script_uri
);
static
void
RegisterNatives
(
tonic
::
DartLibraryNatives
*
natives
);
static
void
RegisterNatives
(
tonic
::
DartLibraryNatives
*
natives
);
private:
private:
...
...
runtime/dart_isolate.cc
浏览文件 @
2970c099
...
@@ -220,7 +220,7 @@ bool DartIsolate::UpdateThreadPoolNames() const {
...
@@ -220,7 +220,7 @@ bool DartIsolate::UpdateThreadPoolNames() const {
return
true
;
return
true
;
}
}
bool
DartIsolate
::
LoadLibraries
()
{
bool
DartIsolate
::
LoadLibraries
(
bool
is_root_isolate
)
{
TRACE_EVENT0
(
"flutter"
,
"DartIsolate::LoadLibraries"
);
TRACE_EVENT0
(
"flutter"
,
"DartIsolate::LoadLibraries"
);
if
(
phase_
!=
Phase
::
Initialized
)
{
if
(
phase_
!=
Phase
::
Initialized
)
{
return
false
;
return
false
;
...
@@ -234,9 +234,7 @@ bool DartIsolate::LoadLibraries() {
...
@@ -234,9 +234,7 @@ bool DartIsolate::LoadLibraries() {
const
bool
is_service_isolate
=
Dart_IsServiceIsolate
(
isolate
());
const
bool
is_service_isolate
=
Dart_IsServiceIsolate
(
isolate
());
DartRuntimeHooks
::
Install
(
is_service_isolate
DartRuntimeHooks
::
Install
(
is_root_isolate
&&
!
is_service_isolate
,
?
DartRuntimeHooks
::
SecondaryIsolate
:
DartRuntimeHooks
::
MainIsolate
,
GetAdvisoryScriptURI
());
GetAdvisoryScriptURI
());
if
(
!
is_service_isolate
)
{
if
(
!
is_service_isolate
)
{
...
@@ -675,7 +673,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
...
@@ -675,7 +673,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
return
{
nullptr
,
{}};
return
{
nullptr
,
{}};
}
}
if
(
!
embedder_isolate
->
LoadLibraries
())
{
if
(
!
embedder_isolate
->
LoadLibraries
(
is_root_isolate
))
{
*
error
=
*
error
=
strdup
(
"Embedder could not load libraries in the new Dart isolate."
);
strdup
(
"Embedder could not load libraries in the new Dart isolate."
);
FXL_DLOG
(
ERROR
)
<<
*
error
;
FXL_DLOG
(
ERROR
)
<<
*
error
;
...
...
runtime/dart_isolate.h
浏览文件 @
2970c099
...
@@ -114,7 +114,7 @@ class DartIsolate : public UIDartState {
...
@@ -114,7 +114,7 @@ class DartIsolate : public UIDartState {
bool
Initialize
(
Dart_Isolate
isolate
,
bool
is_root_isolate
);
bool
Initialize
(
Dart_Isolate
isolate
,
bool
is_root_isolate
);
FXL_WARN_UNUSED_RESULT
FXL_WARN_UNUSED_RESULT
bool
LoadLibraries
();
bool
LoadLibraries
(
bool
is_root_isolate
);
bool
UpdateThreadPoolNames
()
const
;
bool
UpdateThreadPoolNames
()
const
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录