Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
5156f92d
E
engine
项目概览
liujiuri
/
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,发现更多精彩内容 >>
未验证
提交
5156f92d
编写于
4月 06, 2018
作者:
Z
Zachary Anderson
提交者:
GitHub
4月 06, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[fuchsia] Add dummy setAssetBundle service extension (#4945)
上级
d42b5b73
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
81 addition
and
0 deletion
+81
-0
content_handler/service_protocol_hooks.cc
content_handler/service_protocol_hooks.cc
+73
-0
content_handler/service_protocol_hooks.h
content_handler/service_protocol_hooks.h
+8
-0
未找到文件。
content_handler/service_protocol_hooks.cc
浏览文件 @
5156f92d
...
@@ -17,6 +17,32 @@ namespace flutter_runner {
...
@@ -17,6 +17,32 @@ namespace flutter_runner {
namespace
{
namespace
{
constexpr
char
kViewIdPrefx
[]
=
"_flutterView/"
;
constexpr
char
kViewIdPrefx
[]
=
"_flutterView/"
;
constexpr
size_t
kViewIdPrefxLength
=
sizeof
(
kViewIdPrefx
)
-
1
;
static
intptr_t
KeyIndex
(
const
char
**
param_keys
,
intptr_t
num_params
,
const
char
*
key
)
{
if
(
param_keys
==
NULL
)
{
return
-
1
;
}
for
(
intptr_t
i
=
0
;
i
<
num_params
;
i
++
)
{
if
(
strcmp
(
param_keys
[
i
],
key
)
==
0
)
{
return
i
;
}
}
return
-
1
;
}
static
const
char
*
ValueForKey
(
const
char
**
param_keys
,
const
char
**
param_values
,
intptr_t
num_params
,
const
char
*
key
)
{
intptr_t
index
=
KeyIndex
(
param_keys
,
num_params
,
key
);
if
(
index
<
0
)
{
return
NULL
;
}
return
param_values
[
index
];
}
static
void
AppendIsolateRef
(
std
::
stringstream
*
stream
,
static
void
AppendIsolateRef
(
std
::
stringstream
*
stream
,
int64_t
main_port
,
int64_t
main_port
,
...
@@ -47,6 +73,9 @@ void ServiceProtocolHooks::RegisterHooks(bool running_precompiled_code) {
...
@@ -47,6 +73,9 @@ void ServiceProtocolHooks::RegisterHooks(bool running_precompiled_code) {
// Listing of FlutterViews.
// Listing of FlutterViews.
Dart_RegisterRootServiceRequestCallback
(
kListViewsExtensionName
,
&
ListViews
,
Dart_RegisterRootServiceRequestCallback
(
kListViewsExtensionName
,
&
ListViews
,
nullptr
);
nullptr
);
Dart_RegisterRootServiceRequestCallback
(
kSetAssetBundlePathExtensionName
,
&
SetAssetBundlePath
,
nullptr
);
}
}
const
char
*
ServiceProtocolHooks
::
kListViewsExtensionName
=
const
char
*
ServiceProtocolHooks
::
kListViewsExtensionName
=
...
@@ -88,4 +117,48 @@ bool ServiceProtocolHooks::ListViews(const char* method,
...
@@ -88,4 +117,48 @@ bool ServiceProtocolHooks::ListViews(const char* method,
return
true
;
return
true
;
}
}
const
char
*
ServiceProtocolHooks
::
kSetAssetBundlePathExtensionName
=
"_flutter.setAssetBundlePath"
;
bool
ServiceProtocolHooks
::
SetAssetBundlePath
(
const
char
*
method
,
const
char
**
param_keys
,
const
char
**
param_values
,
intptr_t
num_params
,
void
*
user_data
,
const
char
**
json_object
)
{
const
char
*
view_id_str
=
ValueForKey
(
param_keys
,
param_values
,
num_params
,
"viewId"
);
// Ask the App for the list of platform views. This will run a task on
// the UI thread before returning.
App
&
app
=
App
::
Shared
();
std
::
vector
<
App
::
PlatformViewInfo
>
platform_views
;
app
.
WaitForPlatformViewIds
(
&
platform_views
);
// Convert the actual flutter view hex id into a number.
uintptr_t
view_id_as_num
=
std
::
stoull
((
view_id_str
+
kViewIdPrefxLength
),
nullptr
,
16
);
// The view existed and the isolate was created. Success.
std
::
stringstream
response
;
response
<<
"{
\"
type
\"
:
\"
Success
\"
,"
<<
"
\"
view
\"
:"
;
for
(
auto
it
=
platform_views
.
begin
();
it
!=
platform_views
.
end
();
it
++
)
{
uintptr_t
view_id
=
it
->
view_id
;
int64_t
isolate_id
=
it
->
isolate_id
;
const
std
::
string
&
isolate_name
=
it
->
isolate_name
;
if
(
!
view_id
||
view_id
!=
view_id_as_num
)
{
continue
;
}
// TODO(DX): Set up asset bundle path for the isolate.
AppendFlutterView
(
&
response
,
view_id
,
isolate_id
,
isolate_name
);
break
;
}
response
<<
"}"
;
*
json_object
=
strdup
(
response
.
str
().
c_str
());
return
true
;
}
}
// namespace flutter_runner
}
// namespace flutter_runner
content_handler/service_protocol_hooks.h
浏览文件 @
5156f92d
...
@@ -22,6 +22,14 @@ class ServiceProtocolHooks {
...
@@ -22,6 +22,14 @@ class ServiceProtocolHooks {
intptr_t
num_params
,
intptr_t
num_params
,
void
*
user_data
,
void
*
user_data
,
const
char
**
json_object
);
const
char
**
json_object
);
static
const
char
*
kSetAssetBundlePathExtensionName
;
static
bool
SetAssetBundlePath
(
const
char
*
method
,
const
char
**
param_keys
,
const
char
**
param_values
,
intptr_t
num_params
,
void
*
user_data
,
const
char
**
json_object
);
};
};
}
// namespace flutter_runner
}
// namespace flutter_runner
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录