Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
1c59ddef
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
1c59ddef
编写于
8月 16, 2016
作者:
J
John McCutchan
提交者:
GitHub
8月 16, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Send richer service protocol respones from the Shell (#2929)
上级
d535a15a
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
68 addition
and
14 deletion
+68
-14
lib/ui/ui_dart_state.cc
lib/ui/ui_dart_state.cc
+5
-0
lib/ui/ui_dart_state.h
lib/ui/ui_dart_state.h
+2
-1
runtime/runtime_controller.cc
runtime/runtime_controller.cc
+11
-0
runtime/runtime_controller.h
runtime/runtime_controller.h
+2
-0
sky/shell/platform_view_service_protocol.cc
sky/shell/platform_view_service_protocol.cc
+28
-9
sky/shell/shell.cc
sky/shell/shell.cc
+7
-3
sky/shell/shell.h
sky/shell/shell.h
+4
-1
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+7
-0
sky/shell/ui/engine.h
sky/shell/ui/engine.h
+2
-0
未找到文件。
lib/ui/ui_dart_state.cc
浏览文件 @
1c59ddef
...
...
@@ -47,6 +47,11 @@ UIDartState* UIDartState::CreateForChildIsolate() {
void
UIDartState
::
DidSetIsolate
()
{
main_port_
=
Dart_GetMainPortId
();
DartApiScope
api_scope
;
Dart_Handle
debug_name
=
Dart_DebugName
();
if
(
Dart_IsString
(
debug_name
))
{
debug_name_
=
tonic
::
StdStringFromDart
(
debug_name
);
}
}
UIDartState
*
UIDartState
::
Current
()
{
...
...
lib/ui/ui_dart_state.h
浏览文件 @
1c59ddef
...
...
@@ -39,7 +39,7 @@ class UIDartState : public tonic::DartState {
IsolateClient
*
isolate_client
()
{
return
isolate_client_
;
}
Dart_Port
main_port
()
const
{
return
main_port_
;
}
const
std
::
string
&
debug_name
()
const
{
return
debug_name_
;
}
Window
*
window
()
const
{
return
window_
.
get
();
}
void
set_mojo_services
(
std
::
unique_ptr
<
MojoServices
>
mojo_services
);
...
...
@@ -59,6 +59,7 @@ class UIDartState : public tonic::DartState {
IsolateClient
*
isolate_client_
;
Dart_Port
main_port_
;
std
::
string
debug_name_
;
std
::
unique_ptr
<
MojoServices
>
mojo_services_
;
std
::
unique_ptr
<
Window
>
window_
;
...
...
runtime/runtime_controller.cc
浏览文件 @
1c59ddef
...
...
@@ -113,4 +113,15 @@ Dart_Port RuntimeController::GetMainPort() {
return
dart_controller_
->
dart_state
()
->
main_port
();
}
std
::
string
RuntimeController
::
GetIsolateName
()
{
if
(
!
dart_controller_
)
{
return
""
;
}
if
(
!
dart_controller_
->
dart_state
())
{
return
""
;
}
return
dart_controller_
->
dart_state
()
->
debug_name
();
}
}
// namespace blink
runtime/runtime_controller.h
浏览文件 @
1c59ddef
...
...
@@ -44,6 +44,8 @@ class RuntimeController : public WindowClient, public IsolateClient {
Dart_Port
GetMainPort
();
std
::
string
GetIsolateName
();
private:
explicit
RuntimeController
(
RuntimeDelegate
*
client
);
...
...
sky/shell/platform_view_service_protocol.cc
浏览文件 @
1c59ddef
...
...
@@ -86,6 +86,24 @@ static bool ErrorIsolateSpawn(const char** json_object, const char* view_id) {
return
false
;
}
static
void
AppendIsolateRef
(
std
::
stringstream
*
stream
,
int64_t
main_port
,
const
std
::
string
name
)
{
*
stream
<<
"{
\"
type
\"
:
\"
@Isolate
\"
,
\"
fixedId
\"
:true,
\"
id
\"
:
\"
isolates/"
;
*
stream
<<
main_port
<<
"
\"
,
\"
name
\"
:
\"
"
<<
name
<<
"
\"
,"
;
*
stream
<<
"
\"
number
\"
:
\"
"
<<
main_port
<<
"
\"
}"
;
}
static
void
AppendFlutterView
(
std
::
stringstream
*
stream
,
uintptr_t
view_id
,
int64_t
isolate_id
,
const
std
::
string
isolate_name
)
{
*
stream
<<
"{
\"
type
\"
:
\"
FlutterView
\"
,
\"
id
\"
:
\"
"
<<
kViewIdPrefx
<<
"0x"
<<
std
::
hex
<<
view_id
<<
std
::
dec
<<
"
\"
,"
<<
"
\"
isolate
\"
:"
;
AppendIsolateRef
(
stream
,
isolate_id
,
isolate_name
);
*
stream
<<
"}"
;
}
}
// namespace
void
PlatformViewServiceProtocol
::
RegisterHook
(
bool
running_precompiled_code
)
{
...
...
@@ -140,8 +158,12 @@ bool PlatformViewServiceProtocol::RunInView(const char* method,
Shell
&
shell
=
Shell
::
Shared
();
bool
view_existed
=
false
;
Dart_Port
main_port
=
ILLEGAL_PORT
;
std
::
string
isolate_name
;
shell
.
RunInPlatformView
(
view_id_as_num
,
main_script
,
packages_file
,
asset_directory
,
&
view_existed
,
&
main_port
);
asset_directory
,
&
view_existed
,
&
main_port
,
&
isolate_name
);
if
(
!
view_existed
)
{
// If the view did not exist this request has definitely failed.
...
...
@@ -153,10 +175,9 @@ bool PlatformViewServiceProtocol::RunInView(const char* method,
// The view existed and the isolate was created. Success.
std
::
stringstream
response
;
response
<<
"{
\"
type
\"
:
\"
Success
\"
,"
<<
"
\"
viewId
\"
:
\"
"
<<
kViewIdPrefx
<<
"0x"
<<
std
::
hex
<<
view_id
<<
"
\"
,"
<<
"
\"
isolateId
\"
:
\"
isolates/"
<<
std
::
dec
<<
main_port
<<
"
\"
"
<<
"}"
;
<<
"
\"
view
\"
:"
;
AppendFlutterView
(
&
response
,
view_id_as_num
,
main_port
,
isolate_name
);
response
<<
"}"
;
*
json_object
=
strdup
(
response
.
str
().
c_str
());
return
true
;
}
...
...
@@ -185,6 +206,7 @@ bool PlatformViewServiceProtocol::ListViews(const char* method,
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
)
{
continue
;
}
...
...
@@ -193,10 +215,7 @@ bool PlatformViewServiceProtocol::ListViews(const char* method,
}
else
{
prefix_comma
=
true
;
}
response
<<
"{
\"
type
\"
:
\"
FlutterView
\"
,
\"
id
\"
:
\"
"
<<
kViewIdPrefx
<<
"0x"
<<
std
::
hex
<<
view_id
<<
"
\"
,"
<<
"
\"
isolateId
\"
:
\"
isolates/"
<<
std
::
dec
<<
isolate_id
<<
"
\"
"
<<
"}"
;
AppendFlutterView
(
&
response
,
view_id
,
isolate_id
,
isolate_name
);
}
response
<<
"]}"
;
// Copy the response.
...
...
sky/shell/shell.cc
浏览文件 @
1c59ddef
...
...
@@ -263,6 +263,7 @@ void Shell::WaitForPlatformViewsIdsUIThread(
PlatformViewInfo
info
;
info
.
view_id
=
reinterpret_cast
<
uintptr_t
>
(
view
);
info
.
isolate_id
=
view
->
engine
().
GetUIIsolateMainPort
();
info
.
isolate_name
=
view
->
engine
().
GetUIIsolateName
();
platform_view_ids
->
push_back
(
info
);
}
latch
->
Signal
();
...
...
@@ -273,7 +274,8 @@ void Shell::RunInPlatformView(uintptr_t view_id,
const
char
*
packages_file
,
const
char
*
asset_directory
,
bool
*
view_existed
,
int64_t
*
dart_isolate_id
)
{
int64_t
*
dart_isolate_id
,
std
::
string
*
isolate_name
)
{
ftl
::
AutoResetWaitableEvent
latch
;
FTL_DCHECK
(
view_id
!=
0
);
FTL_DCHECK
(
main_script
);
...
...
@@ -283,10 +285,10 @@ void Shell::RunInPlatformView(uintptr_t view_id,
blink
::
Threads
::
UI
()
->
PostTask
([
this
,
view_id
,
main_script
,
packages_file
,
asset_directory
,
view_existed
,
dart_isolate_id
,
&
latch
]()
{
dart_isolate_id
,
isolate_name
,
&
latch
]()
{
RunInPlatformViewUIThread
(
view_id
,
main_script
,
packages_file
,
asset_directory
,
view_existed
,
dart_isolate_id
,
&
latch
);
isolate_name
,
&
latch
);
});
latch
.
Wait
();
}
...
...
@@ -297,6 +299,7 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id,
const
std
::
string
&
assets_directory
,
bool
*
view_existed
,
int64_t
*
dart_isolate_id
,
std
::
string
*
isolate_name
,
ftl
::
AutoResetWaitableEvent
*
latch
)
{
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
CalledOnValidThread
());
...
...
@@ -308,6 +311,7 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id,
*
view_existed
=
true
;
view
->
engine
().
RunFromSource
(
main
,
packages
,
assets_directory
);
*
dart_isolate_id
=
view
->
engine
().
GetUIIsolateMainPort
();
*
isolate_name
=
view
->
engine
().
GetUIIsolateName
();
break
;
}
}
...
...
sky/shell/shell.h
浏览文件 @
1c59ddef
...
...
@@ -50,6 +50,7 @@ class Shell {
struct
PlatformViewInfo
{
uintptr_t
view_id
;
int64_t
isolate_id
;
std
::
string
isolate_name
;
};
// These APIs can be called from any thread.
...
...
@@ -63,7 +64,8 @@ class Shell {
const
char
*
packages_file
,
const
char
*
asset_directory
,
bool
*
view_existed
,
int64_t
*
dart_isolate_id
);
int64_t
*
dart_isolate_id
,
std
::
string
*
isolate_name
);
private:
Shell
();
...
...
@@ -81,6 +83,7 @@ class Shell {
const
std
::
string
&
assets_directory
,
bool
*
view_existed
,
int64_t
*
dart_isolate_id
,
std
::
string
*
isolate_name
,
ftl
::
AutoResetWaitableEvent
*
latch
);
std
::
unique_ptr
<
base
::
Thread
>
gpu_thread_
;
...
...
sky/shell/ui/engine.cc
浏览文件 @
1c59ddef
...
...
@@ -101,6 +101,13 @@ Dart_Port Engine::GetUIIsolateMainPort() {
return
runtime_
->
GetMainPort
();
}
std
::
string
Engine
::
GetUIIsolateName
()
{
if
(
!
runtime_
)
{
return
""
;
}
return
runtime_
->
GetIsolateName
();
}
void
Engine
::
ConnectToEngine
(
mojo
::
InterfaceRequest
<
SkyEngine
>
request
)
{
binding_
.
Bind
(
request
.
Pass
());
}
...
...
sky/shell/ui/engine.h
浏览文件 @
1c59ddef
...
...
@@ -52,6 +52,8 @@ class Engine : public UIDelegate,
Dart_Port
GetUIIsolateMainPort
();
std
::
string
GetUIIsolateName
();
private:
// UIDelegate implementation:
void
ConnectToEngine
(
mojo
::
InterfaceRequest
<
SkyEngine
>
request
)
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录