Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
49a40fab
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,发现更多精彩内容 >>
未验证
提交
49a40fab
编写于
7月 29, 2020
作者:
G
gaaclarke
提交者:
GitHub
7月 29, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enabled linting on engine.cc (#19981)
上级
34389f50
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
27 deletion
+42
-27
shell/common/engine.cc
shell/common/engine.cc
+37
-26
shell/common/engine.h
shell/common/engine.h
+5
-1
未找到文件。
shell/common/engine.cc
浏览文件 @
49a40fab
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// FLUTTER_NOLINT
#include "flutter/shell/common/engine.h"
...
...
@@ -281,23 +280,32 @@ void Engine::SetViewportMetrics(const ViewportMetrics& metrics) {
viewport_metrics_
=
metrics
;
runtime_controller_
->
SetViewportMetrics
(
viewport_metrics_
);
if
(
animator_
)
{
if
(
dimensions_changed
)
if
(
dimensions_changed
)
{
animator_
->
SetDimensionChangePending
();
if
(
have_surface_
)
}
if
(
have_surface_
)
{
ScheduleFrame
();
}
}
}
void
Engine
::
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
if
(
message
->
channel
()
==
kLifecycleChannel
)
{
if
(
HandleLifecyclePlatformMessage
(
message
.
get
()))
std
::
string
channel
=
message
->
channel
();
if
(
channel
==
kLifecycleChannel
)
{
if
(
HandleLifecyclePlatformMessage
(
message
.
get
()))
{
return
;
}
else
if
(
message
->
channel
()
==
kLocalizationChannel
)
{
if
(
HandleLocalizationPlatformMessage
(
message
.
get
()))
}
}
else
if
(
channel
==
kLocalizationChannel
)
{
if
(
HandleLocalizationPlatformMessage
(
message
.
get
()))
{
return
;
}
else
if
(
message
->
channel
()
==
kSettingsChannel
)
{
}
}
else
if
(
channel
==
kSettingsChannel
)
{
HandleSettingsPlatformMessage
(
message
.
get
());
return
;
}
else
if
(
channel
==
kNavigationChannel
)
{
// If there's no runtime_, we may still need to set the initial route.
HandleNavigationPlatformMessage
(
std
::
move
(
message
));
return
;
}
if
(
runtime_controller_
->
IsRootIsolateRunning
()
&&
...
...
@@ -305,14 +313,7 @@ void Engine::DispatchPlatformMessage(fml::RefPtr<PlatformMessage> message) {
return
;
}
// If there's no runtime_, we may still need to set the initial route.
if
(
message
->
channel
()
==
kNavigationChannel
)
{
HandleNavigationPlatformMessage
(
std
::
move
(
message
));
return
;
}
FML_DLOG
(
WARNING
)
<<
"Dropping platform message on channel: "
<<
message
->
channel
();
FML_DLOG
(
WARNING
)
<<
"Dropping platform message on channel: "
<<
channel
;
}
bool
Engine
::
HandleLifecyclePlatformMessage
(
PlatformMessage
*
message
)
{
...
...
@@ -345,12 +346,14 @@ bool Engine::HandleNavigationPlatformMessage(
rapidjson
::
Document
document
;
document
.
Parse
(
reinterpret_cast
<
const
char
*>
(
data
.
data
()),
data
.
size
());
if
(
document
.
HasParseError
()
||
!
document
.
IsObject
())
if
(
document
.
HasParseError
()
||
!
document
.
IsObject
())
{
return
false
;
}
auto
root
=
document
.
GetObject
();
auto
method
=
root
.
FindMember
(
"method"
);
if
(
method
->
value
!=
"setInitialRoute"
)
if
(
method
->
value
!=
"setInitialRoute"
)
{
return
false
;
}
auto
route
=
root
.
FindMember
(
"args"
);
initial_route_
=
std
::
move
(
route
->
value
.
GetString
());
return
true
;
...
...
@@ -361,27 +364,32 @@ bool Engine::HandleLocalizationPlatformMessage(PlatformMessage* message) {
rapidjson
::
Document
document
;
document
.
Parse
(
reinterpret_cast
<
const
char
*>
(
data
.
data
()),
data
.
size
());
if
(
document
.
HasParseError
()
||
!
document
.
IsObject
())
if
(
document
.
HasParseError
()
||
!
document
.
IsObject
())
{
return
false
;
}
auto
root
=
document
.
GetObject
();
auto
method
=
root
.
FindMember
(
"method"
);
if
(
method
==
root
.
MemberEnd
())
if
(
method
==
root
.
MemberEnd
())
{
return
false
;
}
const
size_t
strings_per_locale
=
4
;
if
(
method
->
value
==
"setLocale"
)
{
// Decode and pass the list of locale data onwards to dart.
auto
args
=
root
.
FindMember
(
"args"
);
if
(
args
==
root
.
MemberEnd
()
||
!
args
->
value
.
IsArray
())
if
(
args
==
root
.
MemberEnd
()
||
!
args
->
value
.
IsArray
())
{
return
false
;
}
if
(
args
->
value
.
Size
()
%
strings_per_locale
!=
0
)
if
(
args
->
value
.
Size
()
%
strings_per_locale
!=
0
)
{
return
false
;
}
std
::
vector
<
std
::
string
>
locale_data
;
for
(
size_t
locale_index
=
0
;
locale_index
<
args
->
value
.
Size
();
locale_index
+=
strings_per_locale
)
{
if
(
!
args
->
value
[
locale_index
].
IsString
()
||
!
args
->
value
[
locale_index
+
1
].
IsString
())
!
args
->
value
[
locale_index
+
1
].
IsString
())
{
return
false
;
}
locale_data
.
push_back
(
args
->
value
[
locale_index
].
GetString
());
locale_data
.
push_back
(
args
->
value
[
locale_index
+
1
].
GetString
());
locale_data
.
push_back
(
args
->
value
[
locale_index
+
2
].
GetString
());
...
...
@@ -429,8 +437,9 @@ void Engine::StopAnimator() {
}
void
Engine
::
StartAnimatorIfPossible
()
{
if
(
activity_running_
&&
have_surface_
)
if
(
activity_running_
&&
have_surface_
)
{
animator_
->
Start
();
}
}
std
::
string
Engine
::
DefaultRouteName
()
{
...
...
@@ -445,14 +454,16 @@ void Engine::ScheduleFrame(bool regenerate_layer_tree) {
}
void
Engine
::
Render
(
std
::
unique_ptr
<
flutter
::
LayerTree
>
layer_tree
)
{
if
(
!
layer_tree
)
if
(
!
layer_tree
)
{
return
;
}
// Ensure frame dimensions are sane.
if
(
layer_tree
->
frame_size
().
isEmpty
()
||
layer_tree
->
frame_physical_depth
()
<=
0.0
f
||
layer_tree
->
frame_device_pixel_ratio
()
<=
0.0
f
)
layer_tree
->
frame_device_pixel_ratio
()
<=
0.0
f
)
{
return
;
}
animator_
->
Render
(
std
::
move
(
layer_tree
));
}
...
...
shell/common/engine.h
浏览文件 @
49a40fab
...
...
@@ -727,7 +727,11 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
void
SetAccessibilityFeatures
(
int32_t
flags
);
// |RuntimeDelegate|
void
ScheduleFrame
(
bool
regenerate_layer_tree
=
true
)
override
;
void
ScheduleFrame
(
bool
regenerate_layer_tree
)
override
;
/// Schedule a frame with the default parameter of regenerating the layer
/// tree.
void
ScheduleFrame
()
{
ScheduleFrame
(
true
);
}
// |RuntimeDelegate|
FontCollection
&
GetFontCollection
()
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录