Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
ac809b48
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,发现更多精彩内容 >>
未验证
提交
ac809b48
编写于
6月 11, 2020
作者:
C
cg021
提交者:
GitHub
6月 11, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
onBeginFrame JNI (#18866)
上级
5f37029a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
0 deletion
+62
-0
shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java
...tform/android/io/flutter/embedding/engine/FlutterJNI.java
+11
-0
shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java
...d/io/flutter/plugin/platform/PlatformViewsController.java
+4
-0
shell/platform/android/jni/platform_view_android_jni.h
shell/platform/android/jni/platform_view_android_jni.h
+7
-0
shell/platform/android/platform_view_android_jni_impl.cc
shell/platform/android/platform_view_android_jni_impl.cc
+23
-0
shell/platform/android/platform_view_android_jni_impl.h
shell/platform/android/platform_view_android_jni_impl.h
+2
-0
shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java
...roid/test/io/flutter/embedding/engine/FlutterJNITest.java
+15
-0
未找到文件。
shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java
浏览文件 @
ac809b48
...
...
@@ -799,6 +799,17 @@ public class FlutterJNI {
}
platformViewsController
.
onDisplayOverlaySurface
(
id
,
x
,
y
,
width
,
height
);
}
@SuppressWarnings
(
"unused"
)
@UiThread
public
void
onBeginFrame
()
{
ensureRunningOnMainThread
();
if
(
platformViewsController
==
null
)
{
throw
new
RuntimeException
(
"platformViewsController must be set before attempting to begin the frame"
);
}
platformViewsController
.
onBeginFrame
();
}
// ----- End Engine Lifecycle Support ----
// @SuppressWarnings("unused")
...
...
shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java
浏览文件 @
ac809b48
...
...
@@ -541,4 +541,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
public
void
onDisplayOverlaySurface
(
int
id
,
int
x
,
int
y
,
int
width
,
int
height
)
{
// TODO: Implement this method. https://github.com/flutter/flutter/issues/58288
}
public
void
onBeginFrame
()
{
// TODO: Implement this method. https://github.com/flutter/flutter/issues/58288
}
}
shell/platform/android/jni/platform_view_android_jni.h
浏览文件 @
ac809b48
...
...
@@ -130,6 +130,13 @@ class PlatformViewAndroidJNI {
int
y
,
int
width
,
int
height
)
=
0
;
//----------------------------------------------------------------------------
/// @brief Initiates a frame if using hybrid composition.
///
///
/// @note Must be called from the platform thread.
///
virtual
void
FlutterViewBeginFrame
()
=
0
;
};
}
// namespace flutter
...
...
shell/platform/android/platform_view_android_jni_impl.cc
浏览文件 @
ac809b48
...
...
@@ -80,6 +80,8 @@ static jmethodID g_on_first_frame_method = nullptr;
static
jmethodID
g_on_engine_restart_method
=
nullptr
;
static
jmethodID
g_on_begin_frame_method
=
nullptr
;
static
jmethodID
g_attach_to_gl_context_method
=
nullptr
;
static
jmethodID
g_update_tex_image_method
=
nullptr
;
...
...
@@ -718,6 +720,14 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
return
false
;
}
g_on_begin_frame_method
=
env
->
GetMethodID
(
g_flutter_jni_class
->
obj
(),
"onBeginFrame"
,
"()V"
);
if
(
g_on_begin_frame_method
==
nullptr
)
{
FML_LOG
(
ERROR
)
<<
"Could not locate onBeginFrame method"
;
return
false
;
}
g_on_display_overlay_surface_method
=
env
->
GetMethodID
(
g_flutter_jni_class
->
obj
(),
"onDisplayOverlaySurface"
,
"(IIIII)V"
);
...
...
@@ -1034,4 +1044,17 @@ void PlatformViewAndroidJNIImpl::FlutterViewDisplayOverlaySurface(
FML_CHECK
(
CheckException
(
env
));
}
void
PlatformViewAndroidJNIImpl
::
FlutterViewBeginFrame
()
{
JNIEnv
*
env
=
fml
::
jni
::
AttachCurrentThread
();
auto
java_object
=
java_object_
.
get
(
env
);
if
(
java_object
.
is_null
())
{
return
;
}
env
->
CallVoidMethod
(
java_object
.
obj
(),
g_on_begin_frame_method
);
FML_CHECK
(
CheckException
(
env
));
}
}
// namespace flutter
shell/platform/android/platform_view_android_jni_impl.h
浏览文件 @
ac809b48
...
...
@@ -62,6 +62,8 @@ class PlatformViewAndroidJNIImpl final : public PlatformViewAndroidJNI {
int
width
,
int
height
)
override
;
void
FlutterViewBeginFrame
()
override
;
private:
// Reference to FlutterJNI object.
const
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object_
;
...
...
shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java
浏览文件 @
ac809b48
...
...
@@ -81,4 +81,19 @@ public class FlutterJNITest {
verify
(
platformViewsController
,
times
(
1
))
.
onDisplayOverlaySurface
(
/*id=*/
1
,
/*x=*/
10
,
/*y=*/
20
,
/*width=*/
100
,
/*height=*/
200
);
}
@Test
public
void
onBeginFrame__callsPlatformViewsController
()
{
PlatformViewsController
platformViewsController
=
mock
(
PlatformViewsController
.
class
);
// --- Test Setup ---
FlutterJNI
flutterJNI
=
new
FlutterJNI
();
flutterJNI
.
setPlatformViewsController
(
platformViewsController
);
// --- Execute Test ---
flutterJNI
.
onBeginFrame
();
// --- Verify Results ---
verify
(
platformViewsController
,
times
(
1
)).
onBeginFrame
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录