Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
d9cc3177
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,发现更多精彩内容 >>
提交
d9cc3177
编写于
1月 20, 2017
作者:
J
Jason Simmons
提交者:
GitHub
1月 20, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add flags for disabling the diagnostic server or setting its port (#3352)
Fixes
https://github.com/flutter/flutter/issues/7557
上级
94306f41
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
14 deletion
+43
-14
common/settings.h
common/settings.h
+2
-0
shell/common/diagnostic/diagnostic_server.cc
shell/common/diagnostic/diagnostic_server.cc
+3
-2
shell/common/diagnostic/diagnostic_server.dart
shell/common/diagnostic/diagnostic_server.dart
+2
-2
shell/common/diagnostic/diagnostic_server.h
shell/common/diagnostic/diagnostic_server.h
+1
-1
shell/common/shell.cc
shell/common/shell.cc
+28
-9
shell/common/switches.h
shell/common/switches.h
+7
-0
未找到文件。
common/settings.h
浏览文件 @
d9cc3177
...
...
@@ -17,6 +17,8 @@ struct Settings {
// Port on target will be auto selected by the OS. A message will be printed
// on the target with the port after it has been selected.
uint32_t
observatory_port
=
0
;
bool
enable_diagnostic
=
false
;
uint32_t
diagnostic_port
=
0
;
bool
start_paused
=
false
;
bool
trace_startup
=
false
;
bool
endless_trace_buffer
=
false
;
...
...
shell/common/diagnostic/diagnostic_server.cc
浏览文件 @
d9cc3177
...
...
@@ -31,6 +31,7 @@ using tonic::DartLibraryNatives;
using
blink
::
EmbedderResources
;
using
tonic
::
DartInvokeField
;
using
tonic
::
LogIfError
;
using
tonic
::
ToDart
;
namespace
{
...
...
@@ -60,7 +61,7 @@ void SendNull(Dart_Port port_id) {
DART_NATIVE_CALLBACK_STATIC
(
DiagnosticServer
,
HandleSkiaPictureRequest
);
void
DiagnosticServer
::
Start
()
{
void
DiagnosticServer
::
Start
(
uint32_t
port
)
{
if
(
!
g_natives
)
{
g_natives
=
new
DartLibraryNatives
();
g_natives
->
Register
({
...
...
@@ -91,7 +92,7 @@ void DiagnosticServer::Start() {
FTL_CHECK
(
!
LogIfError
(
Dart_FinalizeLoading
(
false
)));
DartInvokeField
(
Dart_RootLibrary
(),
"diagnosticServerStart"
,
{});
DartInvokeField
(
Dart_RootLibrary
(),
"diagnosticServerStart"
,
{
ToDart
(
port
)
});
}
void
DiagnosticServer
::
HandleSkiaPictureRequest
(
Dart_Handle
send_port
)
{
...
...
shell/common/diagnostic/diagnostic_server.dart
浏览文件 @
d9cc3177
...
...
@@ -11,8 +11,8 @@ import 'dart:typed_data';
void
handleSkiaPictureRequest
(
SendPort
sendPort
)
native
'DiagnosticServer_HandleSkiaPictureRequest'
;
void
diagnosticServerStart
(
)
{
HttpServer
.
bind
(
'127.0.0.1'
,
0
).
then
((
HttpServer
server
)
{
void
diagnosticServerStart
(
int
port
)
{
HttpServer
.
bind
(
'127.0.0.1'
,
port
).
then
((
HttpServer
server
)
{
server
.
listen
(
dispatchRequest
,
cancelOnError:
true
);
String
ip
=
server
.
address
.
address
.
toString
();
...
...
shell/common/diagnostic/diagnostic_server.h
浏览文件 @
d9cc3177
...
...
@@ -11,7 +11,7 @@ namespace shell {
class
DiagnosticServer
{
public:
static
void
Start
();
static
void
Start
(
uint32_t
port
);
static
void
HandleSkiaPictureRequest
(
Dart_Handle
send_port
);
private:
...
...
shell/common/shell.cc
浏览文件 @
d9cc3177
...
...
@@ -42,6 +42,18 @@ bool IsViewInvalid(const ftl::WeakPtr<PlatformView>& platform_view) {
return
!
platform_view
;
}
template
<
typename
T
>
bool
GetSwitchValue
(
const
base
::
CommandLine
&
command_line
,
Switch
sw
,
T
*
result
)
{
auto
port_string
=
command_line
.
GetSwitchValueASCII
(
FlagForSwitch
(
sw
));
std
::
stringstream
stream
(
port_string
);
T
value
=
0
;
if
(
stream
>>
value
)
{
*
result
=
value
;
return
true
;
}
return
false
;
}
class
NonDiscardableMemory
:
public
base
::
DiscardableMemory
{
public:
explicit
NonDiscardableMemory
(
size_t
size
)
:
data_
(
new
uint8_t
[
size
])
{}
...
...
@@ -66,8 +78,8 @@ base::LazyInstance<NonDiscardableMemoryAllocator> g_discardable;
void
ServiceIsolateHook
(
bool
running_precompiled
)
{
if
(
!
running_precompiled
)
{
const
blink
::
Settings
&
settings
=
blink
::
Settings
::
Get
();
if
(
settings
.
enable_
observatory
)
DiagnosticServer
::
Start
();
if
(
settings
.
enable_
diagnostic
)
DiagnosticServer
::
Start
(
settings
.
diagnostic_port
);
}
}
...
...
@@ -135,19 +147,26 @@ void Shell::InitStandalone(std::string icu_data_path,
// Set Observatory Port
if
(
command_line
.
HasSwitch
(
FlagForSwitch
(
Switch
::
DeviceObservatoryPort
)))
{
auto
port_string
=
command_line
.
GetSwitchValueASCII
(
FlagForSwitch
(
Switch
::
DeviceObservatoryPort
));
std
::
stringstream
stream
(
port_string
);
uint32_t
port
=
0
;
if
(
stream
>>
port
)
{
settings
.
observatory_port
=
port
;
}
else
{
if
(
!
GetSwitchValue
(
command_line
,
Switch
::
DeviceObservatoryPort
,
&
settings
.
observatory_port
))
{
FTL_LOG
(
INFO
)
<<
"Observatory port specified was malformed. Will default to "
<<
settings
.
observatory_port
;
}
}
settings
.
enable_diagnostic
=
!
command_line
.
HasSwitch
(
FlagForSwitch
(
Switch
::
DisableDiagnostic
));
if
(
command_line
.
HasSwitch
(
FlagForSwitch
(
Switch
::
DeviceDiagnosticPort
)))
{
if
(
!
GetSwitchValue
(
command_line
,
Switch
::
DeviceDiagnosticPort
,
&
settings
.
diagnostic_port
))
{
FTL_LOG
(
INFO
)
<<
"Diagnostic port specified was malformed. Will default to "
<<
settings
.
diagnostic_port
;
}
}
settings
.
start_paused
=
command_line
.
HasSwitch
(
FlagForSwitch
(
Switch
::
StartPaused
));
...
...
shell/common/switches.h
浏览文件 @
d9cc3177
...
...
@@ -43,6 +43,13 @@ DEF_SWITCH(DisableObservatory,
"disable-observatory"
,
"Disable the Dart Observatory. The observatory is never available "
"in release mode."
)
DEF_SWITCH
(
DeviceDiagnosticPort
,
"diagnostic-port"
,
"A custom diagnostic server port."
)
DEF_SWITCH
(
DisableDiagnostic
,
"disable-diagnostic"
,
"Disable the diagnostic server. The diagnostic server is never "
"available in release mode."
)
DEF_SWITCH
(
EnableDartProfiling
,
"enable-dart-profiling"
,
"Enable Dart profiling. Profiling information can be viewed from "
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录