Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
892034dc
E
engine
项目概览
qq_34031325
/
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
892034dc
编写于
12月 28, 2020
作者:
D
Dan Field
提交者:
GitHub
12月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cache closures from hooks.dart (#23230)
上级
64c69898
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
87 addition
and
48 deletion
+87
-48
lib/ui/window/platform_configuration.cc
lib/ui/window/platform_configuration.cc
+76
-45
lib/ui/window/platform_configuration.h
lib/ui/window/platform_configuration.h
+11
-3
未找到文件。
lib/ui/window/platform_configuration.cc
浏览文件 @
892034dc
...
...
@@ -196,80 +196,109 @@ PlatformConfiguration::PlatformConfiguration(
PlatformConfiguration
::~
PlatformConfiguration
()
{}
void
PlatformConfiguration
::
DidCreateIsolate
()
{
library_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_LookupLibrary
(
tonic
::
ToDart
(
"dart:ui"
)));
Dart_Handle
library
=
Dart_LookupLibrary
(
tonic
::
ToDart
(
"dart:ui"
));
update_locales_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_updateLocales"
)));
update_user_settings_data_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_updateUserSettingsData"
)));
update_lifecycle_state_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_updateLifecycleState"
)));
update_semantics_enabled_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_updateSemanticsEnabled"
)));
update_accessibility_features_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_updateAccessibilityFeatures"
)));
dispatch_platform_message_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_dispatchPlatformMessage"
)));
dispatch_semantics_action_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_dispatchSemanticsAction"
)));
begin_frame_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_beginFrame"
)));
draw_frame_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_drawFrame"
)));
report_timings_
.
Set
(
tonic
::
DartState
::
Current
(),
Dart_GetField
(
library
,
tonic
::
ToDart
(
"_reportTimings"
)));
windows_
.
insert
(
std
::
make_pair
(
0
,
std
::
unique_ptr
<
Window
>
(
new
Window
{
0
,
ViewportMetrics
{
1.0
,
0.0
,
0.0
}})));
}
void
PlatformConfiguration
::
UpdateLocales
(
const
std
::
vector
<
std
::
string
>&
locales
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
update_locales_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
tonic
::
DartState
::
Scope
scope
(
dart_state
);
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_updateLocales"
,
{
tonic
::
ToDart
<
std
::
vector
<
std
::
string
>>
(
locales
),
}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
update_locales_
.
Get
()
,
{
tonic
::
ToDart
<
std
::
vector
<
std
::
string
>>
(
locales
),
}));
}
void
PlatformConfiguration
::
UpdateUserSettingsData
(
const
std
::
string
&
data
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
update_user_settings_data_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
tonic
::
DartState
::
Scope
scope
(
dart_state
);
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_updateUserSettingsData"
,
{
tonic
::
StdStringToDart
(
data
),
}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
update_user_settings_data_
.
Get
(),
{
tonic
::
StdStringToDart
(
data
),
}));
}
void
PlatformConfiguration
::
UpdateLifecycleState
(
const
std
::
string
&
data
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
update_lifecycle_state_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
tonic
::
DartState
::
Scope
scope
(
dart_state
);
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_updateLifecycleState"
,
{
tonic
::
StdStringToDart
(
data
),
}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
update_lifecycle_state_
.
Get
(),
{
tonic
::
StdStringToDart
(
data
),
}));
}
void
PlatformConfiguration
::
UpdateSemanticsEnabled
(
bool
enabled
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
update_semantics_enabled_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
tonic
::
DartState
::
Scope
scope
(
dart_state
);
UIDartState
::
ThrowIfUIOperationsProhibited
();
tonic
::
LogIfError
(
tonic
::
DartInvoke
Field
(
library_
.
value
(),
"_updateSemanticsEnabled"
,
{
tonic
::
ToDart
(
enabled
)}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
update_semantics_enabled_
.
Get
(),
{
tonic
::
ToDart
(
enabled
)}));
}
void
PlatformConfiguration
::
UpdateAccessibilityFeatures
(
int32_t
values
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
update_accessibility_features_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
tonic
::
DartState
::
Scope
scope
(
dart_state
);
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_updateAccessibilityFeatures"
,
{
tonic
::
ToDart
(
values
)}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
update_accessibility_features_
.
Get
(),
{
tonic
::
ToDart
(
values
)}));
}
void
PlatformConfiguration
::
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
dispatch_platform_message_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
FML_DLOG
(
WARNING
)
<<
"Dropping platform message for lack of DartState on channel: "
...
...
@@ -293,15 +322,16 @@ void PlatformConfiguration::DispatchPlatformMessage(
}
tonic
::
LogIfError
(
tonic
::
DartInvoke
Field
(
library_
.
value
(),
"_dispatchPlatformMessage"
,
{
tonic
::
ToDart
(
message
->
channel
()),
data_handle
,
tonic
::
ToDart
(
response_id
)}));
tonic
::
DartInvoke
(
dispatch_platform_message_
.
Get
()
,
{
tonic
::
ToDart
(
message
->
channel
()),
data_handle
,
tonic
::
ToDart
(
response_id
)}));
}
void
PlatformConfiguration
::
DispatchSemanticsAction
(
int32_t
id
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
dispatch_semantics_action_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
...
...
@@ -313,14 +343,15 @@ void PlatformConfiguration::DispatchSemanticsAction(int32_t id,
return
;
}
tonic
::
LogIfError
(
tonic
::
DartInvoke
Field
(
library_
.
value
(),
"_dispatchSemanticsAction"
,
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
dispatch_semantics_action_
.
Get
()
,
{
tonic
::
ToDart
(
id
),
tonic
::
ToDart
(
static_cast
<
int32_t
>
(
action
)),
args_handle
}));
}
void
PlatformConfiguration
::
BeginFrame
(
fml
::
TimePoint
frameTime
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
begin_frame_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
...
...
@@ -328,18 +359,19 @@ void PlatformConfiguration::BeginFrame(fml::TimePoint frameTime) {
int64_t
microseconds
=
(
frameTime
-
fml
::
TimePoint
()).
ToMicroseconds
();
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_beginFrame"
,
{
Dart_NewInteger
(
microseconds
),
}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
begin_frame_
.
Get
(),
{
Dart_NewInteger
(
microseconds
),
}));
UIDartState
::
Current
()
->
FlushMicrotasksNow
();
tonic
::
LogIfError
(
tonic
::
DartInvoke
Field
(
library_
.
value
(),
"_drawFrame"
,
{}
));
tonic
::
LogIfError
(
tonic
::
DartInvoke
Void
(
draw_frame_
.
Get
()
));
}
void
PlatformConfiguration
::
ReportTimings
(
std
::
vector
<
int64_t
>
timings
)
{
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
library_
.
dart_state
().
lock
();
std
::
shared_ptr
<
tonic
::
DartState
>
dart_state
=
report_timings_
.
dart_state
().
lock
();
if
(
!
dart_state
)
{
return
;
}
...
...
@@ -358,10 +390,9 @@ void PlatformConfiguration::ReportTimings(std::vector<int64_t> timings) {
memcpy
(
data
,
timings
.
data
(),
sizeof
(
int64_t
)
*
timings
.
size
());
FML_CHECK
(
Dart_TypedDataReleaseData
(
data_handle
));
tonic
::
LogIfError
(
tonic
::
DartInvokeField
(
library_
.
value
(),
"_reportTimings"
,
{
data_handle
,
}));
tonic
::
LogIfError
(
tonic
::
DartInvoke
(
report_timings_
.
Get
(),
{
data_handle
,
}));
}
void
PlatformConfiguration
::
CompletePlatformMessageEmptyResponse
(
...
...
lib/ui/window/platform_configuration.h
浏览文件 @
892034dc
...
...
@@ -325,8 +325,7 @@ class PlatformConfiguration final {
//----------------------------------------------------------------------------
/// @brief Notifies the framework that it is time to begin working on a
/// new
/// frame previously scheduled via a call to
/// new frame previously scheduled via a call to
/// `PlatformConfigurationClient::ScheduleFrame`. This call
/// originates in the animator.
///
...
...
@@ -414,7 +413,16 @@ class PlatformConfiguration final {
private:
PlatformConfigurationClient
*
client_
;
tonic
::
DartPersistentValue
library_
;
tonic
::
DartPersistentValue
update_locales_
;
tonic
::
DartPersistentValue
update_user_settings_data_
;
tonic
::
DartPersistentValue
update_lifecycle_state_
;
tonic
::
DartPersistentValue
update_semantics_enabled_
;
tonic
::
DartPersistentValue
update_accessibility_features_
;
tonic
::
DartPersistentValue
dispatch_platform_message_
;
tonic
::
DartPersistentValue
dispatch_semantics_action_
;
tonic
::
DartPersistentValue
begin_frame_
;
tonic
::
DartPersistentValue
draw_frame_
;
tonic
::
DartPersistentValue
report_timings_
;
std
::
unordered_map
<
int64_t
,
std
::
unique_ptr
<
Window
>>
windows_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录