Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
da488fe3
E
engine
项目概览
weixin_43355755
/
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,体验更适合开发者的 AI 搜索 >>
提交
da488fe3
编写于
9月 21, 2016
作者:
J
John McCutchan
提交者:
GitHub
9月 21, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix isolate spawn when running from source (#3041)
上级
3551e7a4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
6 deletion
+46
-6
DEPS
DEPS
+1
-1
runtime/dart_init.cc
runtime/dart_init.cc
+45
-5
未找到文件。
DEPS
浏览文件 @
da488fe3
...
...
@@ -57,7 +57,7 @@ deps = {
Var('fuchsia_git') + '/ftl' + '@' + '0bb3a02301c8a88b494e58c6636fa509525adaa8',
'src/lib/tonic':
Var('fuchsia_git') + '/tonic' + '@' + '
c20972bdaee4c0ad19b062cea8d945b1b22c8c6b
',
Var('fuchsia_git') + '/tonic' + '@' + '
5ca4053563027007ef2e7b2892efe63c26d30259
',
'src/lib/zip':
Var('fuchsia_git') + '/zip' + '@' + '92dc87ca645fe8e9f5151ef6dac86d8311a7222f',
...
...
runtime/dart_init.cc
浏览文件 @
da488fe3
...
...
@@ -36,10 +36,13 @@
#include "lib/ftl/files/unique_fd.h"
#include "lib/ftl/logging.h"
#include "lib/ftl/time/time_delta.h"
#include "lib/tonic/converter/dart_converter.h"
#include "lib/tonic/dart_class_library.h"
#include "lib/tonic/dart_state.h"
#include "lib/tonic/dart_sticky_error.h"
#include "lib/tonic/dart_wrappable.h"
#include "lib/tonic/debugger/dart_debugger.h"
#include "lib/tonic/file_loader/file_loader.h"
#include "lib/tonic/logging/dart_error.h"
#include "lib/tonic/logging/dart_invoke.h"
#include "lib/tonic/scopes/dart_api_scope.h"
...
...
@@ -131,6 +134,14 @@ RegisterNativeServiceProtocolExtensionHook
g_register_native_service_protocol_extensions_hook
=
nullptr
;
void
IsolateShutdownCallback
(
void
*
callback_data
)
{
if
(
tonic
::
DartStickyError
::
IsSet
())
{
tonic
::
DartApiScope
api_scope
;
FTL_LOG
(
ERROR
)
<<
"Isolate "
<<
tonic
::
StdStringFromDart
(
Dart_DebugName
())
<<
" exited with an error"
;
Dart_Handle
sticky_error
=
Dart_GetStickyError
();
FTL_CHECK
(
LogIfError
(
sticky_error
));
}
tonic
::
DartState
*
dart_state
=
static_cast
<
tonic
::
DartState
*>
(
callback_data
);
delete
dart_state
;
}
...
...
@@ -175,6 +186,16 @@ bool IsServiceIsolateURL(const char* url_name) {
std
::
string
(
url_name
)
==
DART_VM_SERVICE_ISOLATE_NAME
;
}
static
bool
StringEndsWith
(
const
std
::
string
&
string
,
const
std
::
string
&
ending
)
{
if
(
ending
.
size
()
>
string
.
size
())
return
false
;
return
string
.
compare
(
string
.
size
()
-
ending
.
size
(),
ending
.
size
(),
ending
)
==
0
;
}
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE
Dart_Isolate
ServiceIsolateCreateCallback
(
const
char
*
script_uri
,
...
...
@@ -242,16 +263,23 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri,
return
ServiceIsolateCreateCallback
(
script_uri
,
error
);
}
// Assert that entry script URI starts with file://
std
::
string
entry_uri
=
script_uri
;
FTL_CHECK
(
entry_uri
.
find
(
kFileUriPrefix
)
==
0u
);
// Entry script path (file:// is stripped).
std
::
string
entry_path
(
script_uri
+
strlen
(
kFileUriPrefix
));
// Are we running a .dart source file?
const
bool
running_from_source
=
StringEndsWith
(
entry_path
,
".dart"
);
std
::
vector
<
uint8_t
>
snapshot_data
;
if
(
!
IsRunningPrecompiledCode
())
{
std
::
string
uri
=
script_uri
;
FTL_CHECK
(
uri
.
find
(
kFileUriPrefix
)
==
0u
);
std
::
string
bundle_path
(
script_uri
+
strlen
(
kFileUriPrefix
));
if
(
!
IsRunningPrecompiledCode
()
&&
!
running_from_source
)
{
// Attempt to copy the snapshot from the asset bundle.
const
std
::
string
&
bundle_path
=
entry_path
;
ftl
::
RefPtr
<
ZipAssetStore
>
zip_asset_store
=
ftl
::
MakeRefCounted
<
ZipAssetStore
>
(
GetUnzipperProviderForPath
(
std
::
move
(
bundle_path
)),
ftl
::
RefPtr
<
ftl
::
TaskRunner
>
());
FTL_CHECK
(
zip_asset_store
->
GetAsBuffer
(
kSnapshotAssetKey
,
&
snapshot_data
)
);
zip_asset_store
->
GetAsBuffer
(
kSnapshotAssetKey
,
&
snapshot_data
);
}
UIDartState
*
parent_dart_state
=
static_cast
<
UIDartState
*>
(
callback_data
);
...
...
@@ -287,8 +315,20 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri,
#endif
if
(
!
snapshot_data
.
empty
())
{
// We are running from a script snapshot.
FTL_CHECK
(
!
LogIfError
(
Dart_LoadScriptFromSnapshot
(
snapshot_data
.
data
(),
snapshot_data
.
size
())));
}
else
{
// Forward the .packages configuration from the parent isolate to the
// child isolate.
tonic
::
FileLoader
&
parent_loader
=
parent_dart_state
->
file_loader
();
const
std
::
string
&
packages
=
parent_loader
.
packages
();
tonic
::
FileLoader
&
loader
=
dart_state
->
file_loader
();
if
(
!
packages
.
empty
()
&&
!
loader
.
LoadPackagesMap
(
packages
))
{
FTL_LOG
(
WARNING
)
<<
"Failed to load package map: "
<<
packages
;
}
// We are running from source.
FTL_CHECK
(
!
LogIfError
(
loader
.
LoadScript
(
entry_path
)));
}
dart_state
->
isolate_client
()
->
DidCreateSecondaryIsolate
(
isolate
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录