Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
3661d5e4
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,发现更多精彩内容 >>
未验证
提交
3661d5e4
编写于
3月 06, 2019
作者:
G
Gary Qian
提交者:
GitHub
3月 06, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Re-land "Buffer lifecycle in WindowData" (#8032)
上级
471a2c89
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
60 addition
and
1 deletion
+60
-1
lib/stub_ui/hooks.dart
lib/stub_ui/hooks.dart
+4
-0
lib/stub_ui/window.dart
lib/stub_ui/window.dart
+9
-0
lib/ui/hooks.dart
lib/ui/hooks.dart
+7
-0
lib/ui/window.dart
lib/ui/window.dart
+9
-0
lib/ui/window/window.cc
lib/ui/window/window.cc
+12
-0
lib/ui/window/window.h
lib/ui/window/window.h
+1
-0
runtime/runtime_controller.cc
runtime/runtime_controller.cc
+13
-1
runtime/runtime_controller.h
runtime/runtime_controller.h
+3
-0
shell/common/engine.cc
shell/common/engine.cc
+2
-0
未找到文件。
lib/stub_ui/hooks.dart
浏览文件 @
3661d5e4
...
@@ -84,6 +84,10 @@ void _updateUserSettingsData(String jsonData) {
...
@@ -84,6 +84,10 @@ void _updateUserSettingsData(String jsonData) {
_updateAlwaysUse24HourFormat
(
data
[
'alwaysUse24HourFormat'
]);
_updateAlwaysUse24HourFormat
(
data
[
'alwaysUse24HourFormat'
]);
}
}
void
_updateLifecycleState
(
String
state
)
{
window
.
_initialLifecycleState
??=
state
;
}
void
_updateTextScaleFactor
(
double
textScaleFactor
)
{
void
_updateTextScaleFactor
(
double
textScaleFactor
)
{
window
.
_textScaleFactor
=
textScaleFactor
;
window
.
_textScaleFactor
=
textScaleFactor
;
_invoke
(
window
.
onTextScaleFactorChanged
,
window
.
_onTextScaleFactorChangedZone
);
_invoke
(
window
.
onTextScaleFactorChanged
,
window
.
_onTextScaleFactorChangedZone
);
...
...
lib/stub_ui/window.dart
浏览文件 @
3661d5e4
...
@@ -551,6 +551,15 @@ class Window {
...
@@ -551,6 +551,15 @@ class Window {
_onLocaleChangedZone
=
Zone
.
current
;
_onLocaleChangedZone
=
Zone
.
current
;
}
}
/// The lifecycle state immediately after dart isolate initialization.
///
/// This property will not be updated as the lifecycle changes.
///
/// It is used to initialize [SchedulerBinding.lifecycleState] at startup
/// with any buffered lifecycle state events.
String
get
initialLifecycleState
=>
_initialLifecycleState
;
String
_initialLifecycleState
;
/// The setting indicating the current brightness mode of the host platform.
/// The setting indicating the current brightness mode of the host platform.
/// If the platform has no preference, [platformBrightness] defaults to [Brightness.light].
/// If the platform has no preference, [platformBrightness] defaults to [Brightness.light].
Brightness
get
platformBrightness
=>
_platformBrightness
;
Brightness
get
platformBrightness
=>
_platformBrightness
;
...
...
lib/ui/hooks.dart
浏览文件 @
3661d5e4
...
@@ -89,6 +89,13 @@ void _updateUserSettingsData(String jsonData) {
...
@@ -89,6 +89,13 @@ void _updateUserSettingsData(String jsonData) {
_updatePlatformBrightness
(
data
[
'platformBrightness'
]);
_updatePlatformBrightness
(
data
[
'platformBrightness'
]);
}
}
@pragma
(
'vm:entry-point'
)
// ignore: unused_element
void
_updateLifecycleState
(
String
state
)
{
window
.
_initialLifecycleState
??=
state
;
}
void
_updateTextScaleFactor
(
double
textScaleFactor
)
{
void
_updateTextScaleFactor
(
double
textScaleFactor
)
{
window
.
_textScaleFactor
=
textScaleFactor
;
window
.
_textScaleFactor
=
textScaleFactor
;
_invoke
(
window
.
onTextScaleFactorChanged
,
window
.
_onTextScaleFactorChangedZone
);
_invoke
(
window
.
onTextScaleFactorChanged
,
window
.
_onTextScaleFactorChangedZone
);
...
...
lib/ui/window.dart
浏览文件 @
3661d5e4
...
@@ -556,6 +556,15 @@ class Window {
...
@@ -556,6 +556,15 @@ class Window {
_onLocaleChangedZone
=
Zone
.
current
;
_onLocaleChangedZone
=
Zone
.
current
;
}
}
/// The lifecycle state immediately after dart isolate initialization.
///
/// This property will not be updated as the lifecycle changes.
///
/// It is used to initialize [SchedulerBinding.lifecycleState] at startup
/// with any buffered lifecycle state events.
String
get
initialLifecycleState
=>
_initialLifecycleState
;
String
_initialLifecycleState
;
/// The system-reported text scale.
/// The system-reported text scale.
///
///
/// This establishes the text scaling factor to use when rendering text,
/// This establishes the text scaling factor to use when rendering text,
...
...
lib/ui/window/window.cc
浏览文件 @
3661d5e4
...
@@ -217,6 +217,18 @@ void Window::UpdateUserSettingsData(const std::string& data) {
...
@@ -217,6 +217,18 @@ void Window::UpdateUserSettingsData(const std::string& data) {
}));
}));
}
}
void
Window
::
UpdateLifecycleState
(
const
std
::
string
&
data
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
if
(
!
dart_state
)
return
;
tonic
::
DartState
::
Scope
scope
(
dart_state
);
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_updateLifecycleState"
,
{
tonic
::
StdStringToDart
(
data
),
}));
}
void
Window
::
UpdateSemanticsEnabled
(
bool
enabled
)
{
void
Window
::
UpdateSemanticsEnabled
(
bool
enabled
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
if
(
!
dart_state
)
if
(
!
dart_state
)
...
...
lib/ui/window/window.h
浏览文件 @
3661d5e4
...
@@ -65,6 +65,7 @@ class Window final {
...
@@ -65,6 +65,7 @@ class Window final {
void
UpdateWindowMetrics
(
const
ViewportMetrics
&
metrics
);
void
UpdateWindowMetrics
(
const
ViewportMetrics
&
metrics
);
void
UpdateLocales
(
const
std
::
vector
<
std
::
string
>&
locales
);
void
UpdateLocales
(
const
std
::
vector
<
std
::
string
>&
locales
);
void
UpdateUserSettingsData
(
const
std
::
string
&
data
);
void
UpdateUserSettingsData
(
const
std
::
string
&
data
);
void
UpdateLifecycleState
(
const
std
::
string
&
data
);
void
UpdateSemanticsEnabled
(
bool
enabled
);
void
UpdateSemanticsEnabled
(
bool
enabled
);
void
UpdateAccessibilityFeatures
(
int32_t
flags
);
void
UpdateAccessibilityFeatures
(
int32_t
flags
);
void
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
void
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
...
...
runtime/runtime_controller.cc
浏览文件 @
3661d5e4
...
@@ -128,7 +128,8 @@ bool RuntimeController::FlushRuntimeStateToIsolate() {
...
@@ -128,7 +128,8 @@ bool RuntimeController::FlushRuntimeStateToIsolate() {
SetLocales
(
window_data_
.
locale_data
)
&&
SetLocales
(
window_data_
.
locale_data
)
&&
SetSemanticsEnabled
(
window_data_
.
semantics_enabled
)
&&
SetSemanticsEnabled
(
window_data_
.
semantics_enabled
)
&&
SetAccessibilityFeatures
(
window_data_
.
accessibility_feature_flags_
)
&&
SetAccessibilityFeatures
(
window_data_
.
accessibility_feature_flags_
)
&&
SetUserSettingsData
(
window_data_
.
user_settings_data
);
SetUserSettingsData
(
window_data_
.
user_settings_data
)
&&
SetLifecycleState
(
window_data_
.
lifecycle_state
);
}
}
bool
RuntimeController
::
SetViewportMetrics
(
const
ViewportMetrics
&
metrics
)
{
bool
RuntimeController
::
SetViewportMetrics
(
const
ViewportMetrics
&
metrics
)
{
...
@@ -164,6 +165,17 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) {
...
@@ -164,6 +165,17 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) {
return
false
;
return
false
;
}
}
bool
RuntimeController
::
SetLifecycleState
(
const
std
::
string
&
data
)
{
window_data_
.
lifecycle_state
=
data
;
if
(
auto
*
window
=
GetWindowIfAvailable
())
{
window
->
UpdateLifecycleState
(
window_data_
.
lifecycle_state
);
return
true
;
}
return
false
;
}
bool
RuntimeController
::
SetSemanticsEnabled
(
bool
enabled
)
{
bool
RuntimeController
::
SetSemanticsEnabled
(
bool
enabled
)
{
window_data_
.
semantics_enabled
=
enabled
;
window_data_
.
semantics_enabled
=
enabled
;
...
...
runtime/runtime_controller.h
浏览文件 @
3661d5e4
...
@@ -49,6 +49,8 @@ class RuntimeController final : public WindowClient {
...
@@ -49,6 +49,8 @@ class RuntimeController final : public WindowClient {
bool
SetUserSettingsData
(
const
std
::
string
&
data
);
bool
SetUserSettingsData
(
const
std
::
string
&
data
);
bool
SetLifecycleState
(
const
std
::
string
&
data
);
bool
SetSemanticsEnabled
(
bool
enabled
);
bool
SetSemanticsEnabled
(
bool
enabled
);
bool
SetAccessibilityFeatures
(
int32_t
flags
);
bool
SetAccessibilityFeatures
(
int32_t
flags
);
...
@@ -111,6 +113,7 @@ class RuntimeController final : public WindowClient {
...
@@ -111,6 +113,7 @@ class RuntimeController final : public WindowClient {
std
::
string
variant_code
;
std
::
string
variant_code
;
std
::
vector
<
std
::
string
>
locale_data
;
std
::
vector
<
std
::
string
>
locale_data
;
std
::
string
user_settings_data
=
"{}"
;
std
::
string
user_settings_data
=
"{}"
;
std
::
string
lifecycle_state
;
bool
semantics_enabled
=
false
;
bool
semantics_enabled
=
false
;
bool
assistive_technology_enabled
=
false
;
bool
assistive_technology_enabled
=
false
;
int32_t
accessibility_feature_flags_
=
0
;
int32_t
accessibility_feature_flags_
=
0
;
...
...
shell/common/engine.cc
浏览文件 @
3661d5e4
...
@@ -291,6 +291,8 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) {
...
@@ -291,6 +291,8 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) {
if
(
state
==
"AppLifecycleState.resumed"
&&
have_surface_
)
{
if
(
state
==
"AppLifecycleState.resumed"
&&
have_surface_
)
{
ScheduleFrame
();
ScheduleFrame
();
}
}
runtime_controller_
->
SetLifecycleState
(
state
);
// Always forward these messages to the framework by returning false.
return
false
;
return
false
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录