Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
9ede9bfa
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,发现更多精彩内容 >>
未验证
提交
9ede9bfa
编写于
10月 02, 2020
作者:
C
Chris Yang
提交者:
GitHub
10月 02, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iOS: only add explicit transactions when there are platform views (only on main threads) (#21526)
上级
0f4f6c73
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
38 addition
and
15 deletion
+38
-15
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
...tform/darwin/ios/framework/Source/FlutterPlatformViews.mm
+27
-0
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
...rwin/ios/framework/Source/FlutterPlatformViews_Internal.h
+9
-0
shell/platform/darwin/ios/ios_surface.mm
shell/platform/darwin/ios/ios_surface.mm
+2
-15
未找到文件。
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
浏览文件 @
9ede9bfa
...
...
@@ -279,6 +279,11 @@ PostPrerollResult FlutterPlatformViewsController::PostPrerollAction(
CancelFrame
();
return
PostPrerollResult
::
kSkipAndRetryFrame
;
}
// If the post preroll action is successful, we will display platform views in the current frame.
// In order to sync the rendering of the platform views (quartz) with skia's rendering,
// We need to begin an explicit CATransaction. This transaction needs to be submitted
// after the current frame is submitted.
BeginCATransaction
();
raster_thread_merger
->
ExtendLeaseTo
(
kDefaultMergedLeaseDuration
);
return
PostPrerollResult
::
kSuccess
;
}
...
...
@@ -286,6 +291,9 @@ PostPrerollResult FlutterPlatformViewsController::PostPrerollAction(
void
FlutterPlatformViewsController
::
PrerollCompositeEmbeddedView
(
int
view_id
,
std
::
unique_ptr
<
EmbeddedViewParams
>
params
)
{
// All the CATransactions should be committed by the end of the last frame,
// so catransaction_added_ must be false.
FML_DCHECK
(
!
catransaction_added_
);
picture_recorders_
[
view_id
]
=
std
::
make_unique
<
SkPictureRecorder
>
();
auto
rtree_factory
=
RTreeFactory
();
...
...
@@ -548,6 +556,10 @@ bool FlutterPlatformViewsController::SubmitFrame(GrDirectContext* gr_context,
did_submit
&=
frame
->
Submit
();
// If the frame is submitted with embedded platform views,
// there should be a |[CATransaction begin]| call in this frame prior to all the drawing.
// If that case, we need to commit the transaction.
CommitCATransactionIfNeeded
();
return
did_submit
;
}
...
...
@@ -662,6 +674,21 @@ void FlutterPlatformViewsController::DisposeViews() {
views_to_dispose_
.
clear
();
}
void
FlutterPlatformViewsController
::
BeginCATransaction
()
{
FML_DCHECK
([[
NSThread
currentThread
]
isMainThread
]);
FML_DCHECK
(
!
catransaction_added_
);
[
CATransaction
begin
];
catransaction_added_
=
true
;
}
void
FlutterPlatformViewsController
::
CommitCATransactionIfNeeded
()
{
if
(
catransaction_added_
)
{
FML_DCHECK
([[
NSThread
currentThread
]
isMainThread
]);
[
CATransaction
commit
];
catransaction_added_
=
false
;
}
}
}
// namespace flutter
// This recognizers delays touch events from being dispatched to the responder chain until it failed
...
...
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
浏览文件 @
9ede9bfa
...
...
@@ -245,6 +245,8 @@ class FlutterPlatformViewsController {
std
::
unique_ptr
<
fml
::
WeakPtrFactory
<
FlutterPlatformViewsController
>>
weak_factory_
;
bool
catransaction_added_
=
false
;
void
OnCreate
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
void
OnDispose
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
void
OnAcceptGesture
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
...
...
@@ -294,6 +296,13 @@ class FlutterPlatformViewsController {
// order.
void
BringLayersIntoView
(
LayersMap
layer_map
);
// Begin a CATransaction.
// This transaction needs to be balanced with |CommitCATransactionIfNeeded|.
void
BeginCATransaction
();
// Commit a CATransaction if |BeginCATransaction| has been called during the frame.
void
CommitCATransactionIfNeeded
();
FML_DISALLOW_COPY_AND_ASSIGN
(
FlutterPlatformViewsController
);
};
...
...
shell/platform/darwin/ios/ios_surface.mm
浏览文件 @
9ede9bfa
...
...
@@ -71,9 +71,6 @@ void IOSSurface::CancelFrame() {
TRACE_EVENT0
(
"flutter"
,
"IOSSurface::CancelFrame"
);
FML_CHECK
(
platform_views_controller_
!=
nullptr
);
platform_views_controller_
->
CancelFrame
();
// Committing the current transaction as |BeginFrame| will create a nested
// CATransaction otherwise.
[
CATransaction
commit
];
}
// |ExternalViewEmbedder|
...
...
@@ -84,7 +81,6 @@ void IOSSurface::BeginFrame(SkISize frame_size,
TRACE_EVENT0
(
"flutter"
,
"IOSSurface::BeginFrame"
);
FML_CHECK
(
platform_views_controller_
!=
nullptr
);
platform_views_controller_
->
SetFrameSize
(
frame_size
);
[
CATransaction
begin
];
}
// |ExternalViewEmbedder|
...
...
@@ -102,10 +98,6 @@ PostPrerollResult IOSSurface::PostPrerollAction(
TRACE_EVENT0
(
"flutter"
,
"IOSSurface::PostPrerollAction"
);
FML_CHECK
(
platform_views_controller_
!=
nullptr
);
PostPrerollResult
result
=
platform_views_controller_
->
PostPrerollAction
(
raster_thread_merger
);
if
(
result
==
PostPrerollResult
::
kSkipAndRetryFrame
)
{
// Commit the current transaction if the frame is dropped.
[
CATransaction
commit
];
}
return
result
;
}
...
...
@@ -126,13 +118,8 @@ SkCanvas* IOSSurface::CompositeEmbeddedView(int view_id) {
void
IOSSurface
::
SubmitFrame
(
GrDirectContext
*
context
,
std
::
unique_ptr
<
SurfaceFrame
>
frame
)
{
TRACE_EVENT0
(
"flutter"
,
"IOSSurface::SubmitFrame"
);
FML_CHECK
(
platform_views_controller_
!=
nullptr
);
bool
submitted
=
platform_views_controller_
->
SubmitFrame
(
std
::
move
(
context
),
ios_context_
,
std
::
move
(
frame
));
if
(
submitted
)
{
TRACE_EVENT0
(
"flutter"
,
"IOSSurface::DidSubmitFrame"
);
[
CATransaction
commit
];
}
}
// |ExternalViewEmbedder|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录